summaryrefslogtreecommitdiff
path: root/util-linux/fdisk_sgi.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-04-17 00:12:10 +0000
committerDenis Vlasenko2008-04-17 00:12:10 +0000
commit4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93 (patch)
tree5eb094c94adda9f92cbedac6062b0d0040a5142c /util-linux/fdisk_sgi.c
parentaca10f852ae760a3f2e2b9ed08bd13f9d5b85443 (diff)
downloadbusybox-4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93.zip
busybox-4437d19fb4d7bd7cd9d8acd5e67d85c8751a6e93.tar.gz
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 1fce0c1..55e77d5 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -235,7 +235,7 @@ check_sgi_label(void)
if (sgilabel->magic != SGI_LABEL_MAGIC
&& sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED
) {
- current_label_type = label_dos;
+ current_label_type = LABEL_DOS;
return 0;
}
@@ -248,7 +248,7 @@ check_sgi_label(void)
printf("Detected sgi disklabel with wrong checksum\n");
}
update_units();
- current_label_type = label_sgi;
+ current_label_type = LABEL_SGI;
g_partitions = 16;
sgi_volumes = 15;
return 1;
@@ -439,9 +439,9 @@ sgi_write_table(void)
assert(two_s_complement_32bit_sum(
(unsigned int*)sgilabel, sizeof(*sgilabel)) == 0);
- if (lseek(fd, 0, SEEK_SET) < 0)
+ if (lseek(dev_fd, 0, SEEK_SET) < 0)
fdisk_fatal(unable_to_seek);
- if (write(fd, sgilabel, SECTOR_SIZE) != SECTOR_SIZE)
+ if (write(dev_fd, sgilabel, SECTOR_SIZE) != SECTOR_SIZE)
fdisk_fatal(unable_to_write);
if (!strncmp((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8)) {
/*
@@ -450,9 +450,9 @@ sgi_write_table(void)
*/
sgiinfo *info = fill_sgiinfo();
int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start);
- if (lseek(fd, infostartblock*SECTOR_SIZE, SEEK_SET) < 0)
+ if (lseek(dev_fd, infostartblock*SECTOR_SIZE, SEEK_SET) < 0)
fdisk_fatal(unable_to_seek);
- if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
+ if (write(dev_fd, info, SECTOR_SIZE) != SECTOR_SIZE)
fdisk_fatal(unable_to_write);
free(info);
}
@@ -782,8 +782,8 @@ create_sgilabel(void)
printf(msg_building_new_label, "SGI disklabel");
sgi_other_endian = BB_LITTLE_ENDIAN;
- res = ioctl(fd, BLKGETSIZE, &longsectors);
- if (!ioctl(fd, HDIO_GETGEO, &geometry)) {
+ res = ioctl(dev_fd, BLKGETSIZE, &longsectors);
+ if (!ioctl(dev_fd, HDIO_GETGEO, &geometry)) {
g_heads = geometry.heads;
g_sectors = geometry.sectors;
if (res == 0) {
@@ -851,7 +851,7 @@ create_sgilabel(void)
//sgilabel->devparam.xylogics_writecont = SGI_SSWAP16(0);
//memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 );
//memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 );
- current_label_type = label_sgi;
+ current_label_type = LABEL_SGI;
g_partitions = 16;
sgi_volumes = 15;
sgi_set_entire();