summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorkaashoek <kaashoek>2006-08-14 14:13:52 +0000
committerkaashoek <kaashoek>2006-08-14 14:13:52 +0000
commitbdb66433031ca96f2fd127995186623cd10c45b3 (patch)
tree037ffd2021f27718fba32c27cacd9ca52682b613 /mkfs.c
parentd15f0d1033a7da6448966d9626ec2776781e4188 (diff)
downloadxv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.tar.gz
xv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.tar.bz2
xv6-labs-bdb66433031ca96f2fd127995186623cd10c45b3.zip
set size for directories correctly in wdir and mkfs
mkdir ls shows stat info for each dir entry
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mkfs.c b/mkfs.c
index b048e10..15870d9 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -23,6 +23,7 @@ uint freeinode = 1;
void balloc(int);
void wsect(uint, void *);
void winode(uint, struct dinode *);
+void rinode(uint inum, struct dinode *ip);
void rsect(uint sec, void *buf);
uint ialloc(ushort type);
void iappend(uint inum, void *p, int n);
@@ -53,9 +54,10 @@ xint(uint x)
main(int argc, char *argv[])
{
int i, cc, fd;
- uint bn, rootino, inum;
+ uint bn, rootino, inum, off;
struct dirent de;
char buf[512];
+ struct dinode din;
if(argc < 2){
fprintf(stderr, "Usage: mkfs fs.img files...\n");
@@ -122,6 +124,13 @@ main(int argc, char *argv[])
close(fd);
}
+ // fix size of root inode dir
+ rinode(rootino, &din);
+ off = xint(din.size);
+ off = ((off/BSIZE) + 1) * BSIZE;
+ din.size = xint(off);
+ winode(rootino, &din);
+
balloc(usedblocks);
exit(0);