[lib] use explicit names dm_simplecmd_{flush,noflush}
authorChristophe Varoqui <christophe.varoqui@free.fr>
Thu, 2 Apr 2009 21:17:29 +0000 (23:17 +0200)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Thu, 2 Apr 2009 21:17:29 +0000 (23:17 +0200)
easier than the magic value used in static dm_simple_cmd to drive
the flush/noflush behaviour

libmultipath/configure.c
libmultipath/devmapper.c
libmultipath/devmapper.h
multipathd/cli_handlers.c

index ed20f37..eb2917c 100644 (file)
@@ -353,7 +353,7 @@ domap (struct multipath * mpp)
 
        case ACT_RELOAD:
                r = (dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL)
-                    && dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 1));
+                    && dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias));
                break;
 
        case ACT_RESIZE:
@@ -361,7 +361,7 @@ domap (struct multipath * mpp)
                if (!r)
                        r = dm_addmap_reload(mpp->alias, mpp->params, mpp->size, NULL);
                if (r)
-                       r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, 0);
+                       r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
                break;
 
        case ACT_RENAME:
index 125d394..0282e52 100644 (file)
@@ -149,7 +149,7 @@ dm_prereq (void)
        return dm_drvprereq(TGT_MPATH);
 }
 
-extern int
+static int
 dm_simplecmd (int task, const char *name, int no_flush) {
        int r = 0;
        struct dm_task *dmt;
@@ -175,6 +175,16 @@ dm_simplecmd (int task, const char *name, int no_flush) {
 }
 
 extern int
+dm_simplecmd_flush (int task, const char *name) {
+       return dm_simplecmd(task, name, 1);
+}
+
+extern int
+dm_simplecmd_noflush (int task, const char *name) {
+       return dm_simplecmd(task, name, 0);
+}
+
+extern int
 dm_addmap (int task, const char *name, const char *target,
           const char *params, unsigned long long size, const char *uuid,
           int ro) {
@@ -540,7 +550,7 @@ dm_flush_map (const char * mapname)
                return 1;
        }
 
-       r = dm_simplecmd(DM_DEVICE_REMOVE, mapname, 0);
+       r = dm_simplecmd_noflush(DM_DEVICE_REMOVE, mapname);
 
        if (r) {
                condlog(4, "multipath map %s removed", mapname);
@@ -939,7 +949,7 @@ dm_remove_partmaps (const char * mapname)
                                 */
                                condlog(4, "partition map %s removed",
                                        names->name);
-                               dm_simplecmd(DM_DEVICE_REMOVE, names->name, 0);
+                               dm_simplecmd_noflush(DM_DEVICE_REMOVE, names->name);
                   }
 
                next = names->next;
index b262efa..984ba39 100644 (file)
@@ -3,7 +3,8 @@
 
 void dm_init(void);
 int dm_prereq (void);
-int dm_simplecmd (int, const char *, int);
+int dm_simplecmd_flush (int, const char *);
+int dm_simplecmd_noflush (int, const char *);
 int dm_addmap_create (const char *, const char *,
                       unsigned long long size, const char *uuid);
 int dm_addmap_create_ro (const char *, const char *,
index b352c62..93ef741 100644 (file)
@@ -513,7 +513,7 @@ cli_suspend(void * v, char ** reply, int * len, void * data)
 {
        struct vectors * vecs = (struct vectors *)data;
        char * param = get_keyparam(v, MAP);
-       int r = dm_simplecmd(DM_DEVICE_SUSPEND, param, 1);
+       int r = dm_simplecmd_flush(DM_DEVICE_SUSPEND, param);
 
        condlog(2, "%s: suspend (operator)", param);
 
@@ -534,7 +534,7 @@ cli_resume(void * v, char ** reply, int * len, void * data)
 {
        struct vectors * vecs = (struct vectors *)data;
        char * param = get_keyparam(v, MAP);
-       int r = dm_simplecmd(DM_DEVICE_RESUME, param, 1);
+       int r = dm_simplecmd_flush(DM_DEVICE_RESUME, param);
 
        condlog(2, "%s: resume (operator)", param);