label_dos, label_sun, label_sgi, label_aix, label_osf
};
#define LABEL_IS_DOS (label_dos == current_label_type)
+
#ifdef CONFIG_FEATURE_SUN_LABEL
#define LABEL_IS_SUN (label_sun == current_label_type)
+#define STATIC_SUN static
#else
#define LABEL_IS_SUN 0
+#define STATIC_SUN extern
#endif
+
#ifdef CONFIG_FEATURE_SGI_LABEL
#define LABEL_IS_SGI (label_sgi == current_label_type)
+#define STATIC_SGI static
#else
#define LABEL_IS_SGI 0
+#define STATIC_SGI extern
#endif
+
#ifdef CONFIG_FEATURE_AIX_LABEL
#define LABEL_IS_AIX (label_aix == current_label_type)
+#define STATIC_AIX static
#else
#define LABEL_IS_AIX 0
+#define STATIC_AIX extern
#endif
+
#ifdef CONFIG_FEATURE_OSF_LABEL
#define LABEL_IS_OSF (label_osf == current_label_type)
+#define STATIC_OSF static
#else
#define LABEL_IS_OSF 0
+#define STATIC_OSF extern
#endif
enum action { fdisk, require, try_only, create_empty_dos, create_empty_sun };
line_ptr = line_buffer;
if (!fgets(line_buffer, LINE_LENGTH, stdin)) {
/* error or eof */
- bb_error_msg_and_die("\ngot EOF - exiting...");
+ bb_error_msg_and_die("\ngot EOF, exiting");
}
while (*line_ptr && !isgraph(*line_ptr))
line_ptr++;
}
#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
-static const struct systypes sgi_sys_types[];
-static unsigned int sgi_get_num_sectors(int i);
-static int sgi_get_sysid(int i);
-static void sgi_delete_partition(int i);
-static void sgi_change_sysid(int i, int sys);
-static void sgi_list_table(int xtra);
-static void sgi_set_xcyl(void);
-static int verify_sgi(int verbose);
-static void sgi_add_partition(int n, int sys);
-static void sgi_set_swappartition(int i);
-static const char *sgi_get_bootfile(void);
-static void sgi_set_bootfile(const char* aFile);
-static void create_sgiinfo(void);
-static void sgi_write_table(void);
-static void sgi_set_bootpartition(int i);
#include "fdisk_aix.c"
typedef struct {
#define sunlabel ((sun_partition *)MBRbuffer)
#define SUNOS_SWAP 3
#define SUN_WHOLE_DISK 5
-static void bselect(void);
-static void xbsd_print_disklabel(int);
+STATIC_OSF void bsd_select(void);
+STATIC_OSF void xbsd_print_disklabel(int);
#include "fdisk_osf.c"
#define SGI_VOLHDR 0x00
}
#endif
+STATIC_SGI const struct systypes sgi_sys_types[];
+STATIC_SGI unsigned int sgi_get_num_sectors(int i);
+STATIC_SGI int sgi_get_sysid(int i);
+STATIC_SGI void sgi_delete_partition(int i);
+STATIC_SGI void sgi_change_sysid(int i, int sys);
+STATIC_SGI void sgi_list_table(int xtra);
+STATIC_SGI void sgi_set_xcyl(void);
+STATIC_SGI int verify_sgi(int verbose);
+STATIC_SGI void sgi_add_partition(int n, int sys);
+STATIC_SGI void sgi_set_swappartition(int i);
+STATIC_SGI const char *sgi_get_bootfile(void);
+STATIC_SGI void sgi_set_bootfile(const char* aFile);
+STATIC_SGI void create_sgiinfo(void);
+STATIC_SGI void sgi_write_table(void);
+STATIC_SGI void sgi_set_bootpartition(int i);
+
#include "fdisk_sgi.c"
-static const struct systypes sun_sys_types[];
-static void sun_delete_partition(int i);
-static void sun_change_sysid(int i, int sys);
-static void sun_list_table(int xtra);
-static void sun_set_xcyl(void);
-static void add_sun_partition(int n, int sys);
-static void sun_set_alt_cyl(void);
-static void sun_set_ncyl(int cyl);
-static void sun_set_xcyl(void);
-static void sun_set_ilfact(void);
-static void sun_set_rspeed(void);
-static void sun_set_pcylcount(void);
-static void toggle_sunflags(int i, unsigned char mask);
-static void verify_sun(void);
-static void sun_write_table(void);
+STATIC_SUN const struct systypes sun_sys_types[];
+STATIC_SUN void sun_delete_partition(int i);
+STATIC_SUN void sun_change_sysid(int i, int sys);
+STATIC_SUN void sun_list_table(int xtra);
+STATIC_SUN void sun_set_xcyl(void);
+STATIC_SUN void add_sun_partition(int n, int sys);
+STATIC_SUN void sun_set_alt_cyl(void);
+STATIC_SUN void sun_set_ncyl(int cyl);
+STATIC_SUN void sun_set_xcyl(void);
+STATIC_SUN void sun_set_ilfact(void);
+STATIC_SUN void sun_set_rspeed(void);
+STATIC_SUN void sun_set_pcylcount(void);
+STATIC_SUN void toggle_sunflags(int i, unsigned char mask);
+STATIC_SUN void verify_sun(void);
+STATIC_SUN void sun_write_table(void);
#include "fdisk_sun.c"
/* DOS partition types */
{ "\x07" "HPFS/NTFS" }, /* OS/2 IFS, eg, HPFS or NTFS or QNX */
{ "\x0a" "OS/2 Boot Manager" },/* OS/2 Boot Manager */
{ "\x0b" "Win95 FAT32" },
- { "\x0c" "Win95 FAT32 (LBA)" },/* LBA really is `Extended Int 13h' */
+ { "\x0c" "Win95 FAT32 (LBA)" },/* LBA really is 'Extended Int 13h' */
{ "\x0e" "Win95 FAT16 (LBA)" },
{ "\x0f" "Win95 Ext'd (LBA)" },
{ "\x11" "Hidden FAT12" },
};
-
/* A valid partition table sector ends in 0x55 0xaa */
static unsigned int
part_table_flag(const char *b)
if (partitions >= MAXIMUM_PARTS) {
/* This is not a Linux restriction, but
this program uses arrays of size MAXIMUM_PARTS.
- Do not try to `improve' this test. */
+ Do not try to 'improve' this test. */
struct pte *pre = &ptes[partitions-1];
#ifdef CONFIG_FEATURE_FDISK_WRITABLE
printf(_("Warning: deleting partitions after %d\n"),
#endif
break;
default:
- bb_error_msg_and_die(_("Internal error"));
+ bb_error_msg_and_die(_("internal error"));
}
#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
}
printf(_("Type 0 means free space to many systems\n"
"(but not to Linux). Having partitions of\n"
"type 0 is probably unwise. You can delete\n"
- "a partition using the `d' command.\n"));
+ "a partition using the 'd' command.\n"));
/* break; */
}
if (start > limit)
break;
if (start >= temp+units_per_sector && num_read) {
- printf(_("Sector %llu is already allocated\n"), (unsigned long long)temp);
+ printf(_("Sector %"OFF_FMT" is already allocated\n"), temp);
temp = start;
num_read = 0;
}
}
else
printf(_("Invalid partition number "
- "for type `%c'\n"), c);
+ "for type '%c'\n"), c);
}
}
}
printf("0x%03X:", i);
printf(" %02X", (unsigned char) pbuffer[i]);
if (l == MAX_PER_LINE - 1) {
- printf("\n");
+ puts("");
l = -1;
}
}
if (l > 0)
- printf("\n");
- printf("\n");
+ puts("");
+ puts("");
}
break;
case 'q':
close(fd);
- printf("\n");
+ puts("");
exit(0);
case 'r':
return;
char line[100], ptname[100], devname[120], *s;
int ma, mi, sz;
- procpt = bb_wfopen("/proc/partitions", "r");
+ procpt = fopen_or_warn("/proc/partitions", "r");
while (fgets(line, sizeof(line), procpt)) {
if (sscanf(line, " %d %d %d %[^\n ]",
/* OSF label, and no DOS label */
printf(_("Detected an OSF/1 disklabel on %s, entering "
"disklabel mode.\n"), disk_device);
- bselect();
+ bsd_select();
/*Why do we do this? It seems to be counter-intuitive*/
current_label_type = label_dos;
/* If we return we may want to make an empty DOS label? */
sgi_set_bootfile(line_ptr);
} else
#ifdef CONFIG_FEATURE_OSF_LABEL
- bselect();
+ bsd_select();
#endif
/* BUG!? Think what will happen if !CONFIG_FEATURE_OSF_LABEL !!! */
break;
case 'q':
close(fd);
- printf("\n");
+ puts("");
return 0;
case 's':
#ifdef CONFIG_FEATURE_SUN_LABEL