diff --git a/commands/simple/df.c b/commands/simple/df.c index da83d0553..ef290c2cc 100755 --- a/commands/simple/df.c +++ b/commands/simple/df.c @@ -302,10 +302,10 @@ int df(const struct mtab *mt) return(1); } - if(sp->s_magic != SUPER_V3) block_size = STATIC_BLOCK_SIZE; + if(sp->s_magic != SUPER_V3) block_size = _STATIC_BLOCK_SIZE; else block_size = super.s_block_size; - if(block_size < MIN_BLOCK_SIZE || block_size > MAX_BLOCK_SIZE) { + if(block_size < _MIN_BLOCK_SIZE || block_size > _MAX_BLOCK_SIZE) { fprintf(stderr, "df: %s: funny block size (%d)\n", mt->devname, block_size); close(fd); @@ -405,7 +405,7 @@ bit_t bit_count(unsigned blocks, bit_t bits, int fd, int block_size) int i, b; bit_t busy; char *wlim; - static char buf[MAX_BLOCK_SIZE]; + static char buf[_MAX_BLOCK_SIZE]; static char bits_in_char[1 << CHAR_BIT]; /* Precalculate bitcount for each char. */ diff --git a/commands/simple/fsck.c b/commands/simple/fsck.c index a1ef8edd7..413611a6a 100755 --- a/commands/simple/fsck.c +++ b/commands/simple/fsck.c @@ -1476,7 +1476,7 @@ char *f, **clist, **ilist, **zlist; getsuper(); - if(block_size < MIN_BLOCK_SIZE || block_size > MAX_BLOCK_SIZE) + if(block_size < _MIN_BLOCK_SIZE || block_size > _MAX_BLOCK_SIZE) fatal("funny block size"); if(!(rwbuf = malloc(block_size))) fatal("couldn't allocate fs buf (1)"); diff --git a/commands/simple/fsck1.c b/commands/simple/fsck1.c index b4ed89744..92dd6a13e 100755 --- a/commands/simple/fsck1.c +++ b/commands/simple/fsck1.c @@ -56,7 +56,7 @@ #include #include -#define BLOCK_SIZE STATIC_BLOCK_SIZE +#define BLOCK_SIZE _STATIC_BLOCK_SIZE #define BITSHIFT 4 /* = log2(#bits(int)) */ diff --git a/commands/simple/mkfs.c b/commands/simple/mkfs.c index b6ad41977..9613e87d1 100755 --- a/commands/simple/mkfs.c +++ b/commands/simple/mkfs.c @@ -196,11 +196,11 @@ char *argv[]; } if(fs_version == 3) { - if(!block_size) block_size = MAX_BLOCK_SIZE; /* V3 default block size */ - if(block_size%SECTOR_SIZE || block_size < MIN_BLOCK_SIZE) { + if(!block_size) block_size = _MAX_BLOCK_SIZE; /* V3 default block size */ + if(block_size%SECTOR_SIZE || block_size < _MIN_BLOCK_SIZE) { fprintf(stderr, "block size must be multiple of sector (%d) " "and at least %d bytes\n", - SECTOR_SIZE, MIN_BLOCK_SIZE); + SECTOR_SIZE, _MIN_BLOCK_SIZE); pexit("specified block size illegal"); } if(block_size%V2_INODE_SIZE) { @@ -212,7 +212,7 @@ char *argv[]; if(block_size) { pexit("Can't specify a block size if FS version is <3"); } - block_size = STATIC_BLOCK_SIZE; /* V1/V2 block size */ + block_size = _STATIC_BLOCK_SIZE; /* V1/V2 block size */ } if(!inodes_per_block) @@ -508,10 +508,10 @@ ino_t inodes; zone_size = 1 << zone_shift; /* nr of blocks per zone */ - if (lseek(fd, (off_t) STATIC_BLOCK_SIZE, SEEK_SET) == (off_t) -1) { + if (lseek(fd, (off_t) _STATIC_BLOCK_SIZE, SEEK_SET) == (off_t) -1) { pexit("super() couldn't seek"); } - if (write(fd, buf, STATIC_BLOCK_SIZE) != STATIC_BLOCK_SIZE) { + if (write(fd, buf, _STATIC_BLOCK_SIZE) != _STATIC_BLOCK_SIZE) { pexit("super() couldn't write"); } @@ -1537,8 +1537,8 @@ char *buf; perror("lseek"); pexit("seek failed"); } - k = read(fd, buf, STATIC_BLOCK_SIZE); - if (k != STATIC_BLOCK_SIZE) { + k = read(fd, buf, _STATIC_BLOCK_SIZE); + if (k != _STATIC_BLOCK_SIZE) { pexit("get_super_block couldn't read"); } } diff --git a/commands/simple/mkswap.c b/commands/simple/mkswap.c index 19a46e473..5211661f3 100755 --- a/commands/simple/mkswap.c +++ b/commands/simple/mkswap.c @@ -40,7 +40,7 @@ int main(int argc, char **argv) ssize_t r; struct super_block super; swap_hdr_t swap_hdr; - static u8_t block[MAX_BLOCK_SIZE]; + static u8_t block[_MAX_BLOCK_SIZE]; first= 0; i= 1; @@ -105,7 +105,7 @@ int main(int argc, char **argv) /* Is there a file system? */ r= -1; if (lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1 - || (r= read(fd, block, STATIC_BLOCK_SIZE)) < STATIC_BLOCK_SIZE + || (r= read(fd, block, _STATIC_BLOCK_SIZE)) < _STATIC_BLOCK_SIZE ) { fprintf(stderr, "mkswap: %s: %s\n", file, r >= 0 ? "End of file" : strerror(errno)); @@ -113,10 +113,10 @@ int main(int argc, char **argv) } memcpy(&super, block, sizeof(super)); if (super.s_magic == SUPER_MAGIC) { - offset= (unsigned long) super.s_nzones * STATIC_BLOCK_SIZE; + offset= (unsigned long) super.s_nzones * _STATIC_BLOCK_SIZE; } else if (super.s_magic == SUPER_V2) { - offset= (unsigned long) super.s_zones * STATIC_BLOCK_SIZE; + offset= (unsigned long) super.s_zones * _STATIC_BLOCK_SIZE; } else if (super.s_magic == SUPER_V3) { offset= (unsigned long) super.s_zones * super.s_block_size; } else { diff --git a/commands/simple/mount.c b/commands/simple/mount.c index 8fe83842a..cc7119854 100755 --- a/commands/simple/mount.c +++ b/commands/simple/mount.c @@ -161,7 +161,7 @@ char *this; void swapon(file) char *file; { - u32_t super[2][MAX_BLOCK_SIZE / 2 / sizeof(u32_t)]; + u32_t super[2][_MAX_BLOCK_SIZE / 2 / sizeof(u32_t)]; swap_hdr_t *sp; struct mmswapon mmswapon; int fd, r; @@ -169,7 +169,7 @@ char *file; if ((fd = open(file, O_RDWR)) < 0 || lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1 - || (r = read(fd, super, STATIC_BLOCK_SIZE)) < 0 + || (r = read(fd, super, _STATIC_BLOCK_SIZE)) < 0 ) { err = strerror(errno); std_err("mount: "); @@ -182,7 +182,7 @@ char *file; sp = (swap_hdr_t *) &super[0]; if (memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0) sp = (swap_hdr_t *) &super[1]; - if (r == STATIC_BLOCK_SIZE && memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0 + if (r == _STATIC_BLOCK_SIZE && memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0 || sp->sh_version > SH_VERSION) { std_err("mount: "); std_err(file); diff --git a/commands/simple/readfs.c b/commands/simple/readfs.c index 2389d1d9d..0d2667a46 100755 --- a/commands/simple/readfs.c +++ b/commands/simple/readfs.c @@ -36,7 +36,7 @@ #include #include -#define BLOCK_SIZE STATIC_BLOCK_SIZE +#define BLOCK_SIZE _STATIC_BLOCK_SIZE #include #include diff --git a/include/dirent.h b/include/dirent.h index cc0576578..1922f0a20 100755 --- a/include/dirent.h +++ b/include/dirent.h @@ -40,21 +40,21 @@ struct _v7_direct { /* The block size must be at least 1024 bytes, because otherwise * the superblock (at 1024 bytes) overlaps with other filesystem data. */ -#define MIN_BLOCK_SIZE 1024 +#define _MIN_BLOCK_SIZE 1024 /* The below is allocated in some parts of the system as the largest * a filesystem block can be. For instance, the boot monitor allocates * 3 of these blocks and has to fit within 64kB, so this can't be * increased without taking that into account. */ -#define MAX_BLOCK_SIZE 4096 +#define _MAX_BLOCK_SIZE 4096 /* This is the block size for the fixed versions of the filesystem (V1/V2) */ -#define STATIC_BLOCK_SIZE 1024 +#define _STATIC_BLOCK_SIZE 1024 -#define STATIC_FLEX_PER_BLOCK (STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) -#define FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1) -#define FLEX_PER_BLOCK (STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) +#define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) +#define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1) +#define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct)) /* Definitions for the directory(3) routines: */ typedef struct { @@ -63,8 +63,8 @@ typedef struct { short _count; /* This many objects in buf */ off_t _pos; /* Position in directory file */ struct _fl_direct *_ptr; /* Next slot in buf */ - struct _fl_direct _buf[FLEX_PER_BLOCK]; /* One block of a directory file */ - struct _fl_direct _v7f[FLEX_PER_V7]; /* V7 entry transformed to flex */ + struct _fl_direct _buf[_FLEX_PER_BLOCK]; /* One block of a directory file */ + struct _fl_direct _v7f[_FLEX_PER_V7]; /* V7 entry transformed to flex */ } DIR; #define _DIRENT_NAME_LEN 61 diff --git a/servers/fs/buf.h b/servers/fs/buf.h index cea6a5b96..a17513683 100644 --- a/servers/fs/buf.h +++ b/servers/fs/buf.h @@ -17,19 +17,19 @@ EXTERN struct buf { /* Data portion of the buffer. */ union { - char b__data[MAX_BLOCK_SIZE]; /* ordinary user data */ + char b__data[_MAX_BLOCK_SIZE]; /* ordinary user data */ /* directory block */ - struct direct b__dir[NR_DIR_ENTRIES(MAX_BLOCK_SIZE)]; + struct direct b__dir[NR_DIR_ENTRIES(_MAX_BLOCK_SIZE)]; /* V1 indirect block */ zone1_t b__v1_ind[V1_INDIRECTS]; /* V2 indirect block */ - zone_t b__v2_ind[V2_INDIRECTS(MAX_BLOCK_SIZE)]; + zone_t b__v2_ind[V2_INDIRECTS(_MAX_BLOCK_SIZE)]; /* V1 inode block */ d1_inode b__v1_ino[V1_INODES_PER_BLOCK]; /* V2 inode block */ - d2_inode b__v2_ino[V2_INODES_PER_BLOCK(MAX_BLOCK_SIZE)]; + d2_inode b__v2_ino[V2_INODES_PER_BLOCK(_MAX_BLOCK_SIZE)]; /* bit map block */ - bitchunk_t b__bitmap[FS_BITMAP_CHUNKS(MAX_BLOCK_SIZE)]; + bitchunk_t b__bitmap[FS_BITMAP_CHUNKS(_MAX_BLOCK_SIZE)]; } b; /* Header portion of the buffer. */ diff --git a/servers/fs/const.h b/servers/fs/const.h index 7d696b5f6..245360591 100644 --- a/servers/fs/const.h +++ b/servers/fs/const.h @@ -77,10 +77,10 @@ #define V1_INODE_SIZE usizeof (d1_inode) /* bytes in V1 dsk ino */ /* # zones/indir block */ -#define V1_INDIRECTS (STATIC_BLOCK_SIZE/V1_ZONE_NUM_SIZE) +#define V1_INDIRECTS (_STATIC_BLOCK_SIZE/V1_ZONE_NUM_SIZE) /* # V1 dsk inodes/blk */ -#define V1_INODES_PER_BLOCK (STATIC_BLOCK_SIZE/V1_INODE_SIZE) +#define V1_INODES_PER_BLOCK (_STATIC_BLOCK_SIZE/V1_INODE_SIZE) /* Derived sizes pertaining to the V2 file system. */ #define V2_ZONE_NUM_SIZE usizeof (zone_t) /* # bytes in V2 zone */ diff --git a/servers/fs/main.c b/servers/fs/main.c index 3bdd7ebfe..f458252b6 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -271,7 +271,7 @@ PRIVATE void load_ram(void) struct super_block *sp, *dsp; block_t b; Dev_t image_dev; - static char sbbuf[MIN_BLOCK_SIZE]; + static char sbbuf[_MIN_BLOCK_SIZE]; int block_size_image, block_size_ram, ramfs_block_size; int s; @@ -408,20 +408,20 @@ PRIVATE void load_ram(void) /* Resize the RAM disk root file system. */ if (dev_io(DEV_READ, root_dev, FS_PROC_NR, - sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) { + sbbuf, SUPER_BLOCK_BYTES, _MIN_BLOCK_SIZE, 0) != _MIN_BLOCK_SIZE) { printf("WARNING: ramdisk read for resizing failed\n"); } dsp = (struct super_block *) sbbuf; if (dsp->s_magic == SUPER_V3) ramfs_block_size = dsp->s_block_size; else - ramfs_block_size = STATIC_BLOCK_SIZE; + ramfs_block_size = _STATIC_BLOCK_SIZE; zones = (ram_size_kb * 1024 / ramfs_block_size) >> sp->s_log_zone_size; dsp->s_nzones = conv2(sp->s_native, (u16_t) zones); dsp->s_zones = conv4(sp->s_native, zones); if (dev_io(DEV_WRITE, root_dev, FS_PROC_NR, - sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) { + sbbuf, SUPER_BLOCK_BYTES, _MIN_BLOCK_SIZE, 0) != _MIN_BLOCK_SIZE) { printf("WARNING: ramdisk write for resizing failed\n"); } } diff --git a/servers/fs/super.c b/servers/fs/super.c index 8849adbae..0d2955802 100644 --- a/servers/fs/super.c +++ b/servers/fs/super.c @@ -181,7 +181,7 @@ PUBLIC int get_block_size(dev_t dev) } /* no mounted filesystem? use this block size then. */ - return MIN_BLOCK_SIZE; + return _MIN_BLOCK_SIZE; } /*===========================================================================* @@ -214,14 +214,14 @@ register struct super_block *sp; /* pointer to a superblock */ dev_t dev; int magic; int version, native, r; - static char sbbuf[MIN_BLOCK_SIZE]; + static char sbbuf[_MIN_BLOCK_SIZE]; dev = sp->s_dev; /* save device (will be overwritten by copy) */ if (dev == NO_DEV) panic(__FILE__,"request for super_block of NO_DEV", NO_NUM); r = dev_io(DEV_READ, dev, FS_PROC_NR, - sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0); - if (r != MIN_BLOCK_SIZE) { + sbbuf, SUPER_BLOCK_BYTES, _MIN_BLOCK_SIZE, 0); + if (r != _MIN_BLOCK_SIZE) { return EINVAL; } memcpy(sp, sbbuf, sizeof(*sp)); @@ -265,28 +265,28 @@ register struct super_block *sp; /* pointer to a superblock */ * hide some of the differences. */ if (version == V1) { - sp->s_block_size = STATIC_BLOCK_SIZE; + sp->s_block_size = _STATIC_BLOCK_SIZE; sp->s_zones = sp->s_nzones; /* only V1 needs this copy */ sp->s_inodes_per_block = V1_INODES_PER_BLOCK; sp->s_ndzones = V1_NR_DZONES; sp->s_nindirs = V1_INDIRECTS; } else { if (version == V2) - sp->s_block_size = STATIC_BLOCK_SIZE; - if (sp->s_block_size < MIN_BLOCK_SIZE) + sp->s_block_size = _STATIC_BLOCK_SIZE; + if (sp->s_block_size < _MIN_BLOCK_SIZE) return EINVAL; sp->s_inodes_per_block = V2_INODES_PER_BLOCK(sp->s_block_size); sp->s_ndzones = V2_NR_DZONES; sp->s_nindirs = V2_INDIRECTS(sp->s_block_size); } - if (sp->s_block_size < MIN_BLOCK_SIZE) { + if (sp->s_block_size < _MIN_BLOCK_SIZE) { return EINVAL; } - if (sp->s_block_size > MAX_BLOCK_SIZE) { + if (sp->s_block_size > _MAX_BLOCK_SIZE) { printf("Filesystem block size is %d kB; maximum filesystem\n" "block size is %d kB. This limit can be increased by recompiling.\n", - sp->s_block_size/1024, MAX_BLOCK_SIZE/1024); + sp->s_block_size/1024, _MAX_BLOCK_SIZE/1024); return EINVAL; } if ((sp->s_block_size % 512) != 0) { diff --git a/servers/fs/write.c b/servers/fs/write.c index f580cff87..23bd3ad6f 100644 --- a/servers/fs/write.c +++ b/servers/fs/write.c @@ -241,6 +241,6 @@ PUBLIC void zero_block(bp) register struct buf *bp; /* pointer to buffer to zero */ { /* Zero a block. */ - memset(bp->b_data, 0, MAX_BLOCK_SIZE); + memset(bp->b_data, 0, _MAX_BLOCK_SIZE); bp->b_dirt = DIRTY; }