aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-29 05:16:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-29 05:16:45 +0000
commit270d5d75f128d3d8e3e515b457b1b1a4f40bb556 (patch)
treebf868dd03783601d633d362a40479fefd4e10ff0
parent6eaf0a98831960e3a4593e6630404634d747ab82 (diff)
downloadbusybox-w32-270d5d75f128d3d8e3e515b457b1b1a4f40bb556.tar.gz
busybox-w32-270d5d75f128d3d8e3e515b457b1b1a4f40bb556.tar.bz2
busybox-w32-270d5d75f128d3d8e3e515b457b1b1a4f40bb556.zip
fdisk: cosmetics, and removal of dead data
-rw-r--r--util-linux/fdisk.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 7f046edfb..a1d31501b 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -86,8 +86,6 @@ struct partition {
86static const char unable_to_open[] ALIGN1 = "cannot open %s"; 86static const char unable_to_open[] ALIGN1 = "cannot open %s";
87static const char unable_to_read[] ALIGN1 = "cannot read from %s"; 87static const char unable_to_read[] ALIGN1 = "cannot read from %s";
88static const char unable_to_seek[] ALIGN1 = "cannot seek on %s"; 88static const char unable_to_seek[] ALIGN1 = "cannot seek on %s";
89static const char unable_to_write[] ALIGN1 = "cannot write to %s";
90static const char ioctl_error[] ALIGN1 = "BLKGETSIZE ioctl failed on %s";
91static void fdisk_fatal(const char *why) ATTRIBUTE_NORETURN; 89static void fdisk_fatal(const char *why) ATTRIBUTE_NORETURN;
92 90
93enum label_type { 91enum label_type {
@@ -320,7 +318,7 @@ struct globals {
320 struct pte ptes[MAXIMUM_PARTS]; 318 struct pte ptes[MAXIMUM_PARTS];
321}; 319};
322#define G (*ptr_to_globals) 320#define G (*ptr_to_globals)
323#define line_ptr (G.line_ptr) 321#define line_ptr (G.line_ptr )
324#define disk_device (G.disk_device ) 322#define disk_device (G.disk_device )
325#define g_partitions (G.g_partitions ) 323#define g_partitions (G.g_partitions )
326#define units_per_sector (G.units_per_sector ) 324#define units_per_sector (G.units_per_sector )
@@ -346,11 +344,11 @@ struct globals {
346#define kern_sectors (G.kern_sectors ) 344#define kern_sectors (G.kern_sectors )
347#define extended_offset (G.extended_offset ) 345#define extended_offset (G.extended_offset )
348#define total_number_of_sectors (G.total_number_of_sectors) 346#define total_number_of_sectors (G.total_number_of_sectors)
349#define listingbuf (G.listingbuf) 347#define listingbuf (G.listingbuf )
350#define line_buffer (G.line_buffer) 348#define line_buffer (G.line_buffer )
351#define partname_buffer (G.partname_buffer) 349#define partname_buffer (G.partname_buffer)
352#define MBRbuffer (G.MBRbuffer) 350#define MBRbuffer (G.MBRbuffer )
353#define ptes (G.ptes) 351#define ptes (G.ptes )
354#define INIT_G() do { \ 352#define INIT_G() do { \
355 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ 353 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
356 sector_size = DEFAULT_SECTOR_SIZE; \ 354 sector_size = DEFAULT_SECTOR_SIZE; \
@@ -369,7 +367,7 @@ static ullong bb_BLKGETSIZE_sectors(int fd)
369 unsigned long longsectors; 367 unsigned long longsectors;
370 368
371 if (ioctl(fd, BLKGETSIZE64, &v64) == 0) { 369 if (ioctl(fd, BLKGETSIZE64, &v64) == 0) {
372 /* got bytes, convert to 512 byte sectors */ 370 /* Got bytes, convert to 512 byte sectors */
373 return (v64 >> 9); 371 return (v64 >> 9);
374 } 372 }
375 /* Needs temp of type long */ 373 /* Needs temp of type long */
@@ -414,7 +412,7 @@ close_dev_fd(void)
414} 412}
415 413
416#if ENABLE_FEATURE_FDISK_WRITABLE 414#if ENABLE_FEATURE_FDISK_WRITABLE
417/* read line; return 0 or first printable char */ 415/* Read line; return 0 or first printable char */
418static int 416static int
419read_line(const char *prompt) 417read_line(const char *prompt)
420{ 418{
@@ -435,7 +433,7 @@ read_line(const char *prompt)
435#endif 433#endif
436 434
437/* 435/*
438 * return partition name - uses static storage 436 * Return partition name - uses static storage
439 */ 437 */
440static const char * 438static const char *
441partname(const char *dev, int pno, int lth) 439partname(const char *dev, int pno, int lth)