summaryrefslogtreecommitdiff
path: root/util-linux/fdisk_sun.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_sun.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_sun.c')
-rw-r--r--util-linux/fdisk_sun.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c
index fcd3818d2..e595444c4 100644
--- a/util-linux/fdisk_sun.c
+++ b/util-linux/fdisk_sun.c
@@ -42,7 +42,7 @@ guess_device_type(void)
42{ 42{
43 struct stat bootstat; 43 struct stat bootstat;
44 44
45 if (fstat(fd, &bootstat) < 0) { 45 if (fstat(dev_fd, &bootstat) < 0) {
46 scsi_disk = 0; 46 scsi_disk = 0;
47 floppy = 0; 47 floppy = 0;
48 } else if (S_ISBLK(bootstat.st_mode) 48 } else if (S_ISBLK(bootstat.st_mode)
@@ -98,7 +98,7 @@ check_sun_label(void)
98 98
99 if (sunlabel->magic != SUN_LABEL_MAGIC 99 if (sunlabel->magic != SUN_LABEL_MAGIC
100 && sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) { 100 && sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) {
101 current_label_type = label_dos; 101 current_label_type = LABEL_DOS;
102 sun_other_endian = 0; 102 sun_other_endian = 0;
103 return 0; 103 return 0;
104 } 104 }
@@ -116,7 +116,7 @@ check_sun_label(void)
116 g_sectors = SUN_SSWAP16(sunlabel->nsect); 116 g_sectors = SUN_SSWAP16(sunlabel->nsect);
117 } 117 }
118 update_units(); 118 update_units();
119 current_label_type = label_sun; 119 current_label_type = LABEL_SUN;
120 g_partitions = 8; 120 g_partitions = 8;
121 return 1; 121 return 1;
122} 122}
@@ -168,7 +168,7 @@ sun_autoconfigure_scsi(void)
168 char *q; 168 char *q;
169 int i; 169 int i;
170 170
171 if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &id)) 171 if (ioctl(dev_fd, SCSI_IOCTL_GET_IDLUN, &id))
172 return NULL; 172 return NULL;
173 173
174 sprintf(buffer, 174 sprintf(buffer,
@@ -272,7 +272,7 @@ create_sunlabel(void)
272 } 272 }
273 } 273 }
274 if (!p || floppy) { 274 if (!p || floppy) {
275 if (!ioctl(fd, HDIO_GETGEO, &geometry)) { 275 if (!ioctl(dev_fd, HDIO_GETGEO, &geometry)) {
276 g_heads = geometry.heads; 276 g_heads = geometry.heads;
277 g_sectors = geometry.sectors; 277 g_sectors = geometry.sectors;
278 g_cylinders = geometry.cylinders; 278 g_cylinders = geometry.cylinders;
@@ -346,7 +346,7 @@ create_sunlabel(void)
346 346
347 set_all_unchanged(); 347 set_all_unchanged();
348 set_changed(0); 348 set_changed(0);
349 get_boot(create_empty_sun); 349 get_boot(CREATE_EMPTY_SUN);
350} 350}
351 351
352static void 352static void
@@ -722,9 +722,9 @@ sun_write_table(void)
722 while (ush < (unsigned short *)(&sunlabel->csum)) 722 while (ush < (unsigned short *)(&sunlabel->csum))
723 csum ^= *ush++; 723 csum ^= *ush++;
724 sunlabel->csum = csum; 724 sunlabel->csum = csum;
725 if (lseek(fd, 0, SEEK_SET) < 0) 725 if (lseek(dev_fd, 0, SEEK_SET) < 0)
726 fdisk_fatal(unable_to_seek); 726 fdisk_fatal(unable_to_seek);
727 if (write(fd, sunlabel, SECTOR_SIZE) != SECTOR_SIZE) 727 if (write(dev_fd, sunlabel, SECTOR_SIZE) != SECTOR_SIZE)
728 fdisk_fatal(unable_to_write); 728 fdisk_fatal(unable_to_write);
729} 729}
730#endif /* SUN_LABEL */ 730#endif /* SUN_LABEL */