Module Name: src
Committed By: tkusumi
Date: Thu Dec 19 15:57:46 UTC 2019
Modified Files:
src/sys/dev/dm: device-mapper.c
Log Message:
dm: Refactor dmioctl()
More readable without dm_ioctl_switch() as a separate function.
To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/dm/device-mapper.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.56 src/sys/dev/dm/device-mapper.c:1.57
--- src/sys/dev/dm/device-mapper.c:1.56 Thu Dec 19 15:34:54 2019
+++ src/sys/dev/dm/device-mapper.c Thu Dec 19 15:57:46 2019
@@ -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 void dm_doinit(void);
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 @@ dmioctl(dev_t dev, const u_long cmd, voi
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 @@ dm_cmd_to_fun(prop_dictionary_t dm_dict)
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.
*/