xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6c0e444fcdf7ba21442513acbc69c7fca9def06b
parent 241113985f7122c65345885dec02e008601ff7ef
Author: kaashoek <kaashoek>
Date:   Wed,  9 Aug 2006 01:19:48 +0000

oops, update directory inode too

Diffstat:
Mfs.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs.c b/fs.c @@ -323,6 +323,10 @@ mknod(struct inode *dp, char *cp, short type, short major, short minor) if (ip == 0) return 0; ip->major = major; ip->minor = minor; + ip->size = 0; + ip->nlink = 0; + + iupdate (ip); // write new inode to disk for(off = 0; off < dp->size; off += BSIZE) { bp = bread(dp->dev, bmap(dp, off / BSIZE)); @@ -340,8 +344,11 @@ mknod(struct inode *dp, char *cp, short type, short major, short minor) found: ep->inum = ip->inum; for(i = 0; i < DIRSIZ && cp[i]; i++) ep->name[i] = cp[i]; - bwrite (dp->dev, bp, bmap(dp, off/BSIZE)); // write directory + bwrite (dp->dev, bp, bmap(dp, off/BSIZE)); // write directory block brelse(bp); - iupdate (ip); + + dp->size += sizeof(struct dirent); // update directory inode + iupdate (dp); + return ip; }