diff options
author | Maksym Planeta <mcsim.planeta@gmail.com> | 2012-04-08 13:37:05 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-08 22:23:36 +0200 |
commit | 7e15f3d69a83a34ac62cbbee944a0bfbfa92724e (patch) | |
tree | 0de07d35113d536978d4d4408c0e7e51b0057af5 /tmpfs | |
parent | d43f1c20f6608ab5a6352a181308309c33b81c5b (diff) |
Update '..' link for directory when moving it.
* tmpfs/dir.c (struct dirstat): New field.
(diskfs_lookup_hard): Record whether type is SPEC_DOTDOT in dotdot field of
ds.
(diskfs_dirrewrite_hard): If ds->dotdot is true, set dp->dn->u.dir.dotdot
insteead of (ds->prevp)->dn.
Diffstat (limited to 'tmpfs')
-rw-r--r-- | tmpfs/dir.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tmpfs/dir.c b/tmpfs/dir.c index 4a0a60b5..c0ae9785 100644 --- a/tmpfs/dir.c +++ b/tmpfs/dir.c @@ -150,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); @@ -178,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) @@ -279,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; } |