Rename some #defines such as MAX_BLOCK_SIZE to _MAX_BLOCK_SIZE and such
so as to not pollute application namespace.
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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)");
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define BLOCK_SIZE STATIC_BLOCK_SIZE
|
||||
#define BLOCK_SIZE _STATIC_BLOCK_SIZE
|
||||
|
||||
#define BITSHIFT 4 /* = log2(#bits(int)) */
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <utime.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define BLOCK_SIZE STATIC_BLOCK_SIZE
|
||||
#define BLOCK_SIZE _STATIC_BLOCK_SIZE
|
||||
|
||||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
|
||||
Reference in New Issue
Block a user