diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-09-19 22:14:36 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-09-19 22:14:36 +0000 |
commit | 675d640c5697271321909ee0833ee9aae35d1737 (patch) | |
tree | aff309242a673ba018c70b40d29efcfb7d36b6c0 /ufs | |
parent | 23d552cc5539d06ece416da68797994a6c3f76a7 (diff) |
Formerly dir.c.~28~
Diffstat (limited to 'ufs')
-rw-r--r-- | ufs/dir.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -20,6 +20,9 @@ #include <string.h> #include <stdio.h> +#include <dirent.h> + +#undef d_ino enum slot_status { @@ -69,7 +72,7 @@ struct dirstat /* For stat HERE_TIS, type REMOVE, this is the address of the immediately previous direct in this directory block, or zero if this is the first. */ - struct director_entry *preventry; + struct directory_entry *preventry; }; size_t diskfs_dirstat_size = sizeof (struct dirstat); @@ -434,7 +437,7 @@ diskfs_direnter(struct node *dp, vm_address_t fromoff, tooff; int totfreed; error_t err; - off_t newsize; + off_t oldsize; assert (ds->type == CREATE); @@ -512,17 +515,17 @@ diskfs_direnter(struct node *dp, /* Extend the file. */ assert (needed <= DIRBLKSIZ); - newsize = dp->dn_stat.st_size + DIRBLKSIZ; - while (newsize > dp->allocsize) - if (err = diskfs_grow (dp, newsize, cred)) + oldsize = dp->dn_stat.st_size; + while (oldsize + DIRBLKSIZ > dp->allocsize) + if (err = diskfs_grow (dp, oldsize + DIRBLKSIZ, cred)) { vm_deallocate (mach_task_self (), ds->mapbuf, ds->mapextent); return err; } - new = (struct directory_entry *) (ds->mapbuf + dp->dn_stat.st_size); + new = (struct directory_entry *) (ds->mapbuf + oldsize); - dp->dn_stat.st_size += DIRBLKSIZ; + dp->dn_stat.st_size = oldsize + DIRBLKSIZ; dp->dn_set_ctime = 1; new->d_ino = np->dn->number; @@ -851,7 +854,7 @@ diskfs_get_directs (struct node *dp, { userp = (struct dirent *) datap; - userp->d_fileno = entryp->d_fileno; + userp->d_fileno = entryp->d_ino; userp->d_reclen = DIRSIZ (DIRECT_NAMLEN (entryp)); userp->d_namlen = DIRECT_NAMLEN (entryp); bcopy (entryp->d_name, userp->d_name, DIRECT_NAMLEN (entryp) + 1); |