r += add_key(keys, "switchgroup", SWITCH, 0);
r += add_key(keys, "suspend", SUSPEND, 0);
r += add_key(keys, "resume", RESUME, 0);
+ r += add_key(keys, "reinstate", REINSTATE, 0);
+ r += add_key(keys, "fail", FAIL, 0);
r += add_key(keys, "paths", PATHS, 0);
r += add_key(keys, "maps", MAPS, 0);
r += add_key(keys, "path", PATH, 1);
__SWITCH,
__SUSPEND,
__RESUME,
+ __REINSTATE,
+ __FAIL,
__PATHS,
__MAPS,
__PATH,
#define SWITCH (1 << __SWITCH)
#define SUSPEND (1 << __SUSPEND)
#define RESUME (1 << __RESUME)
+#define REINSTATE (1 << __REINSTATE)
+#define FAIL (1 << __FAIL)
#define PATHS (1 << __PATHS)
#define MAPS (1 << __MAPS)
#define PATH (1 << __PATH)
mpp->dmstate = MAPSTATE_ACTIVE;
return 0;
}
+
+int
+cli_reinstate(void * v, char ** reply, int * len, void * data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+ char * param = get_keyparam(v, PATH);
+ struct path * pp;
+
+ pp = find_path_by_dev(vecs->pathvec, param);
+
+ if (!pp)
+ pp = find_path_by_devt(vecs->pathvec, param);
+
+ if (!pp || !pp->mpp || !pp->mpp->alias)
+ return 1;
+
+ return dm_reinstate(pp->mpp->alias, pp->dev_t);
+}
+
+int
+cli_fail(void * v, char ** reply, int * len, void * data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+ char * param = get_keyparam(v, PATH);
+ struct path * pp;
+
+ pp = find_path_by_dev(vecs->pathvec, param);
+
+ if (!pp)
+ pp = find_path_by_devt(vecs->pathvec, param);
+
+ if (!pp || !pp->mpp || !pp->mpp->alias)
+ return 1;
+
+ return dm_fail_path(pp->mpp->alias, pp->dev_t);
+}
int cli_reconfigure(void * v, char ** reply, int * len, void * data);
int cli_suspend(void * v, char ** reply, int * len, void * data);
int cli_resume(void * v, char ** reply, int * len, void * data);
+int cli_reinstate(void * v, char ** reply, int * len, void * data);
+int cli_fail(void * v, char ** reply, int * len, void * data);
add_handler(RECONFIGURE, cli_reconfigure);
add_handler(SUSPEND+MAP, cli_suspend);
add_handler(RESUME+MAP, cli_resume);
+ add_handler(REINSTATE+PATH, cli_reinstate);
+ add_handler(FAIL+PATH, cli_fail);
uxsock_listen(&uxsock_trigger, ap);