diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-07-01 02:12:43 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-07-01 02:12:43 +0000 |
commit | 13ea39a34766fcbecd96ab94bcdf798b08e9bb60 (patch) | |
tree | 1e1463b03838a6f36868a4dafc7e652358a51857 /tmpfs/dir.c | |
parent | 1f8d504f631531c199d7c6154a0dc442d80ea4a7 (diff) | |
parent | 7e15f3d69a83a34ac62cbbee944a0bfbfa92724e (diff) | |
download | hurd-13ea39a34766fcbecd96ab94bcdf798b08e9bb60.tar.gz hurd-13ea39a34766fcbecd96ab94bcdf798b08e9bb60.tar.bz2 hurd-13ea39a34766fcbecd96ab94bcdf798b08e9bb60.zip |
Merge branch 'master' into xkb
Conflicts:
config.make.in
configure.in
Diffstat (limited to 'tmpfs/dir.c')
-rw-r--r-- | tmpfs/dir.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tmpfs/dir.c b/tmpfs/dir.c index 65386e0a..c0ae9785 100644 --- a/tmpfs/dir.c +++ b/tmpfs/dir.c @@ -29,6 +29,12 @@ diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred) { dp->dn->u.dir.dotdot = pdp->dn; dp->dn->u.dir.entries = 0; + + /* Increase hardlink count for parent directory */ + pdp->dn_stat.st_nlink++; + /* Take '.' directory into account */ + dp->dn_stat.st_nlink++; + return 0; } @@ -40,6 +46,12 @@ diskfs_clear_directory (struct node *dp, struct node *pdp, return ENOTEMPTY; assert (dp->dn_stat.st_size == 0); assert (dp->dn->u.dir.dotdot == pdp->dn); + + /* Decrease hardlink count for parent directory */ + pdp->dn_stat.st_nlink--; + /* Take '.' directory into account */ + dp->dn_stat.st_nlink--; + return 0; } @@ -138,6 +150,7 @@ diskfs_get_directs (struct node *dp, int entry, int n, struct dirstat { struct tmpfs_dirent **prevp; + int dotdot; }; const size_t diskfs_dirstat_size = sizeof (struct dirstat); @@ -166,6 +179,9 @@ diskfs_lookup_hard (struct node *dp, if (type == REMOVE || type == RENAME) assert (np); + if (ds) + ds->dotdot = type & SPEC_DOTDOT; + if (namelen == 1 && name[0] == '.') { if (np != 0) @@ -267,7 +283,11 @@ error_t diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds) { - (*ds->prevp)->dn = np->dn; + if (ds->dotdot) + dp->dn->u.dir.dotdot = np->dn; + else + (*ds->prevp)->dn = np->dn; + return 0; } |