aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/fdisk.c82
-rw-r--r--util-linux/fdisk_osf.c2
-rw-r--r--util-linux/fdisk_sgi.c2
3 files changed, 49 insertions, 37 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index ab8946744..d5edaaa00 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -131,25 +131,37 @@ enum label_type {
131 label_dos, label_sun, label_sgi, label_aix, label_osf 131 label_dos, label_sun, label_sgi, label_aix, label_osf
132}; 132};
133#define LABEL_IS_DOS (label_dos == current_label_type) 133#define LABEL_IS_DOS (label_dos == current_label_type)
134
134#ifdef CONFIG_FEATURE_SUN_LABEL 135#ifdef CONFIG_FEATURE_SUN_LABEL
135#define LABEL_IS_SUN (label_sun == current_label_type) 136#define LABEL_IS_SUN (label_sun == current_label_type)
137#define STATIC_SUN static
136#else 138#else
137#define LABEL_IS_SUN 0 139#define LABEL_IS_SUN 0
140#define STATIC_SUN extern
138#endif 141#endif
142
139#ifdef CONFIG_FEATURE_SGI_LABEL 143#ifdef CONFIG_FEATURE_SGI_LABEL
140#define LABEL_IS_SGI (label_sgi == current_label_type) 144#define LABEL_IS_SGI (label_sgi == current_label_type)
145#define STATIC_SGI static
141#else 146#else
142#define LABEL_IS_SGI 0 147#define LABEL_IS_SGI 0
148#define STATIC_SGI extern
143#endif 149#endif
150
144#ifdef CONFIG_FEATURE_AIX_LABEL 151#ifdef CONFIG_FEATURE_AIX_LABEL
145#define LABEL_IS_AIX (label_aix == current_label_type) 152#define LABEL_IS_AIX (label_aix == current_label_type)
153#define STATIC_AIX static
146#else 154#else
147#define LABEL_IS_AIX 0 155#define LABEL_IS_AIX 0
156#define STATIC_AIX extern
148#endif 157#endif
158
149#ifdef CONFIG_FEATURE_OSF_LABEL 159#ifdef CONFIG_FEATURE_OSF_LABEL
150#define LABEL_IS_OSF (label_osf == current_label_type) 160#define LABEL_IS_OSF (label_osf == current_label_type)
161#define STATIC_OSF static
151#else 162#else
152#define LABEL_IS_OSF 0 163#define LABEL_IS_OSF 0
164#define STATIC_OSF extern
153#endif 165#endif
154 166
155enum action { fdisk, require, try_only, create_empty_dos, create_empty_sun }; 167enum action { fdisk, require, try_only, create_empty_dos, create_empty_sun };
@@ -317,21 +329,6 @@ read_hex(const struct systypes *sys)
317} 329}
318#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 330#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
319 331
320static const struct systypes sgi_sys_types[];
321static unsigned int sgi_get_num_sectors(int i);
322static int sgi_get_sysid(int i);
323static void sgi_delete_partition(int i);
324static void sgi_change_sysid(int i, int sys);
325static void sgi_list_table(int xtra);
326static void sgi_set_xcyl(void);
327static int verify_sgi(int verbose);
328static void sgi_add_partition(int n, int sys);
329static void sgi_set_swappartition(int i);
330static const char *sgi_get_bootfile(void);
331static void sgi_set_bootfile(const char* aFile);
332static void create_sgiinfo(void);
333static void sgi_write_table(void);
334static void sgi_set_bootpartition(int i);
335#include "fdisk_aix.c" 332#include "fdisk_aix.c"
336 333
337typedef struct { 334typedef struct {
@@ -364,8 +361,8 @@ typedef struct {
364#define sunlabel ((sun_partition *)MBRbuffer) 361#define sunlabel ((sun_partition *)MBRbuffer)
365#define SUNOS_SWAP 3 362#define SUNOS_SWAP 3
366#define SUN_WHOLE_DISK 5 363#define SUN_WHOLE_DISK 5
367static void bselect(void); 364STATIC_OSF void bsd_select(void);
368static void xbsd_print_disklabel(int); 365STATIC_OSF void xbsd_print_disklabel(int);
369#include "fdisk_osf.c" 366#include "fdisk_osf.c"
370 367
371#define SGI_VOLHDR 0x00 368#define SGI_VOLHDR 0x00
@@ -398,23 +395,39 @@ __swap32(uint32_t x)
398} 395}
399#endif 396#endif
400 397
398STATIC_SGI const struct systypes sgi_sys_types[];
399STATIC_SGI unsigned int sgi_get_num_sectors(int i);
400STATIC_SGI int sgi_get_sysid(int i);
401STATIC_SGI void sgi_delete_partition(int i);
402STATIC_SGI void sgi_change_sysid(int i, int sys);
403STATIC_SGI void sgi_list_table(int xtra);
404STATIC_SGI void sgi_set_xcyl(void);
405STATIC_SGI int verify_sgi(int verbose);
406STATIC_SGI void sgi_add_partition(int n, int sys);
407STATIC_SGI void sgi_set_swappartition(int i);
408STATIC_SGI const char *sgi_get_bootfile(void);
409STATIC_SGI void sgi_set_bootfile(const char* aFile);
410STATIC_SGI void create_sgiinfo(void);
411STATIC_SGI void sgi_write_table(void);
412STATIC_SGI void sgi_set_bootpartition(int i);
413
401#include "fdisk_sgi.c" 414#include "fdisk_sgi.c"
402 415
403static const struct systypes sun_sys_types[]; 416STATIC_SUN const struct systypes sun_sys_types[];
404static void sun_delete_partition(int i); 417STATIC_SUN void sun_delete_partition(int i);
405static void sun_change_sysid(int i, int sys); 418STATIC_SUN void sun_change_sysid(int i, int sys);
406static void sun_list_table(int xtra); 419STATIC_SUN void sun_list_table(int xtra);
407static void sun_set_xcyl(void); 420STATIC_SUN void sun_set_xcyl(void);
408static void add_sun_partition(int n, int sys); 421STATIC_SUN void add_sun_partition(int n, int sys);
409static void sun_set_alt_cyl(void); 422STATIC_SUN void sun_set_alt_cyl(void);
410static void sun_set_ncyl(int cyl); 423STATIC_SUN void sun_set_ncyl(int cyl);
411static void sun_set_xcyl(void); 424STATIC_SUN void sun_set_xcyl(void);
412static void sun_set_ilfact(void); 425STATIC_SUN void sun_set_ilfact(void);
413static void sun_set_rspeed(void); 426STATIC_SUN void sun_set_rspeed(void);
414static void sun_set_pcylcount(void); 427STATIC_SUN void sun_set_pcylcount(void);
415static void toggle_sunflags(int i, unsigned char mask); 428STATIC_SUN void toggle_sunflags(int i, unsigned char mask);
416static void verify_sun(void); 429STATIC_SUN void verify_sun(void);
417static void sun_write_table(void); 430STATIC_SUN void sun_write_table(void);
418#include "fdisk_sun.c" 431#include "fdisk_sun.c"
419 432
420/* DOS partition types */ 433/* DOS partition types */
@@ -523,7 +536,6 @@ static const struct systypes i386_sys_types[] = {
523}; 536};
524 537
525 538
526
527/* A valid partition table sector ends in 0x55 0xaa */ 539/* A valid partition table sector ends in 0x55 0xaa */
528static unsigned int 540static unsigned int
529part_table_flag(const char *b) 541part_table_flag(const char *b)
@@ -2921,7 +2933,7 @@ int fdisk_main(int argc, char **argv)
2921 /* OSF label, and no DOS label */ 2933 /* OSF label, and no DOS label */
2922 printf(_("Detected an OSF/1 disklabel on %s, entering " 2934 printf(_("Detected an OSF/1 disklabel on %s, entering "
2923 "disklabel mode.\n"), disk_device); 2935 "disklabel mode.\n"), disk_device);
2924 bselect(); 2936 bsd_select();
2925 /*Why do we do this? It seems to be counter-intuitive*/ 2937 /*Why do we do this? It seems to be counter-intuitive*/
2926 current_label_type = label_dos; 2938 current_label_type = label_dos;
2927 /* If we return we may want to make an empty DOS label? */ 2939 /* If we return we may want to make an empty DOS label? */
@@ -2954,7 +2966,7 @@ int fdisk_main(int argc, char **argv)
2954 sgi_set_bootfile(line_ptr); 2966 sgi_set_bootfile(line_ptr);
2955 } else 2967 } else
2956#ifdef CONFIG_FEATURE_OSF_LABEL 2968#ifdef CONFIG_FEATURE_OSF_LABEL
2957 bselect(); 2969 bsd_select();
2958#endif 2970#endif
2959 2971
2960/* BUG!? Think what will happen if !CONFIG_FEATURE_OSF_LABEL !!! */ 2972/* BUG!? Think what will happen if !CONFIG_FEATURE_OSF_LABEL !!! */
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index 97fe79aca..17267d54b 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -345,7 +345,7 @@ is_bsd_partition_type(int type)
345#endif 345#endif
346 346
347static void 347static void
348bselect(void) 348bsd_select(void)
349{ 349{
350#if !defined (__alpha__) 350#if !defined (__alpha__)
351 int t, ss; 351 int t, ss;
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 98abcc086..8d6837f77 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -180,7 +180,7 @@ static const struct systypes sgi_sys_types[] = {
180/* LINUX_NATIVE */ { "\x83" "Linux native" }, 180/* LINUX_NATIVE */ { "\x83" "Linux native" },
181/* LINUX_LVM */ { "\x8d" "Linux LVM" }, 181/* LINUX_LVM */ { "\x8d" "Linux LVM" },
182/* LINUX_RAID */ { "\xfd" "Linux RAID" }, 182/* LINUX_RAID */ { "\xfd" "Linux RAID" },
183 { NULL } 183 { NULL }
184}; 184};
185 185
186 186