Sat Aug 27 17:07:28 2011 UTC ()
static. dead.


(joerg)
diff -r1.2 -r1.3 src/sbin/dmctl/dmctl.c

cvs diff -r1.2 -r1.3 src/sbin/dmctl/dmctl.c (expand / switch to unified diff)

--- src/sbin/dmctl/dmctl.c 2011/02/08 13:58:54 1.2
+++ src/sbin/dmctl/dmctl.c 2011/08/27 17:07:28 1.3
@@ -56,47 +56,46 @@ @@ -56,47 +56,46 @@
56 56
57#define DMCTL_CMD_REQ_NODEVNAME 0 /* Command do not require device name */ 57#define DMCTL_CMD_REQ_NODEVNAME 0 /* Command do not require device name */
58#define DMCTL_CMD_REQ_DEVNAME 1 /* Command require device name to work */ 58#define DMCTL_CMD_REQ_DEVNAME 1 /* Command require device name to work */
59#define DMCTL_CMD_REQ_NEWNAME 2 /* Command require device name and 59#define DMCTL_CMD_REQ_NEWNAME 2 /* Command require device name and
60 newname to work */ 60 newname to work */
61struct command { 61struct command {
62 const char *cmd_name; 62 const char *cmd_name;
63 const char *cmd_help; 63 const char *cmd_help;
64 const char *ioctl_cmd_name; 64 const char *ioctl_cmd_name;
65 int min_args; 65 int min_args;
66 int (*cmd_func)(int, char *[], libdm_task_t); 66 int (*cmd_func)(int, char *[], libdm_task_t);
67}; 67};
68 68
69int fd; /* file descriptor for device */ 69static const char *dvname; /* device name */
70const char *dvname; /* device name */ 70static const char *cmdname; /* command user issued */
71const char *cmdname; /* command user issued */ 
72 71
73static char * parse_stdin(char *); 72static char * parse_stdin(char *);
74 73
75static int dmctl_get_version(int, char *[], libdm_task_t); 74static int dmctl_get_version(int, char *[], libdm_task_t);
76static int dmctl_get_targets(int, char *[], libdm_task_t); 75static int dmctl_get_targets(int, char *[], libdm_task_t);
77static int dmctl_get_device_info(int, char *[], libdm_task_t); 76static int dmctl_get_device_info(int, char *[], libdm_task_t);
78static int dmctl_create_dev(int, char *[], libdm_task_t); 77static int dmctl_create_dev(int, char *[], libdm_task_t);
79static int dmctl_dev_rename(int, char *[], libdm_task_t); 78static int dmctl_dev_rename(int, char *[], libdm_task_t);
80static int dmctl_dev_remove(int, char *[], libdm_task_t); 79static int dmctl_dev_remove(int, char *[], libdm_task_t);
81static int dmctl_dev_resume(int, char *[], libdm_task_t); 80static int dmctl_dev_resume(int, char *[], libdm_task_t);
82static int dmctl_dev_suspend(int, char *[], libdm_task_t); 81static int dmctl_dev_suspend(int, char *[], libdm_task_t);
83static int dmctl_dev_deps(int, char *[], libdm_task_t); 82static int dmctl_dev_deps(int, char *[], libdm_task_t);
84static int dmctl_list_devices(int, char *[], libdm_task_t); 83static int dmctl_list_devices(int, char *[], libdm_task_t);
85static int dmctl_table_reload(int, char *[], libdm_task_t); 84static int dmctl_table_reload(int, char *[], libdm_task_t);
86static int dmctl_table_status(int, char *[], libdm_task_t); 85static int dmctl_table_status(int, char *[], libdm_task_t);
87void usage(void); 86__dead static void usage(void);
88 87
89struct command commands[] = { 88static struct command commands[] = {
90 { "version", 89 { "version",
91 "Print driver and lib version.", 90 "Print driver and lib version.",
92 NULL, DMCTL_CMD_REQ_NODEVNAME, 91 NULL, DMCTL_CMD_REQ_NODEVNAME,
93 dmctl_get_version }, 92 dmctl_get_version },
94 { "targets", 93 { "targets",
95 "List available kernel targets.", 94 "List available kernel targets.",
96 NULL, DMCTL_CMD_REQ_NODEVNAME, 95 NULL, DMCTL_CMD_REQ_NODEVNAME,
97 dmctl_get_targets }, 96 dmctl_get_targets },
98 { "create", 97 { "create",
99 "Create device with [dm device name].", 98 "Create device with [dm device name].",
100 NULL, DMCTL_CMD_REQ_DEVNAME, 99 NULL, DMCTL_CMD_REQ_DEVNAME,
101 dmctl_create_dev }, 100 dmctl_create_dev },
102 { "ls", 101 { "ls",
@@ -527,27 +526,27 @@ dmctl_table_status(int argc __unused, ch @@ -527,27 +526,27 @@ dmctl_table_status(int argc __unused, ch
527 libdm_table_get_start(table), 526 libdm_table_get_start(table),
528 libdm_table_get_length(table), 527 libdm_table_get_length(table),
529 libdm_table_get_target(table)); 528 libdm_table_get_target(table));
530 libdm_table_destroy(table); 529 libdm_table_destroy(table);
531 } 530 }
532 531
533 libdm_iter_destroy(iter); 532 libdm_iter_destroy(iter);
534 libdm_cmd_destroy(cmd); 533 libdm_cmd_destroy(cmd);
535 libdm_task_destroy(task); 534 libdm_task_destroy(task);
536 535
537 return 0; 536 return 0;
538} 537}
539 538
540void 539static void
541usage(void) 540usage(void)
542{ 541{
543 int i; 542 int i;
544 543
545 (void)fprintf(stderr, "usage: %s command [dm device name]\n" 544 (void)fprintf(stderr, "usage: %s command [dm device name]\n"
546 "Available commands are:\n ", getprogname()); 545 "Available commands are:\n ", getprogname());
547 for (i = 0; commands[i].cmd_name != NULL; i++) 546 for (i = 0; commands[i].cmd_name != NULL; i++)
548 (void)fprintf(stderr, "\t%s\t%s\n", commands[i].cmd_name, commands[i].cmd_help); 547 (void)fprintf(stderr, "\t%s\t%s\n", commands[i].cmd_name, commands[i].cmd_help);
549 exit(EXIT_FAILURE); 548 exit(EXIT_FAILURE);
550} 549}
551 550
552static char * 551static char *
553parse_stdin(char *file_path) 552parse_stdin(char *file_path)