From 63883af765609743b7031faa4f33d6e2a0b2b156 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 20 Jul 2011 20:13:08 +0200 Subject: libblkid: use MINIX_BLOCK_SIZE from minix.h In the minix.h two definitions where renamed, so that the single definition is reusable in fsck.minix, mkfs.minix and libblkid. BLOCK_SIZE_BITS -> MINIX_BLOCK_SIZE_BITS BLOCK_SIZE -> MINIX_BLOCK_SIZE Signed-off-by: Sami Kerola --- disk-utils/mkfs.minix.c | 76 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'disk-utils/mkfs.minix.c') diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index 06d087e26..489f032ac 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -111,7 +111,7 @@ static int dirsize = 32; static int magic = MINIX_SUPER_MAGIC2; static int version2 = 0; -static char root_block[BLOCK_SIZE] = "\0"; +static char root_block[MINIX_BLOCK_SIZE] = "\0"; static char boot_block_buffer[512]; #define Super (*(struct minix_super_block *)super_block_buffer) @@ -181,22 +181,22 @@ static void write_tables(void) { " in write_tables"), device_name); if (512 != write(DEV, boot_block_buffer, 512)) err(MKFS_ERROR, _("%s: unable to clear boot sector"), device_name); - if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET)) + if (MINIX_BLOCK_SIZE != lseek(DEV, MINIX_BLOCK_SIZE, SEEK_SET)) err(MKFS_ERROR, _("%s: seek failed in write_tables"), device_name); - if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE)) + if (MINIX_BLOCK_SIZE != write(DEV, super_block_buffer, MINIX_BLOCK_SIZE)) err(MKFS_ERROR, _("%s: unable to write super-block"), device_name); - if (imaps*BLOCK_SIZE != write(DEV,inode_map, imaps*BLOCK_SIZE)) + if (imaps*MINIX_BLOCK_SIZE != write(DEV,inode_map, imaps*MINIX_BLOCK_SIZE)) err(MKFS_ERROR, _("%s: unable to write inode map"), device_name); - if (zmaps*BLOCK_SIZE != write(DEV,zone_map, zmaps*BLOCK_SIZE)) + if (zmaps*MINIX_BLOCK_SIZE != write(DEV,zone_map, zmaps*MINIX_BLOCK_SIZE)) err(MKFS_ERROR, _("%s: unable to write zone map"), device_name); if (buffsz != write(DEV,inode_buffer, buffsz)) err(MKFS_ERROR, _("%s: unable to write inodes"), device_name); } static void write_block(int blk, char * buffer) { - if (blk*BLOCK_SIZE != lseek(DEV, blk*BLOCK_SIZE, SEEK_SET)) + if (blk*MINIX_BLOCK_SIZE != lseek(DEV, blk*MINIX_BLOCK_SIZE, SEEK_SET)) errx(MKFS_ERROR, _("%s: seek failed in write_block"), device_name); - if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE)) + if (MINIX_BLOCK_SIZE != write(DEV, buffer, MINIX_BLOCK_SIZE)) errx(MKFS_ERROR, _("%s: write failed in write_block"), device_name); } @@ -244,8 +244,8 @@ static void make_bad_inode_v1(void) struct minix_inode * inode = &Inode[MINIX_BAD_INO]; int i,j,zone; int ind=0,dind=0; - unsigned short ind_block[BLOCK_SIZE>>1]; - unsigned short dind_block[BLOCK_SIZE>>1]; + unsigned short ind_block[MINIX_BLOCK_SIZE>>1]; + unsigned short dind_block[MINIX_BLOCK_SIZE>>1]; #define NEXT_BAD (zone = next(zone)) @@ -255,7 +255,7 @@ static void make_bad_inode_v1(void) inode->i_nlinks = 1; inode->i_time = time(NULL); inode->i_mode = S_IFREG + 0000; - inode->i_size = badblocks*BLOCK_SIZE; + inode->i_size = badblocks*MINIX_BLOCK_SIZE; zone = next(0); for (i=0 ; i<7 ; i++) { inode->i_zone[i] = zone; @@ -263,18 +263,18 @@ static void make_bad_inode_v1(void) goto end_bad; } inode->i_zone[7] = ind = get_free_block(); - memset(ind_block,0,BLOCK_SIZE); + memset(ind_block,0,MINIX_BLOCK_SIZE); for (i=0 ; i<512 ; i++) { ind_block[i] = zone; if (!NEXT_BAD) goto end_bad; } inode->i_zone[8] = dind = get_free_block(); - memset(dind_block,0,BLOCK_SIZE); + memset(dind_block,0,MINIX_BLOCK_SIZE); for (i=0 ; i<512 ; i++) { write_block(ind,(char *) ind_block); dind_block[i] = ind = get_free_block(); - memset(ind_block,0,BLOCK_SIZE); + memset(ind_block,0,MINIX_BLOCK_SIZE); for (j=0 ; j<512 ; j++) { ind_block[j] = zone; if (!NEXT_BAD) @@ -294,8 +294,8 @@ static void make_bad_inode_v2_v3 (void) struct minix2_inode *inode = &Inode2[MINIX_BAD_INO]; int i, j, zone; int ind = 0, dind = 0; - unsigned long ind_block[BLOCK_SIZE >> 2]; - unsigned long dind_block[BLOCK_SIZE >> 2]; + unsigned long ind_block[MINIX_BLOCK_SIZE >> 2]; + unsigned long dind_block[MINIX_BLOCK_SIZE >> 2]; if (!badblocks) return; @@ -303,7 +303,7 @@ static void make_bad_inode_v2_v3 (void) inode->i_nlinks = 1; inode->i_atime = inode->i_mtime = inode->i_ctime = time (NULL); inode->i_mode = S_IFREG + 0000; - inode->i_size = badblocks * BLOCK_SIZE; + inode->i_size = badblocks * MINIX_BLOCK_SIZE; zone = next (0); for (i = 0; i < 7; i++) { inode->i_zone[i] = zone; @@ -311,18 +311,18 @@ static void make_bad_inode_v2_v3 (void) goto end_bad; } inode->i_zone[7] = ind = get_free_block (); - memset (ind_block, 0, BLOCK_SIZE); + memset (ind_block, 0, MINIX_BLOCK_SIZE); for (i = 0; i < 256; i++) { ind_block[i] = zone; if (!NEXT_BAD) goto end_bad; } inode->i_zone[8] = dind = get_free_block (); - memset (dind_block, 0, BLOCK_SIZE); + memset (dind_block, 0, MINIX_BLOCK_SIZE); for (i = 0; i < 256; i++) { write_block (ind, (char *) ind_block); dind_block[i] = ind = get_free_block (); - memset (ind_block, 0, BLOCK_SIZE); + memset (ind_block, 0, MINIX_BLOCK_SIZE); for (j = 0; j < 256; j++) { ind_block[j] = zone; if (!NEXT_BAD) @@ -458,7 +458,7 @@ static void setup_tables(void) { int i; unsigned long inodes, zmaps, imaps, zones; - super_block_buffer = calloc(1, BLOCK_SIZE); + super_block_buffer = calloc(1, MINIX_BLOCK_SIZE); if (!super_block_buffer) err(MKFS_ERROR, _("%s: unable to alloc buffer for superblock"), device_name); @@ -501,13 +501,13 @@ static void setup_tables(void) { imaps = get_nimaps(); zmaps = get_nzmaps(); - inode_map = malloc(imaps * BLOCK_SIZE); - zone_map = malloc(zmaps * BLOCK_SIZE); + inode_map = malloc(imaps * MINIX_BLOCK_SIZE); + zone_map = malloc(zmaps * MINIX_BLOCK_SIZE); if (!inode_map || !zone_map) err(MKFS_ERROR, _("%s: unable to allocate buffers for maps"), device_name); - memset(inode_map,0xff,imaps * BLOCK_SIZE); - memset(zone_map,0xff,zmaps * BLOCK_SIZE); + memset(inode_map,0xff,imaps * MINIX_BLOCK_SIZE); + memset(zone_map,0xff,zmaps * MINIX_BLOCK_SIZE); for (i = get_first_zone() ; i