extern int
dm_addmap (int task, const char *name, const char *target,
- const char *params, unsigned long long size) {
+ const char *params, unsigned long long size, const char *uuid) {
int r = 0;
struct dm_task *dmt;
if (!dm_task_add_target (dmt, 0, size, target, params))
goto addout;
+ if (uuid && !dm_task_set_uuid(dmt, uuid))
+ goto addout;
+
dm_task_no_open_count(dmt);
r = dm_task_run (dmt);
}
extern int
+dm_get_uuid(char *name, char *uuid)
+{
+ struct dm_task *dmt;
+ const char *uuidtmp;
+
+ dmt = dm_task_create(DM_DEVICE_INFO);
+ if (!dmt)
+ return 1;
+
+ if (!dm_task_set_name (dmt, name))
+ goto uuidout;
+
+ if (!dm_task_run(dmt))
+ goto uuidout;
+
+ uuidtmp = dm_task_get_uuid(dmt);
+ if (uuidtmp)
+ strcpy(uuid, uuidtmp);
+ else
+ uuid[0] = '\0';
+
+uuidout:
+ dm_task_destroy(dmt);
+
+ return 0;
+}
+
+extern int
dm_get_status(char * name, char * outstatus)
{
int r = 1;
if (dm_get_status(names->name, mpp->status))
goto out1;
+ dm_get_uuid(names->name, mpp->wwid);
+
mpp->alias = MALLOC(strlen(names->name) + 1);
if (!mpp->alias)
int dm_prereq (char *, int, int, int);
int dm_simplecmd (int, const char *);
int dm_addmap (int, const char *, const char *, const char *,
- unsigned long long);
+ unsigned long long, const char *uuid);
int dm_map_present (char *);
int dm_get_map(char *, unsigned long long *, char *);
int dm_get_status(char *, char *);
*/
dm_log_init_verbose(0);
- r = dm_addmap(op, mpp->alias, DEFAULT_TARGET, mpp->params, mpp->size);
+ r = dm_addmap(op, mpp->alias, DEFAULT_TARGET, mpp->params, mpp->size, mpp->wwid);
if (r == 0)
dm_simplecmd(DM_DEVICE_REMOVE, mpp->alias);