Репозитории ALT
S: | 24.2-alt3 |
5.1: | 22.7.3-alt6.M51.1 |
4.1: | 22.7.3-alt5 |
4.0: | 22.7.3-alt5 |
3.0: | 22.4.1-alt9 |
Группа :: Система/Ядро и оборудование
Пакет: lilo
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: lilo-22.7.3-alt-devmapper.patch
Скачать
Скачать
--- lilo-22.7.3/Makefile.orig 2007-01-09 11:57:14 +0000
+++ lilo-22.7.3/Makefile 2007-01-09 11:57:30 +0000
@@ -66,7 +66,7 @@
CONFIG=-DBDATA -DDSECS=3 -DEVMS -DIGNORECASE -DLVM -DNOKEYBOARD -DONE_SHOT \
-DPASS160 -DREISERFS -DREWRITE_TABLE -DSOLO_CHAIN -DVERSION -DVIRTUAL \
- -DMDPRAID -DBLKID
+ -DMDPRAID -DBLKID -DDEVMAPPER
# set the following if you wish LILO.COM to be installed
DOS_DIR=/dosC/boot
--- lilo-22.7.3/geometry.c.orig 2007-01-09 13:41:49 +0000
+++ lilo-22.7.3/geometry.c 2007-01-09 13:59:18 +0000
@@ -858,18 +858,25 @@ int is_first(int device)
}
}
+#ifdef LCF_DEVMAPPER
+static int
+is_devmapper_device(int device)
+{
+ int i;
+
+ for (i = 0; i < dm_major_nr; ++i)
+ if (MAJOR(device) == dm_major_list[i])
+ return 1;
+ return 0;
+}
+#endif /* LCF_DEVMAPPER */
void geo_get(GEOMETRY *geo,int device,int user_device,int all)
{
DT_ENTRY *walk;
int inherited,keep_cyls,is_raid=0;
#ifdef LCF_DEVMAPPER
- int i;
-
- for(i = 0; i < dm_major_nr; i++)
- if (MAJOR(device) == dm_major_list[i])
- break;
- while (i < dm_major_nr) {
+ while (is_devmapper_device(device)) {
DM_TABLE *dm_table;
for(dm_table = dmtab; dm_table; dm_table = dm_table->next)
@@ -883,43 +890,45 @@ void geo_get(GEOMETRY *geo,int device,in
for(target = dm_table->target; target; target = target->next)
device = target->device;
} else {
- DEVICE dev;
struct dm_task *dmt;
- void *next = NULL;
- char dmdev[PATH_MAX+1];
- char buf[PATH_MAX+1];
- char *slash;
- int result;
-
- dev_open(&dev, device, -1);
- strncpy(dmdev, dev.name, PATH_MAX);
- dmdev[PATH_MAX] = 0;
+ struct dm_names *names = 0;
+ void *next = NULL;
+ char dmdev[PATH_MAX + 1];
+ char buf[PATH_MAX + 1];
+ char *slash = 0;
+ uint32_t nnext = 0;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
+ die("device-mapper: dm_task_create(DM_DEVICE_LIST) failed");
+ if (!dm_task_run(dmt))
+ die("device-mapper: dm_task_run(DM_DEVICE_LIST) failed");
+ if (!(names = dm_task_get_names(dmt)))
+ die("device-mapper: dm_task_get_names() failed");
+ if (!names->dev)
+ die("device-mapper: dm_task_get_names() names->dev");
+
do {
- memset(buf, 0, PATH_MAX + 1);
- if ((result = readlink(dmdev, buf, PATH_MAX)) < 0 && errno != EINVAL)
- die("device-mapper: readlink(\"%s\") failed with: %s",buf,
- strerror(errno));
- if (result >= 0) {
- if (buf[0] != '/' && (slash = strrchr(dmdev, '/')) != NULL)
- slash++;
- else
- slash = dmdev;
- strncpy(slash, buf, PATH_MAX - (slash-dmdev));
+ names = (void *) names + nnext;
+ if (verbose > 3) {
+ printf("device-mapper: device: 0x%llx: name: [%s]\n",
+ names->dev, names->name);
+ }
+ nnext = names->next;
+ if (names->dev == device) {
+ strncpy(dmdev, names->name, PATH_MAX);
+ dmdev[PATH_MAX] = 0;
+ slash = dmdev;
+ break;
}
- if (realpath(dmdev, buf) == NULL)
- die("device-mapper: realpath(\"%s\") failed with: %s",dmdev,
- strerror(errno));
- strncpy(dmdev, buf, PATH_MAX);
- } while (result >= 0);
- dmdev[PATH_MAX] = 0;
+ } while (nnext);
+
+ if (!slash || !*slash)
+ die("device-mapper: name not found for device [%d]\n", device);
+
+ dm_task_destroy(dmt);
if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
die("device-mapper: dm_task_create(DM_DEVICE_TABLE) failed");
- slash = strrchr(dmdev, '/');
- if (slash)
- slash++;
- else
- slash = dmdev;
if (!dm_task_set_name(dmt, slash))
die("device-mapper: dm_task_set_name(\"%s\") failed",dmdev);
if (!dm_task_run(dmt))
@@ -971,7 +980,7 @@ void geo_get(GEOMETRY *geo,int device,in
if (p == NULL)
die("device-mapper: parse error in linear params (\"%s\")", params);
*p = 0;
- sprintf(buf, "/dev/%s", params); /* let's hope it's there */
+ snprintf(buf, sizeof buf, "/dev/%s", params); /* let's hope it's there */
if (stat(buf, &st) == 0) {
if (!S_ISBLK(st.st_mode))
die("device-mapper: %s is not a valid block device", buf);
@@ -979,7 +988,7 @@ void geo_get(GEOMETRY *geo,int device,in
minor = MINOR(st.st_rdev);
} else { /* let's try sysfs */
int dev;
- sprintf(buf, "/sys/block/%s/dev", params);
+ snprintf(buf, sizeof buf, "/sys/block/%s/dev", params);
file = fopen(buf, "r");
if (!file)
die("device-mapper: \"%s\" could not be opened. /sys mounted?", buf);
@@ -1005,19 +1014,13 @@ void geo_get(GEOMETRY *geo,int device,in
} while(next);
dm_task_destroy(dmt);
-
- dev_close(&dev);
}
if (!device)
die("device-mapper: Error finding real device");
geo->base_dev = device;
-
- for(i = 0; i < dm_major_nr; i++)
- if (MAJOR(device) == dm_major_list[i])
- break;
}
-#endif
+#endif /* LCF_DEVMAPPER */
if (verbose>=5) printf("geo_get: device %04X, all=%d\n", device, all);
#ifdef LCF_LVM