-/* geometry.c - Device and file geometry computation */
-/*
-Copyright 1992-1998 Werner Almesberger.
-Copyright 1999-2005 John Coffman.
-All rights reserved.
-
-Licensed under the terms contained in the file 'COPYING' in the
-source directory.
-
-*/
-/* Patched for linux-2.4.0 - Glibc-2.2 by Sergey Ostrovsky 11/16/2000 */
+/* geometry.c - Device and file geometry computation
+ *
+ * Copyright 1992-1998 Werner Almesberger
+ * Copyright 1999-2005 John Coffman
+ * Copyright 2009-2011 Joachim Wiedorn
+ * All rights reserved.
+ *
+ * Licensed under the terms contained in the file 'COPYING'
+ * in the source directory.
+ */
#define _GNU_SOURCE
#include <unistd.h>
/* (*(__u32 *)"R4Sb"); */
#endif
#ifndef REISER4_IOC_UNPACK
-#define REISER4_IOC_UNPACK _IOW(0xCD,1,long)
+#define REISER4_IOC_UNPACK _IOW(0xCD,1,long)
#endif
#endif
(major >= MAJOR_SMART2 && major <= MAJOR_SMART2+7) ||
(major >= MAJOR_CISS && major <= MAJOR_CISS+7) ||
major == MAJOR_FTL || major == MAJOR_NFTL || major == MAJOR_DOC ||
- (major >= MAJOR_SD9 && major <= MAJOR_SD16)
+ (major >= MAJOR_SD9 && major <= MAJOR_SD16) ||
+ (major >= MAJOR_SATA1 && major <= MAJOR_SATA2)
) return 0xFFFFFFF0; /* 4 bit partition mask */
- if ( major == MAJOR_SATA || major == MAJOR_SATA2
+ if ( major == MAJOR_CARM1 || major == MAJOR_CARM2
) return 0xFFFFFFE0; /* 5 bit partition mask */
if ( major == MAJOR_IBM_iSER ||
maxpart = cfg_get_strg(cf_disk,"max-partitions");
if (maxpart) {
if (major<nelem(max_partno)) {
- int i = to_number(maxpart);
- if (max_partno[major] && max_partno[major]!=i) die("Cannot alter 'max-partitions' for known disk %s", disk);
- max_partno[major] = i;
- if (i!=7 && i!=15 && i!=31 && i!=63) die("disk=%s: illegal value for max-partitions(%d)", disk, i);
+ int i = to_number(maxpart);
+ if (max_partno[major] && max_partno[major]!=i) die("Cannot alter 'max-partitions' for known disk %s", disk);
+ max_partno[major] = i;
+ if (i!=7 && i!=15 && i!=31 && i!=63 && i!=128) die("disk=%s: illegal value for max-partitions(%d)", disk, i);
}
else {
die("Implementation restriction: max-partitions on major device > %d", (int)nelem(max_partno)-1);
static int last_dev(int major,int increment)
{
/*
- * In version 12 to 18, LILO only relied on scan_last_dev (or last_dev). This
- * obviously didn't work if entries in /dev were missing. Versions 18 and 19
- * added the probe loop, which seems to be okay, but which may probe for
- * invalid minor numbers. The IDE driver objects to that. Since last_dev is
- * only used to count IDE drives anyway, we try now only the first two devices
- * and forget about scan_last_dev.
+ * Since last_dev is only used to count IDE drives anyway, we try
+ * now only the first two devices and forget about scan_last_dev.
*/
DEVICE dev;
int devs;
struct hd_geometry hdprm;
if (verbose>=5) printf("geo_query_dev: device=%04X\n", device);
-#if 0
-/* Werner's original */
- get_all = all || MAJOR(device) != MAJOR_FD; */
-#else
-/* simplify the condition -- JRC 2003-06-04 */
+ /* simplified condition -- JRC 2003-06-04 */
get_all = all;
-#endif
+
if (!MAJOR(device))
die("Trying to map files from unnamed device 0x%04x (NFS/RAID mirror down ?)",device);
if (device == MAJMIN_RAM)
geo->sectors = hdprm.sectors;
geo->start = hdprm.start;
break;
+ case MAJOR_SATA1:
+ case MAJOR_SATA2:
+ printf("WARNING: SATA partition in the high region (>15):\n");
+ printf("LILO needs the kernel in one of the first 15 SATA partitions. If \n");
+ printf("you need support for kernel in SATA partitions of the high region \n");
+ printf("than try grub2 for this purpose! \n");
+ die("Sorry, cannot handle device 0x%04x",device);
+ break;
MASK31:
geo->device = 0x80 + last_dev(MAJOR_HD,64) + (MINOR(device) >> 5);
if (!get_all) break;
break;
if (!dm_target)
die("device-mapper: Sector outside mapped device? (%d: %u/%"PRIu64")",
- geo->base_dev, sector, (uint64_t)(dm_table->target ?
+ (int) geo->base_dev, sector, (uint64_t)(dm_table->target ?
(dm_table->target->start+dm_table->target->length) : 0));
dev = dm_target->device;