be clear what the root i-number is
This commit is contained in:
parent
be38c8413e
commit
2ce40d7088
3 changed files with 3 additions and 2 deletions
2
fs.c
2
fs.c
|
@ -582,7 +582,7 @@ _namei(char *path, int parent, char *name)
|
||||||
struct inode *ip, *next;
|
struct inode *ip, *next;
|
||||||
|
|
||||||
if(*path == '/')
|
if(*path == '/')
|
||||||
ip = iget(ROOTDEV, 1);
|
ip = iget(ROOTDEV, ROOTINO);
|
||||||
else
|
else
|
||||||
ip = idup(cp->cwd);
|
ip = idup(cp->cwd);
|
||||||
|
|
||||||
|
|
1
fs.h
1
fs.h
|
@ -5,6 +5,7 @@
|
||||||
// Block 1 is super block.
|
// Block 1 is super block.
|
||||||
// Inodes start at block 2.
|
// Inodes start at block 2.
|
||||||
|
|
||||||
|
#define ROOTINO 1 // root i-number
|
||||||
#define BSIZE 512 // block size
|
#define BSIZE 512 // block size
|
||||||
|
|
||||||
// File system super block
|
// File system super block
|
||||||
|
|
2
mkfs.c
2
mkfs.c
|
@ -92,7 +92,7 @@ main(int argc, char *argv[])
|
||||||
wsect(1, &sb);
|
wsect(1, &sb);
|
||||||
|
|
||||||
rootino = ialloc(T_DIR);
|
rootino = ialloc(T_DIR);
|
||||||
assert(rootino == 1);
|
assert(rootino == ROOTINO);
|
||||||
|
|
||||||
bzero(&de, sizeof(de));
|
bzero(&de, sizeof(de));
|
||||||
de.inum = xshort(rootino);
|
de.inum = xshort(rootino);
|
||||||
|
|
Loading…
Reference in a new issue