sys/dev/disk/dm: Don't expose cmd_function in header
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 20 Oct 2015 13:36:53 +0000 (22:36 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 20 Oct 2015 14:52:17 +0000 (23:52 +0900)
This struct is necessary only for core part of ioctl where
it needs to translate C string to an appropriate handler.
It just doesn't need to expose everything in dm.h.

sys/dev/disk/dm/device-mapper.c
sys/dev/disk/dm/dm.h

index 674a80d..5ad4f01 100644 (file)
@@ -100,6 +100,12 @@ static moduledata_t dm_mod = {
 DECLARE_MODULE(dm, dm_mod, SI_SUB_RAID, SI_ORDER_ANY);
 MODULE_VERSION(dm, 1);
 
+/*
+ * This structure is used to translate command sent to kernel driver in
+ * <key>command</key>
+ * <value></value>
+ * to function
+ */
 /*
  * This array is used to translate cmd to function pointer.
  *
@@ -107,26 +113,28 @@ MODULE_VERSION(dm, 1);
  * names for one IOCTL call because libdevmapper do another thing
  * then. When I run "info" or "mknodes" libdevmapper will send same
  * ioctl to kernel but will do another things in userspace.
- *
  */
-static struct cmd_function cmd_fn[] = {
-               { .cmd = "version", .fn = NULL},
-               { .cmd = "targets", .fn = dm_list_versions_ioctl},
-               { .cmd = "create",  .fn = dm_dev_create_ioctl},
-               { .cmd = "info",    .fn = dm_dev_status_ioctl},
-               { .cmd = "mknodes", .fn = dm_dev_status_ioctl},
-               { .cmd = "names",   .fn = dm_dev_list_ioctl},
-               { .cmd = "suspend", .fn = dm_dev_suspend_ioctl},
-               { .cmd = "remove",  .fn = dm_dev_remove_ioctl},
-               { .cmd = "remove_all", .fn = dm_dev_remove_all_ioctl},
-               { .cmd = "rename",  .fn = dm_dev_rename_ioctl},
-               { .cmd = "resume",  .fn = dm_dev_resume_ioctl},
-               { .cmd = "clear",   .fn = dm_table_clear_ioctl},
-               { .cmd = "deps",    .fn = dm_table_deps_ioctl},
-               { .cmd = "reload",  .fn = dm_table_load_ioctl},
-               { .cmd = "status",  .fn = dm_table_status_ioctl},
-               { .cmd = "table",   .fn = dm_table_status_ioctl},
-               { .cmd = "message", .fn = dm_message_ioctl},
+static struct cmd_function {
+       const char *cmd;
+       int (*fn)(prop_dictionary_t);
+} cmd_fn[] = {
+       {.cmd = "version",    .fn = NULL},
+       {.cmd = "targets",    .fn = dm_list_versions_ioctl},
+       {.cmd = "create",     .fn = dm_dev_create_ioctl},
+       {.cmd = "info",       .fn = dm_dev_status_ioctl},
+       {.cmd = "mknodes",    .fn = dm_dev_status_ioctl},
+       {.cmd = "names",      .fn = dm_dev_list_ioctl},
+       {.cmd = "suspend",    .fn = dm_dev_suspend_ioctl},
+       {.cmd = "remove",     .fn = dm_dev_remove_ioctl},
+       {.cmd = "remove_all", .fn = dm_dev_remove_all_ioctl},
+       {.cmd = "rename",     .fn = dm_dev_rename_ioctl},
+       {.cmd = "resume",     .fn = dm_dev_resume_ioctl},
+       {.cmd = "clear",      .fn = dm_table_clear_ioctl},
+       {.cmd = "deps",       .fn = dm_table_deps_ioctl},
+       {.cmd = "reload",     .fn = dm_table_load_ioctl},
+       {.cmd = "status",     .fn = dm_table_status_ioctl},
+       {.cmd = "table",      .fn = dm_table_status_ioctl},
+       {.cmd = "message",    .fn = dm_message_ioctl},
 };
 
 /* New module handle routine */
index 11999fb..a0b19f4 100644 (file)
@@ -198,17 +198,6 @@ typedef struct dm_target {
 
 /* Interface structures */
 
-/*
- * This structure is used to translate command sent to kernel driver in
- * <key>command</key>
- * <value></value>
- * to function which I can call.
- */
-struct cmd_function {
-       const char *cmd;
-       int  (*fn)(prop_dictionary_t);
-};
-
 /* device-mapper */
 void dmsetdiskinfo(struct disk *, dm_table_head_t *);