]> sourceware.org Git - dm.git/commitdiff
DM_EXISTS_FLAG replaced by ENXIO
authorAlasdair Kergon <agk@redhat.com>
Thu, 24 Apr 2003 16:08:18 +0000 (16:08 +0000)
committerAlasdair Kergon <agk@redhat.com>
Thu, 24 Apr 2003 16:08:18 +0000 (16:08 +0000)
lib/ioctl/libdevmapper.c

index a9e257897be3c49a5a3da0a1982fa25bca97dddb..e2558c99122f4d08ff4a0f417eeed0ef2e2e93f1 100644 (file)
@@ -63,6 +63,11 @@ static struct cmd_data _cmd_data_v3[] = {
 #define ALIGNMENT_V1 sizeof(int)
 #define ALIGNMENT 8
 
+/* FIXME Rejig library to record & use errno instead */
+#ifndef DM_EXISTS_FLAG
+#  define DM_EXISTS_FLAG 0x00000004
+#endif
+
 static void *_align(void *ptr, unsigned int a)
 {
        register unsigned long agn = --a;
@@ -740,9 +745,14 @@ int dm_task_run(struct dm_task *dmt)
        if (dmt->type == DM_DEVICE_TABLE)
                dmi->flags |= DM_STATUS_TABLE_FLAG;
 
+       dmi->flags |= DM_EXISTS_FLAG;   /* FIXME */
        log_debug("dm %s %s %s %s", _cmd_data_v3[dmt->type].name, dmi->name,
                  dmi->uuid, dmt->newname ? dmt->newname : "");
        if (ioctl(fd, command, dmi) < 0) {
+               if (errno == ENXIO && dmt->type == DM_DEVICE_INFO) {
+                       dmi->flags &= ~DM_EXISTS_FLAG;  /* FIXME */
+                       goto ignore_error;
+               }
                if (_log_suppress)
                        log_verbose("device-mapper ioctl cmd %d failed: %s",
                                    _IOC_NR(command), strerror(errno));
@@ -752,6 +762,7 @@ int dm_task_run(struct dm_task *dmt)
                goto bad;
        }
 
+      ignore_error:
        switch (dmt->type) {
        case DM_DEVICE_CREATE:
                add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev));
This page took 0.02583 seconds and 5 git commands to generate.