Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dm dm: Refactor dmioctl()



details:   https://anonhg.NetBSD.org/src/rev/b307c50d6bef
branches:  trunk
changeset: 1005756:b307c50d6bef
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Thu Dec 19 15:57:46 2019 +0000

description:
dm: Refactor dmioctl()

More readable without dm_ioctl_switch() as a separate function.

diffstat:

 sys/dev/dm/device-mapper.c |  34 ++++++++++------------------------
 1 files changed, 10 insertions(+), 24 deletions(-)

diffs (62 lines):

diff -r b81028739638 -r b307c50d6bef sys/dev/dm/device-mapper.c
--- a/sys/dev/dm/device-mapper.c        Thu Dec 19 15:54:21 2019 +0000
+++ b/sys/dev/dm/device-mapper.c        Thu Dec 19 15:57:46 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: device-mapper.c,v 1.56 2019/12/19 15:34:54 tkusumi Exp $ */
+/*        $NetBSD: device-mapper.c,v 1.57 2019/12/19 15:57:46 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -67,7 +67,6 @@
 
 static int dm_cmd_to_fun(prop_dictionary_t);
 static int disk_ioctl_switch(dev_t, unsigned long, void *);
-static int dm_ioctl_switch(unsigned long);
 static void dmminphys(struct buf *);
 
 /* CF attach/detach functions used for power management */
@@ -356,10 +355,15 @@
        if ((r = disk_ioctl_switch(dev, cmd, data)) == ENOTTY) {
                struct plistref *pref = (struct plistref *)data;
 
-               /* Check if we were called with NETBSD_DM_IOCTL ioctl
-                  otherwise quit. */
-               if ((r = dm_ioctl_switch(cmd)) != 0)
-                       return r;
+               switch(cmd) {
+               case NETBSD_DM_IOCTL:
+                       aprint_debug("dm NETBSD_DM_IOCTL called\n");
+                       break;
+               default:
+                       aprint_debug("dm unknown ioctl called\n");
+                       return ENOTTY;
+                       break; /* NOT REACHED */
+               }
 
                if ((r = prop_dictionary_copyin_ioctl(pref, cmd, &dm_dict_in))
                    != 0)
@@ -411,24 +415,6 @@
        return cmd_fn[i].fn(dm_dict);
 }
 
-/* Call apropriate ioctl handler function. */
-static int
-dm_ioctl_switch(unsigned long cmd)
-{
-
-       switch(cmd) {
-       case NETBSD_DM_IOCTL:
-               aprint_debug("dm NETBSD_DM_IOCTL called\n");
-               break;
-       default:
-               aprint_debug("dm unknown ioctl called\n");
-               return ENOTTY;
-               break; /* NOT REACHED */
-       }
-
-       return 0;
-}
-
 /*
  * Check for disk specific ioctls.
  */



Home | Main Index | Thread Index | Old Index