+/* vi: set sw=4 ts=4: */
/* fdisk.c -- Partition table manipulator for Linux.
*
* Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk)
#define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
-#if defined (i386) || defined (__sparc__) || defined (__arm__) || 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__)
else
d->d_type = BSD_DTYPE_ST506;
-#if 0 /* not used (at least not written to disk) by NetBSD/i386 1.0 */
- d->d_subtype = BSD_DSTYPE_INDOSPART & pindex;
-#endif
-
#if !defined (__alpha__)
d->d_flags = BSD_D_DOSPART;
#else
#endif /* OSF_LABEL */
#if defined(CONFIG_FEATURE_SGI_LABEL) || defined(CONFIG_FEATURE_SUN_LABEL)
-static inline unsigned short
+static unsigned short
__swap16(unsigned short x)
{
return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
}
-static inline uint32_t
+static uint32_t
__swap32(uint32_t x)
{
return (((x & 0xFF) << 24) |
if (!ioctl(fd, SCSI_IOCTL_GET_IDLUN, &id)) {
sprintf(buffer,
"Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n",
-#if 0
- ((id[0]>>24)&0xff)-/*PROC_SCSI_SCSI+PROC_SCSI_FILE*/33,
-#else
/* This is very wrong (works only if you have one HBA),
but I haven't found a way how to get hostno
from the current kernel */
0,
-#endif
(id[0]>>16) & 0xff,
id[0] & 0xff,
(id[0]>>8) & 0xff
}
}
-static inline void
+static void
get_kernel_geometry(void)
{
struct hd_geometry geometry;
printf(_("logical=(%d, %d, %d)\n"),lec, leh, les);
}
-#if 0
-/* Beginning on cylinder boundary? */
- if (pbh != !pbc || pbs != 1) {
- printf(_("Partition %i does not start on cylinder "
- "boundary:\n"), partition + 1);
- printf(_(" phys=(%d, %d, %d) "), pbc, pbh, pbs);
- printf(_("should be (%d, %d, 1)\n"), pbc, !pbc);
- }
-#endif
-
/* Ending on cylinder boundary? */
if (peh != (heads - 1) || pes != sectors) {
printf(_("Partition %i does not end on cylinder boundary.\n"),
partition + 1);
-#if 0
- printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);
- printf(_("should be (%d, %d, %d)\n"),
- pec, heads - 1, sectors);
-#endif
}
}
ext_index = n;
pen->ext_pointer = p;
pe4->offset = extended_offset = start;
- pe4->sectorbuffer = xcalloc(1, sector_size);
+ pe4->sectorbuffer = xzalloc(sector_size);
pe4->part_table = pt_offset(pe4->sectorbuffer, 0);
pe4->ext_pointer = pe4->part_table + 1;
pe4->changed = 1;
if (partitions > 5 || ptes[4].part_table->sys_ind) {
struct pte *pe = &ptes[partitions];
- pe->sectorbuffer = xcalloc(1, sector_size);
+ pe->sectorbuffer = xzalloc(sector_size);
pe->part_table = pt_offset(pe->sectorbuffer, 0);
pe->ext_pointer = pe->part_table + 1;
pe->offset = 0;
}
}
-#if 0
- printf(_("This kernel finds the sector size itself - "
- "-b option ignored\n"));
-#else
if (user_set_sector_size && argc-optind != 1)
printf(_("Warning: the -b (set sector size) option should"
" be used with one specified device\n"));
-#endif
#ifdef CONFIG_FEATURE_FDISK_WRITABLE
if (optl) {