aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk_sgi.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-17 00:12:10 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-17 00:12:10 +0000
commit4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93 (patch)
tree5eb094c94adda9f92cbedac6062b0d0040a5142c /util-linux/fdisk_sgi.c
parentaca10f852ae760a3f2e2b9ed08bd13f9d5b85443 (diff)
downloadbusybox-w32-4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93.tar.gz
busybox-w32-4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93.tar.bz2
busybox-w32-4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93.zip
fdisk: do not open device twice. Complain on fdisk -l /dev/bogus.
Made enums UPPERCASE. Removed one global variable. Added some FIXMEs. text data bss dec hex filename 804708 645 7112 812465 c65b1 busybox_old 804685 641 7112 812438 c6596 busybox_unstripped
Diffstat (limited to 'util-linux/fdisk_sgi.c')
-rw-r--r--util-linux/fdisk_sgi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 1fce0c1c7..55e77d58c 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -235,7 +235,7 @@ check_sgi_label(void)
235 if (sgilabel->magic != SGI_LABEL_MAGIC 235 if (sgilabel->magic != SGI_LABEL_MAGIC
236 && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED 236 && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED
237 ) { 237 ) {
238 current_label_type = label_dos; 238 current_label_type = LABEL_DOS;
239 return 0; 239 return 0;
240 } 240 }
241 241
@@ -248,7 +248,7 @@ check_sgi_label(void)
248 printf("Detected sgi disklabel with wrong checksum\n"); 248 printf("Detected sgi disklabel with wrong checksum\n");
249 } 249 }
250 update_units(); 250 update_units();
251 current_label_type = label_sgi; 251 current_label_type = LABEL_SGI;
252 g_partitions = 16; 252 g_partitions = 16;
253 sgi_volumes = 15; 253 sgi_volumes = 15;
254 return 1; 254 return 1;
@@ -439,9 +439,9 @@ sgi_write_table(void)
439 assert(two_s_complement_32bit_sum( 439 assert(two_s_complement_32bit_sum(
440 (unsigned int*)sgilabel, sizeof(*sgilabel)) == 0); 440 (unsigned int*)sgilabel, sizeof(*sgilabel)) == 0);
441 441
442 if (lseek(fd, 0, SEEK_SET) < 0) 442 if (lseek(dev_fd, 0, SEEK_SET) < 0)
443 fdisk_fatal(unable_to_seek); 443 fdisk_fatal(unable_to_seek);
444 if (write(fd, sgilabel, SECTOR_SIZE) != SECTOR_SIZE) 444 if (write(dev_fd, sgilabel, SECTOR_SIZE) != SECTOR_SIZE)
445 fdisk_fatal(unable_to_write); 445 fdisk_fatal(unable_to_write);
446 if (!strncmp((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8)) { 446 if (!strncmp((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8)) {
447 /* 447 /*
@@ -450,9 +450,9 @@ sgi_write_table(void)
450 */ 450 */
451 sgiinfo *info = fill_sgiinfo(); 451 sgiinfo *info = fill_sgiinfo();
452 int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start); 452 int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start);
453 if (lseek(fd, infostartblock*SECTOR_SIZE, SEEK_SET) < 0) 453 if (lseek(dev_fd, infostartblock*SECTOR_SIZE, SEEK_SET) < 0)
454 fdisk_fatal(unable_to_seek); 454 fdisk_fatal(unable_to_seek);
455 if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE) 455 if (write(dev_fd, info, SECTOR_SIZE) != SECTOR_SIZE)
456 fdisk_fatal(unable_to_write); 456 fdisk_fatal(unable_to_write);
457 free(info); 457 free(info);
458 } 458 }
@@ -782,8 +782,8 @@ create_sgilabel(void)
782 printf(msg_building_new_label, "SGI disklabel"); 782 printf(msg_building_new_label, "SGI disklabel");
783 783
784 sgi_other_endian = BB_LITTLE_ENDIAN; 784 sgi_other_endian = BB_LITTLE_ENDIAN;
785 res = ioctl(fd, BLKGETSIZE, &longsectors); 785 res = ioctl(dev_fd, BLKGETSIZE, &longsectors);
786 if (!ioctl(fd, HDIO_GETGEO, &geometry)) { 786 if (!ioctl(dev_fd, HDIO_GETGEO, &geometry)) {
787 g_heads = geometry.heads; 787 g_heads = geometry.heads;
788 g_sectors = geometry.sectors; 788 g_sectors = geometry.sectors;
789 if (res == 0) { 789 if (res == 0) {
@@ -851,7 +851,7 @@ create_sgilabel(void)
851 //sgilabel->devparam.xylogics_writecont = SGI_SSWAP16(0); 851 //sgilabel->devparam.xylogics_writecont = SGI_SSWAP16(0);
852 //memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 ); 852 //memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 );
853 //memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 ); 853 //memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 );
854 current_label_type = label_sgi; 854 current_label_type = LABEL_SGI;
855 g_partitions = 16; 855 g_partitions = 16;
856 sgi_volumes = 15; 856 sgi_volumes = 15;
857 sgi_set_entire(); 857 sgi_set_entire();