mirror of
https://github.com/sheumann/hush.git
synced 2025-01-04 22:34:37 +00:00
silly style fixes
This commit is contained in:
parent
ace35eeb88
commit
2a85676fa5
@ -43,13 +43,16 @@
|
|||||||
|
|
||||||
#define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
|
#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_LABELSECTOR 1
|
||||||
#define BSD_LABELOFFSET 0
|
#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_LABELSECTOR 0
|
||||||
#define BSD_LABELOFFSET 64
|
#define BSD_LABELOFFSET 64
|
||||||
#elif defined (__s390__) || defined (__s390x__)
|
#elif defined(__s390__) || defined(__s390x__)
|
||||||
#define BSD_LABELSECTOR 1
|
#define BSD_LABELSECTOR 1
|
||||||
#define BSD_LABELOFFSET 0
|
#define BSD_LABELOFFSET 0
|
||||||
#else
|
#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_readlabel(struct partition *p, struct xbsd_disklabel *d);
|
||||||
static int xbsd_writelabel(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);
|
static void alpha_bootblock_checksum(char *boot);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
static int xbsd_translate_fstype(int linux_type);
|
static int xbsd_translate_fstype(int linux_type);
|
||||||
static void xbsd_link_part(void);
|
static void xbsd_link_part(void);
|
||||||
static struct partition *xbsd_part;
|
static struct partition *xbsd_part;
|
||||||
static int xbsd_part_index;
|
static int xbsd_part_index;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__alpha__)
|
#if defined(__alpha__)
|
||||||
/* We access this through a uint64_t * when checksumming */
|
/* We access this through a uint64_t * when checksumming */
|
||||||
static char disklabelbuffer[BSD_BBSIZE] ATTRIBUTE_ALIGNED(8);
|
static char disklabelbuffer[BSD_BBSIZE] ATTRIBUTE_ALIGNED(8);
|
||||||
#else
|
#else
|
||||||
@ -298,36 +301,36 @@ check_osf_label(void)
|
|||||||
static int
|
static int
|
||||||
btrydev(const char * dev)
|
btrydev(const char * dev)
|
||||||
{
|
{
|
||||||
if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0)
|
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
printf(_("\nBSD label for device: %s\n"), dev);
|
printf(_("\nBSD label for device: %s\n"), dev);
|
||||||
xbsd_print_disklabel (0);
|
xbsd_print_disklabel(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bmenu(void)
|
bmenu(void)
|
||||||
{
|
{
|
||||||
puts (_("Command action"));
|
puts(_("Command action"));
|
||||||
puts (_("\td\tdelete a BSD partition"));
|
puts(_("\td\tdelete a BSD partition"));
|
||||||
puts (_("\te\tedit drive data"));
|
puts(_("\te\tedit drive data"));
|
||||||
puts (_("\ti\tinstall bootstrap"));
|
puts(_("\ti\tinstall bootstrap"));
|
||||||
puts (_("\tl\tlist known filesystem types"));
|
puts(_("\tl\tlist known filesystem types"));
|
||||||
puts (_("\tm\tprint this menu"));
|
puts(_("\tm\tprint this menu"));
|
||||||
puts (_("\tn\tadd a new BSD partition"));
|
puts(_("\tn\tadd a new BSD partition"));
|
||||||
puts (_("\tp\tprint BSD partition table"));
|
puts(_("\tp\tprint BSD partition table"));
|
||||||
puts (_("\tq\tquit without saving changes"));
|
puts(_("\tq\tquit without saving changes"));
|
||||||
puts (_("\tr\treturn to main menu"));
|
puts(_("\tr\treturn to main menu"));
|
||||||
puts (_("\ts\tshow complete disklabel"));
|
puts(_("\ts\tshow complete disklabel"));
|
||||||
puts (_("\tt\tchange a partition's filesystem id"));
|
puts(_("\tt\tchange a partition's filesystem id"));
|
||||||
puts (_("\tu\tchange units (cylinders/sectors)"));
|
puts(_("\tu\tchange units (cylinders/sectors)"));
|
||||||
puts (_("\tw\twrite disklabel to disk"));
|
puts(_("\tw\twrite disklabel to disk"));
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
puts (_("\tx\tlink BSD partition to non-BSD partition"));
|
puts(_("\tx\tlink BSD partition to non-BSD partition"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
static int
|
static int
|
||||||
hidden(int type)
|
hidden(int type)
|
||||||
{
|
{
|
||||||
@ -347,7 +350,7 @@ is_bsd_partition_type(int type)
|
|||||||
static void
|
static void
|
||||||
bsd_select(void)
|
bsd_select(void)
|
||||||
{
|
{
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
int t, ss;
|
int t, ss;
|
||||||
struct partition *p;
|
struct partition *p;
|
||||||
|
|
||||||
@ -376,11 +379,11 @@ bsd_select(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (__alpha__)
|
#elif defined(__alpha__)
|
||||||
|
|
||||||
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
|
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
|
||||||
if (xbsd_create_disklabel() == 0)
|
if (xbsd_create_disklabel() == 0)
|
||||||
exit (EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -422,7 +425,7 @@ bsd_select(void)
|
|||||||
case 'w':
|
case 'w':
|
||||||
xbsd_write_disklabel();
|
xbsd_write_disklabel();
|
||||||
break;
|
break;
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
case 'x':
|
case 'x':
|
||||||
xbsd_link_part();
|
xbsd_link_part();
|
||||||
break;
|
break;
|
||||||
@ -458,7 +461,7 @@ xbsd_new_part(void)
|
|||||||
if (!xbsd_check_new_partition(&i))
|
if (!xbsd_check_new_partition(&i))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if !defined (__alpha__) && !defined (__powerpc__) && !defined (__hppa__)
|
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
|
||||||
begin = get_start_sect(xbsd_part);
|
begin = get_start_sect(xbsd_part);
|
||||||
end = begin + get_nr_sects(xbsd_part) - 1;
|
end = begin + get_nr_sects(xbsd_part) - 1;
|
||||||
#else
|
#else
|
||||||
@ -475,8 +478,8 @@ xbsd_new_part(void)
|
|||||||
|
|
||||||
snprintf(mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
|
snprintf(mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
|
||||||
str_units(SINGULAR));
|
str_units(SINGULAR));
|
||||||
end = read_int(bsd_cround (begin), bsd_cround (end), bsd_cround (end),
|
end = read_int(bsd_cround(begin), bsd_cround(end), bsd_cround(end),
|
||||||
bsd_cround (begin), mesg);
|
bsd_cround(begin), mesg);
|
||||||
|
|
||||||
if (display_in_cyl_units)
|
if (display_in_cyl_units)
|
||||||
end = end * xbsd_dlabel.d_secpercyl - 1;
|
end = end * xbsd_dlabel.d_secpercyl - 1;
|
||||||
@ -494,7 +497,7 @@ xbsd_print_disklabel(int show_all)
|
|||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (show_all) {
|
if (show_all) {
|
||||||
#if defined (__alpha__)
|
#if defined(__alpha__)
|
||||||
printf("# %s:\n", disk_device);
|
printf("# %s:\n", disk_device);
|
||||||
#else
|
#else
|
||||||
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
|
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
|
||||||
@ -587,7 +590,7 @@ xbsd_print_disklabel(int show_all)
|
|||||||
static void
|
static void
|
||||||
xbsd_write_disklabel(void)
|
xbsd_write_disklabel(void)
|
||||||
{
|
{
|
||||||
#if defined (__alpha__)
|
#if defined(__alpha__)
|
||||||
printf(_("Writing disklabel to %s.\n"), disk_device);
|
printf(_("Writing disklabel to %s.\n"), disk_device);
|
||||||
xbsd_writelabel(NULL, &xbsd_dlabel);
|
xbsd_writelabel(NULL, &xbsd_dlabel);
|
||||||
#else
|
#else
|
||||||
@ -603,7 +606,7 @@ xbsd_create_disklabel(void)
|
|||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
#if defined (__alpha__)
|
#if defined(__alpha__)
|
||||||
fprintf(stderr, _("%s contains no disklabel.\n"), disk_device);
|
fprintf(stderr, _("%s contains no disklabel.\n"), disk_device);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, _("%s contains no disklabel.\n"),
|
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) "));
|
c = read_nonempty(_("Do you want to create a disklabel? (y/n) "));
|
||||||
if (c == 'y' || c == 'Y') {
|
if (c == 'y' || c == 'Y') {
|
||||||
if (xbsd_initlabel(
|
if (xbsd_initlabel(
|
||||||
#if defined (__alpha__) || defined (__powerpc__) || defined (__hppa__) || \
|
#if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \
|
||||||
defined (__s390__) || defined (__s390x__)
|
defined(__s390__) || defined(__s390x__)
|
||||||
NULL, &xbsd_dlabel
|
NULL, &xbsd_dlabel
|
||||||
#else
|
#else
|
||||||
xbsd_part, &xbsd_dlabel/* not used, xbsd_part_index*/
|
xbsd_part, &xbsd_dlabel/* not used, xbsd_part_index*/
|
||||||
#endif
|
#endif
|
||||||
) == 1) {
|
) == 1) {
|
||||||
xbsd_print_disklabel (1);
|
xbsd_print_disklabel(1);
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
@ -649,7 +652,7 @@ xbsd_edit_disklabel(void)
|
|||||||
|
|
||||||
d = &xbsd_dlabel;
|
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_secsize = edit_int(d->d_secsize ,_("bytes/sector"));
|
||||||
d->d_nsectors = edit_int(d->d_nsectors ,_("sectors/track"));
|
d->d_nsectors = edit_int(d->d_nsectors ,_("sectors/track"));
|
||||||
d->d_ntracks = edit_int(d->d_ntracks ,_("tracks/cylinder"));
|
d->d_ntracks = edit_int(d->d_ntracks ,_("tracks/cylinder"));
|
||||||
@ -860,16 +863,16 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
|
|||||||
else
|
else
|
||||||
d->d_type = BSD_DTYPE_ST506;
|
d->d_type = BSD_DTYPE_ST506;
|
||||||
|
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
d->d_flags = BSD_D_DOSPART;
|
d->d_flags = BSD_D_DOSPART;
|
||||||
#else
|
#else
|
||||||
d->d_flags = 0;
|
d->d_flags = 0;
|
||||||
#endif
|
#endif
|
||||||
d->d_secsize = SECTOR_SIZE; /* bytes/sector */
|
d->d_secsize = SECTOR_SIZE; /* bytes/sector */
|
||||||
d->d_nsectors = sectors; /* sectors/track */
|
d->d_nsectors = sectors; /* sectors/track */
|
||||||
d->d_ntracks = heads; /* tracks/cylinder (heads) */
|
d->d_ntracks = heads; /* tracks/cylinder (heads) */
|
||||||
d->d_ncylinders = cylinders;
|
d->d_ncylinders = cylinders;
|
||||||
d->d_secpercyl = sectors * heads;/* sectors/cylinder */
|
d->d_secpercyl = sectors * heads; /* sectors/cylinder */
|
||||||
if (d->d_secpercyl == 0)
|
if (d->d_secpercyl == 0)
|
||||||
d->d_secpercyl = 1; /* avoid segfaults */
|
d->d_secpercyl = 1; /* avoid segfaults */
|
||||||
d->d_secperunit = d->d_secpercyl * d->d_ncylinders;
|
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_bbsize = BSD_BBSIZE;
|
||||||
d->d_sbsize = BSD_SBSIZE;
|
d->d_sbsize = BSD_SBSIZE;
|
||||||
|
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
d->d_npartitions = 4;
|
d->d_npartitions = 4;
|
||||||
pp = &d->d_partitions[2]; /* Partition C should be
|
pp = &d->d_partitions[2]; /* Partition C should be NetBSD partition */
|
||||||
the NetBSD partition */
|
|
||||||
pp->p_offset = get_start_sect(p);
|
pp->p_offset = get_start_sect(p);
|
||||||
pp->p_size = get_nr_sects(p);
|
pp->p_size = get_nr_sects(p);
|
||||||
pp->p_fstype = BSD_FS_UNUSED;
|
pp->p_fstype = BSD_FS_UNUSED;
|
||||||
pp = &d->d_partitions[3]; /* Partition D should be
|
pp = &d->d_partitions[3]; /* Partition D should be whole disk */
|
||||||
the whole disk */
|
|
||||||
pp->p_offset = 0;
|
pp->p_offset = 0;
|
||||||
pp->p_size = d->d_secperunit;
|
pp->p_size = d->d_secperunit;
|
||||||
pp->p_fstype = BSD_FS_UNUSED;
|
pp->p_fstype = BSD_FS_UNUSED;
|
||||||
#elif defined (__alpha__)
|
#elif defined(__alpha__)
|
||||||
d->d_npartitions = 3;
|
d->d_npartitions = 3;
|
||||||
pp = &d->d_partitions[2]; /* Partition C should be
|
pp = &d->d_partitions[2]; /* Partition C should be
|
||||||
the whole disk */
|
the whole disk */
|
||||||
@ -914,14 +917,14 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
|
|||||||
* If it has the right magic, return 1.
|
* If it has the right magic, return 1.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d)
|
xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
|
||||||
{
|
{
|
||||||
int t, sector;
|
int t, sector;
|
||||||
|
|
||||||
/* p is used only to get the starting sector */
|
/* p is used only to get the starting sector */
|
||||||
#if !defined (__alpha__)
|
#if !defined(__alpha__)
|
||||||
sector = (p ? get_start_sect(p) : 0);
|
sector = (p ? get_start_sect(p) : 0);
|
||||||
#elif defined (__alpha__)
|
#elif defined(__alpha__)
|
||||||
sector = 0;
|
sector = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -950,18 +953,18 @@ xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d)
|
xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d)
|
||||||
{
|
{
|
||||||
unsigned int sector;
|
unsigned int sector;
|
||||||
|
|
||||||
#if !defined (__alpha__) && !defined (__powerpc__) && !defined (__hppa__)
|
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
|
||||||
sector = get_start_sect(p) + BSD_LABELSECTOR;
|
sector = get_start_sect(p) + BSD_LABELSECTOR;
|
||||||
#else
|
#else
|
||||||
sector = BSD_LABELSECTOR;
|
sector = BSD_LABELSECTOR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d->d_checksum = 0;
|
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,
|
/* This is necessary if we want to write the bootstrap later,
|
||||||
otherwise we'd write the old disklabel with the bootstrap.
|
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],
|
memmove(&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
|
||||||
d, sizeof(struct xbsd_disklabel));
|
d, sizeof(struct xbsd_disklabel));
|
||||||
|
|
||||||
#if defined (__alpha__) && BSD_LABELSECTOR == 0
|
#if defined(__alpha__) && BSD_LABELSECTOR == 0
|
||||||
alpha_bootblock_checksum(disklabelbuffer);
|
alpha_bootblock_checksum(disklabelbuffer);
|
||||||
if (lseek(fd, 0, SEEK_SET) == -1)
|
if (lseek(fd, 0, SEEK_SET) == -1)
|
||||||
fdisk_fatal(unable_to_seek);
|
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
|
static int
|
||||||
xbsd_translate_fstype(int linux_type)
|
xbsd_translate_fstype(int linux_type)
|
||||||
{
|
{
|
||||||
@ -1024,11 +1027,7 @@ xbsd_link_part(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__alpha__)
|
#if defined(__alpha__)
|
||||||
|
|
||||||
#if !defined(__GLIBC__)
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alpha_bootblock_checksum(char *boot)
|
alpha_bootblock_checksum(char *boot)
|
||||||
|
Loading…
Reference in New Issue
Block a user