aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fdisk_osf.c123
1 files changed, 61 insertions, 62 deletions
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index 2daafe6c7..17acd1977 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -43,13 +43,16 @@
#define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
-#if defined (i386) || defined (__sparc__) || defined (__arm__) || defined (__m68k__) || defined (__mips__) || defined (__s390__) || defined (__sh__) || defined(__x86_64__)
+#if defined(i386) || defined(__sparc__) || defined(__arm__) \
+ || defined(__m68k__) || defined(__mips__) || defined(__s390__) \
+ || defined(__sh__) || defined(__x86_64__)
#define BSD_LABELSECTOR 1
#define BSD_LABELOFFSET 0
-#elif defined (__alpha__) || defined (__powerpc__) || defined (__ia64__) || defined (__hppa__)
+#elif defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \
+ || defined(__hppa__)
#define BSD_LABELSECTOR 0
#define BSD_LABELOFFSET 64
-#elif defined (__s390__) || defined (__s390x__)
+#elif defined(__s390__) || defined(__s390x__)
#define BSD_LABELSECTOR 1
#define BSD_LABELOFFSET 0
#else
@@ -258,18 +261,18 @@ static int xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d);
static int xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d);
static int xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d);
-#if defined (__alpha__)
+#if defined(__alpha__)
static void alpha_bootblock_checksum(char *boot);
#endif
-#if !defined (__alpha__)
+#if !defined(__alpha__)
static int xbsd_translate_fstype(int linux_type);
static void xbsd_link_part(void);
static struct partition *xbsd_part;
static int xbsd_part_index;
#endif
-#if defined (__alpha__)
+#if defined(__alpha__)
/* We access this through a uint64_t * when checksumming */
static char disklabelbuffer[BSD_BBSIZE] ATTRIBUTE_ALIGNED(8);
#else
@@ -298,36 +301,36 @@ check_osf_label(void)
static int
btrydev(const char * dev)
{
- if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0)
+ if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
return -1;
printf(_("\nBSD label for device: %s\n"), dev);
- xbsd_print_disklabel (0);
+ xbsd_print_disklabel(0);
return 0;
}
static void
bmenu(void)
{
- puts (_("Command action"));
- puts (_("\td\tdelete a BSD partition"));
- puts (_("\te\tedit drive data"));
- puts (_("\ti\tinstall bootstrap"));
- puts (_("\tl\tlist known filesystem types"));
- puts (_("\tm\tprint this menu"));
- puts (_("\tn\tadd a new BSD partition"));
- puts (_("\tp\tprint BSD partition table"));
- puts (_("\tq\tquit without saving changes"));
- puts (_("\tr\treturn to main menu"));
- puts (_("\ts\tshow complete disklabel"));
- puts (_("\tt\tchange a partition's filesystem id"));
- puts (_("\tu\tchange units (cylinders/sectors)"));
- puts (_("\tw\twrite disklabel to disk"));
-#if !defined (__alpha__)
- puts (_("\tx\tlink BSD partition to non-BSD partition"));
+ puts(_("Command action"));
+ puts(_("\td\tdelete a BSD partition"));
+ puts(_("\te\tedit drive data"));
+ puts(_("\ti\tinstall bootstrap"));
+ puts(_("\tl\tlist known filesystem types"));
+ puts(_("\tm\tprint this menu"));
+ puts(_("\tn\tadd a new BSD partition"));
+ puts(_("\tp\tprint BSD partition table"));
+ puts(_("\tq\tquit without saving changes"));
+ puts(_("\tr\treturn to main menu"));
+ puts(_("\ts\tshow complete disklabel"));
+ puts(_("\tt\tchange a partition's filesystem id"));
+ puts(_("\tu\tchange units (cylinders/sectors)"));
+ puts(_("\tw\twrite disklabel to disk"));
+#if !defined(__alpha__)
+ puts(_("\tx\tlink BSD partition to non-BSD partition"));
#endif
}
-#if !defined (__alpha__)
+#if !defined(__alpha__)
static int
hidden(int type)
{
@@ -347,7 +350,7 @@ is_bsd_partition_type(int type)
static void
bsd_select(void)
{
-#if !defined (__alpha__)
+#if !defined(__alpha__)
int t, ss;
struct partition *p;
@@ -376,11 +379,11 @@ bsd_select(void)
return;
}
-#elif defined (__alpha__)
+#elif defined(__alpha__)
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
if (xbsd_create_disklabel() == 0)
- exit (EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
#endif
@@ -422,7 +425,7 @@ bsd_select(void)
case 'w':
xbsd_write_disklabel();
break;
-#if !defined (__alpha__)
+#if !defined(__alpha__)
case 'x':
xbsd_link_part();
break;
@@ -458,7 +461,7 @@ xbsd_new_part(void)
if (!xbsd_check_new_partition(&i))
return;
-#if !defined (__alpha__) && !defined (__powerpc__) && !defined (__hppa__)
+#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
begin = get_start_sect(xbsd_part);
end = begin + get_nr_sects(xbsd_part) - 1;
#else
@@ -475,8 +478,8 @@ xbsd_new_part(void)
snprintf(mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
str_units(SINGULAR));
- end = read_int(bsd_cround (begin), bsd_cround (end), bsd_cround (end),
- bsd_cround (begin), mesg);
+ end = read_int(bsd_cround(begin), bsd_cround(end), bsd_cround(end),
+ bsd_cround(begin), mesg);
if (display_in_cyl_units)
end = end * xbsd_dlabel.d_secpercyl - 1;
@@ -494,7 +497,7 @@ xbsd_print_disklabel(int show_all)
int i, j;
if (show_all) {
-#if defined (__alpha__)
+#if defined(__alpha__)
printf("# %s:\n", disk_device);
#else
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
@@ -587,7 +590,7 @@ xbsd_print_disklabel(int show_all)
static void
xbsd_write_disklabel(void)
{
-#if defined (__alpha__)
+#if defined(__alpha__)
printf(_("Writing disklabel to %s.\n"), disk_device);
xbsd_writelabel(NULL, &xbsd_dlabel);
#else
@@ -603,7 +606,7 @@ xbsd_create_disklabel(void)
{
char c;
-#if defined (__alpha__)
+#if defined(__alpha__)
fprintf(stderr, _("%s contains no disklabel.\n"), disk_device);
#else
fprintf(stderr, _("%s contains no disklabel.\n"),
@@ -614,14 +617,14 @@ xbsd_create_disklabel(void)
c = read_nonempty(_("Do you want to create a disklabel? (y/n) "));
if (c == 'y' || c == 'Y') {
if (xbsd_initlabel(
-#if defined (__alpha__) || defined (__powerpc__) || defined (__hppa__) || \
- defined (__s390__) || defined (__s390x__)
+#if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \
+ defined(__s390__) || defined(__s390x__)
NULL, &xbsd_dlabel
#else
xbsd_part, &xbsd_dlabel/* not used, xbsd_part_index*/
#endif
) == 1) {
- xbsd_print_disklabel (1);
+ xbsd_print_disklabel(1);
return 1;
} else
return 0;
@@ -649,7 +652,7 @@ xbsd_edit_disklabel(void)
d = &xbsd_dlabel;
-#if defined (__alpha__) || defined (__ia64__)
+#if defined(__alpha__) || defined(__ia64__)
d->d_secsize = edit_int(d->d_secsize ,_("bytes/sector"));
d->d_nsectors = edit_int(d->d_nsectors ,_("sectors/track"));
d->d_ntracks = edit_int(d->d_ntracks ,_("tracks/cylinder"));
@@ -860,16 +863,16 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
else
d->d_type = BSD_DTYPE_ST506;
-#if !defined (__alpha__)
+#if !defined(__alpha__)
d->d_flags = BSD_D_DOSPART;
#else
d->d_flags = 0;
#endif
d->d_secsize = SECTOR_SIZE; /* bytes/sector */
- d->d_nsectors = sectors; /* sectors/track */
- d->d_ntracks = heads; /* tracks/cylinder (heads) */
+ d->d_nsectors = sectors; /* sectors/track */
+ d->d_ntracks = heads; /* tracks/cylinder (heads) */
d->d_ncylinders = cylinders;
- d->d_secpercyl = sectors * heads;/* sectors/cylinder */
+ d->d_secpercyl = sectors * heads; /* sectors/cylinder */
if (d->d_secpercyl == 0)
d->d_secpercyl = 1; /* avoid segfaults */
d->d_secperunit = d->d_secpercyl * d->d_ncylinders;
@@ -885,19 +888,19 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
d->d_bbsize = BSD_BBSIZE;
d->d_sbsize = BSD_SBSIZE;
-#if !defined (__alpha__)
+#if !defined(__alpha__)
d->d_npartitions = 4;
- pp = &d->d_partitions[2]; /* Partition C should be
- the NetBSD partition */
+ pp = &d->d_partitions[2]; /* Partition C should be NetBSD partition */
+
pp->p_offset = get_start_sect(p);
pp->p_size = get_nr_sects(p);
pp->p_fstype = BSD_FS_UNUSED;
- pp = &d->d_partitions[3]; /* Partition D should be
- the whole disk */
+ pp = &d->d_partitions[3]; /* Partition D should be whole disk */
+
pp->p_offset = 0;
pp->p_size = d->d_secperunit;
pp->p_fstype = BSD_FS_UNUSED;
-#elif defined (__alpha__)
+#elif defined(__alpha__)
d->d_npartitions = 3;
pp = &d->d_partitions[2]; /* Partition C should be
the whole disk */
@@ -914,14 +917,14 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
* If it has the right magic, return 1.
*/
static int
-xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d)
+xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
{
int t, sector;
/* p is used only to get the starting sector */
-#if !defined (__alpha__)
+#if !defined(__alpha__)
sector = (p ? get_start_sect(p) : 0);
-#elif defined (__alpha__)
+#elif defined(__alpha__)
sector = 0;
#endif
@@ -950,18 +953,18 @@ xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d)
}
static int
-xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d)
+xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d)
{
unsigned int sector;
-#if !defined (__alpha__) && !defined (__powerpc__) && !defined (__hppa__)
+#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
sector = get_start_sect(p) + BSD_LABELSECTOR;
#else
sector = BSD_LABELSECTOR;
#endif
d->d_checksum = 0;
- d->d_checksum = xbsd_dkcksum (d);
+ d->d_checksum = xbsd_dkcksum(d);
/* This is necessary if we want to write the bootstrap later,
otherwise we'd write the old disklabel with the bootstrap.
@@ -969,7 +972,7 @@ xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d)
memmove(&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
d, sizeof(struct xbsd_disklabel));
-#if defined (__alpha__) && BSD_LABELSECTOR == 0
+#if defined(__alpha__) && BSD_LABELSECTOR == 0
alpha_bootblock_checksum(disklabelbuffer);
if (lseek(fd, 0, SEEK_SET) == -1)
fdisk_fatal(unable_to_seek);
@@ -986,7 +989,7 @@ xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d)
}
-#if !defined (__alpha__)
+#if !defined(__alpha__)
static int
xbsd_translate_fstype(int linux_type)
{
@@ -1024,11 +1027,7 @@ xbsd_link_part(void)
}
#endif
-#if defined (__alpha__)
-
-#if !defined(__GLIBC__)
-typedef unsigned long long uint64_t;
-#endif
+#if defined(__alpha__)
static void
alpha_bootblock_checksum(char *boot)