chiark / gitweb /
[PATCH] extras multipath update
[elogind.git] / extras / multipath / unsused.c
1 static int
2 del_map(char * str) {
3         struct dm_task *dmt;
4
5         if (!(dmt = dm_task_create(DM_DEVICE_REMOVE)))
6                 return 0;
7         if (!dm_task_set_name(dmt, str))
8                 goto delout;
9         if (!dm_task_run(dmt))
10                 goto delout;
11
12         printf("Deleted device map : %s\n", str);
13
14         delout:
15         dm_task_destroy(dmt);
16         return 1;
17 }
18
19 get_table(const char * str)
20 {
21         int r = 0;
22         struct dm_task *dmt;
23         void *next = NULL;
24         uint64_t start, length;
25         char *target_type = NULL;
26         char *params;
27
28         if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
29                 return 0;
30
31         if (!dm_task_set_name(dmt, str))
32                 goto out;
33
34         if (!dm_task_run(dmt))
35                 goto out;
36
37         do {
38                 next = dm_get_next_target(dmt, next, &start, &length,
39                                           &target_type, &params);
40                 if (target_type) {
41                         printf("%" PRIu64 " %" PRIu64 " %s %s\n",
42                                start, length, target_type, params);
43                 }
44         } while (next);
45
46         r = 1;
47
48       out:
49         dm_task_destroy(dmt);
50         return r;
51
52 }