diff options
author | rsc <rsc> | 2006-09-06 17:27:19 +0000 |
---|---|---|
committer | rsc <rsc> | 2006-09-06 17:27:19 +0000 |
commit | 9e9bcaf143bf8507e947f9934371744c3d50a8ea (patch) | |
tree | b63a03929569f34ade9a940ef1416586346b8d30 /mkfs.c | |
parent | 03b6376f56074cd1dcbb1b35639e303c3a8a0181 (diff) | |
download | xv6-labs-9e9bcaf143bf8507e947f9934371744c3d50a8ea.tar.gz xv6-labs-9e9bcaf143bf8507e947f9934371744c3d50a8ea.tar.bz2 xv6-labs-9e9bcaf143bf8507e947f9934371744c3d50a8ea.zip |
standardize various * conventions
Diffstat (limited to 'mkfs.c')
-rw-r--r-- | mkfs.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -21,8 +21,8 @@ uint bitblocks; uint freeinode = 1; void balloc(int); -void wsect(uint, void *); -void winode(uint, struct dinode *); +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); @@ -33,7 +33,7 @@ ushort xshort(ushort x) { ushort y; - uchar *a = (uchar *) &y; + uchar *a = (uchar*) &y; a[0] = x; a[1] = x >> 8; return y; @@ -43,7 +43,7 @@ uint xint(uint x) { uint y; - uchar *a = (uchar *) &y; + uchar *a = (uchar*) &y; a[0] = x; a[1] = x >> 8; a[2] = x >> 16; @@ -77,14 +77,14 @@ main(int argc, char *argv[]) sb.nblocks = xint(nblocks); // so whole disk is size sectors sb.ninodes = xint(ninodes); - bitblocks = size/(512*8) + 1; + bitblocks = size/(512*8) + 1; usedblocks = ninodes / IPB + 3 + bitblocks; freeblock = usedblocks; - printf("used %d (bit %d ninode %d) free %d total %d\n", usedblocks, + printf("used %d (bit %d ninode %d) free %d total %d\n", usedblocks, bitblocks, ninodes/IPB + 1, freeblock, nblocks+usedblocks); - assert (nblocks + usedblocks == size); + assert(nblocks + usedblocks == size); for(i = 0; i < nblocks + usedblocks; i++) wsect(i, zeroes); @@ -118,7 +118,7 @@ main(int argc, char *argv[]) de.inum = xshort(inum); strncpy(de.name, argv[i], DIRSIZ); iappend(rootino, &de, sizeof(de)); - + while((cc = read(fd, buf, sizeof(buf))) > 0) iappend(inum, buf, cc); @@ -127,7 +127,7 @@ main(int argc, char *argv[]) // fix size of root inode dir rinode(rootino, &din); - off = xint(din.size); + off = xint(din.size); off = ((off/BSIZE) + 1) * BSIZE; din.size = xint(off); winode(rootino, &din); @@ -165,7 +165,7 @@ winode(uint inum, struct dinode *ip) bn = i2b(inum); rsect(bn, buf); - dip = ((struct dinode *) buf) + (inum % IPB); + dip = ((struct dinode*) buf) + (inum % IPB); *dip = *ip; wsect(bn, buf); } @@ -179,7 +179,7 @@ rinode(uint inum, struct dinode *ip) bn = i2b(inum); rsect(bn, buf); - dip = ((struct dinode *) buf) + (inum % IPB); + dip = ((struct dinode*) buf) + (inum % IPB); *ip = *dip; } @@ -217,9 +217,9 @@ balloc(int used) int i; printf("balloc: first %d blocks have been allocated\n", used); - assert (used < 512); + assert(used < 512); bzero(buf, 512); - for (i = 0; i < used; i++) { + for(i = 0; i < used; i++) { buf[i/8] = buf[i/8] | (0x1 << (i%8)); } printf("balloc: write bitmap block at sector %d\n", ninodes/IPB + 3); @@ -231,7 +231,7 @@ balloc(int used) void iappend(uint inum, void *xp, int n) { - char *p = (char *) xp; + char *p = (char*) xp; uint fbn, off, n1; struct dinode din; char buf[512]; @@ -244,7 +244,7 @@ iappend(uint inum, void *xp, int n) while(n > 0){ fbn = off / 512; assert(fbn < MAXFILE); - if (fbn < NDIRECT) { + if(fbn < NDIRECT) { if(xint(din.addrs[fbn]) == 0) { din.addrs[fbn] = xint(freeblock++); usedblocks++; @@ -257,11 +257,11 @@ iappend(uint inum, void *xp, int n) usedblocks++; } printf("read indirect block\n"); - rsect(xint(din.addrs[INDIRECT]), (char *) indirect); - if (indirect[fbn - NDIRECT] == 0) { + rsect(xint(din.addrs[INDIRECT]), (char*) indirect); + if(indirect[fbn - NDIRECT] == 0) { indirect[fbn - NDIRECT] = xint(freeblock++); usedblocks++; - wsect(xint(din.addrs[INDIRECT]), (char *) indirect); + wsect(xint(din.addrs[INDIRECT]), (char*) indirect); } x = xint(indirect[fbn-NDIRECT]); } |