| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: device-mapper.c,v 1.46 2019/12/06 16:33:47 tkusumi Exp $ */ | | 1 | /* $NetBSD: device-mapper.c,v 1.47 2019/12/07 16:13:39 tkusumi Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Adam Hamsik. | | 8 | * by Adam Hamsik. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -139,27 +139,27 @@ static const struct cmd_function { | | | @@ -139,27 +139,27 @@ static const struct cmd_function { |
139 | { .cmd = "create", .fn = dm_dev_create_ioctl, .allowed = 0 }, | | 139 | { .cmd = "create", .fn = dm_dev_create_ioctl, .allowed = 0 }, |
140 | { .cmd = "info", .fn = dm_dev_status_ioctl, .allowed = 1 }, | | 140 | { .cmd = "info", .fn = dm_dev_status_ioctl, .allowed = 1 }, |
141 | { .cmd = "mknodes", .fn = dm_dev_status_ioctl, .allowed = 1 }, | | 141 | { .cmd = "mknodes", .fn = dm_dev_status_ioctl, .allowed = 1 }, |
142 | { .cmd = "names", .fn = dm_dev_list_ioctl, .allowed = 1 }, | | 142 | { .cmd = "names", .fn = dm_dev_list_ioctl, .allowed = 1 }, |
143 | { .cmd = "suspend", .fn = dm_dev_suspend_ioctl, .allowed = 0 }, | | 143 | { .cmd = "suspend", .fn = dm_dev_suspend_ioctl, .allowed = 0 }, |
144 | { .cmd = "remove", .fn = dm_dev_remove_ioctl, .allowed = 0 }, | | 144 | { .cmd = "remove", .fn = dm_dev_remove_ioctl, .allowed = 0 }, |
145 | { .cmd = "rename", .fn = dm_dev_rename_ioctl, .allowed = 0 }, | | 145 | { .cmd = "rename", .fn = dm_dev_rename_ioctl, .allowed = 0 }, |
146 | { .cmd = "resume", .fn = dm_dev_resume_ioctl, .allowed = 0 }, | | 146 | { .cmd = "resume", .fn = dm_dev_resume_ioctl, .allowed = 0 }, |
147 | { .cmd = "clear", .fn = dm_table_clear_ioctl, .allowed = 0 }, | | 147 | { .cmd = "clear", .fn = dm_table_clear_ioctl, .allowed = 0 }, |
148 | { .cmd = "deps", .fn = dm_table_deps_ioctl, .allowed = 1 }, | | 148 | { .cmd = "deps", .fn = dm_table_deps_ioctl, .allowed = 1 }, |
149 | { .cmd = "reload", .fn = dm_table_load_ioctl, .allowed = 0 }, | | 149 | { .cmd = "reload", .fn = dm_table_load_ioctl, .allowed = 0 }, |
150 | { .cmd = "status", .fn = dm_table_status_ioctl, .allowed = 1 }, | | 150 | { .cmd = "status", .fn = dm_table_status_ioctl, .allowed = 1 }, |
151 | { .cmd = "table", .fn = dm_table_status_ioctl, .allowed = 1 }, | | 151 | { .cmd = "table", .fn = dm_table_status_ioctl, .allowed = 1 }, |
152 | { .cmd = NULL, .fn = NULL, .allowed = 0 } | | 152 | { .cmd = NULL, .fn = NULL, .allowed = 0 }, |
153 | }; | | 153 | }; |
154 | | | 154 | |
155 | #ifdef _MODULE | | 155 | #ifdef _MODULE |
156 | #include <sys/module.h> | | 156 | #include <sys/module.h> |
157 | | | 157 | |
158 | /* Autoconf defines */ | | 158 | /* Autoconf defines */ |
159 | CFDRIVER_DECL(dm, DV_DISK, NULL); | | 159 | CFDRIVER_DECL(dm, DV_DISK, NULL); |
160 | | | 160 | |
161 | MODULE(MODULE_CLASS_DRIVER, dm, "dk_subr"); | | 161 | MODULE(MODULE_CLASS_DRIVER, dm, "dk_subr"); |
162 | | | 162 | |
163 | /* New module handle routine */ | | 163 | /* New module handle routine */ |
164 | static int | | 164 | static int |
165 | dm_modcmd(modcmd_t cmd, void *arg) | | 165 | dm_modcmd(modcmd_t cmd, void *arg) |
| @@ -421,38 +421,37 @@ dm_cmd_to_fun(prop_dictionary_t dm_dict) | | | @@ -421,38 +421,37 @@ dm_cmd_to_fun(prop_dictionary_t dm_dict) |
421 | return r; | | 421 | return r; |
422 | } | | 422 | } |
423 | | | 423 | |
424 | /* Call apropriate ioctl handler function. */ | | 424 | /* Call apropriate ioctl handler function. */ |
425 | static int | | 425 | static int |
426 | dm_ioctl_switch(u_long cmd) | | 426 | dm_ioctl_switch(u_long cmd) |
427 | { | | 427 | { |
428 | | | 428 | |
429 | switch(cmd) { | | 429 | switch(cmd) { |
430 | case NETBSD_DM_IOCTL: | | 430 | case NETBSD_DM_IOCTL: |
431 | aprint_debug("dm NETBSD_DM_IOCTL called\n"); | | 431 | aprint_debug("dm NETBSD_DM_IOCTL called\n"); |
432 | break; | | 432 | break; |
433 | default: | | 433 | default: |
434 | aprint_debug("dm unknown ioctl called\n"); | | 434 | aprint_debug("dm unknown ioctl called\n"); |
435 | return ENOTTY; | | 435 | return ENOTTY; |
436 | break; /* NOT REACHED */ | | 436 | break; /* NOT REACHED */ |
437 | } | | 437 | } |
438 | | | 438 | |
439 | return 0; | | 439 | return 0; |
440 | } | | 440 | } |
441 | | | 441 | |
442 | /* | | 442 | /* |
443 | * Check for disk specific ioctls. | | 443 | * Check for disk specific ioctls. |
444 | */ | | 444 | */ |
445 | | | | |
446 | static int | | 445 | static int |
447 | disk_ioctl_switch(dev_t dev, u_long cmd, void *data) | | 446 | disk_ioctl_switch(dev_t dev, u_long cmd, void *data) |
448 | { | | 447 | { |
449 | dm_dev_t *dmv; | | 448 | dm_dev_t *dmv; |
450 | | | 449 | |
451 | /* disk ioctls make sense only on block devices */ | | 450 | /* disk ioctls make sense only on block devices */ |
452 | if (minor(dev) == 0) | | 451 | if (minor(dev) == 0) |
453 | return ENOTTY; | | 452 | return ENOTTY; |
454 | | | 453 | |
455 | switch(cmd) { | | 454 | switch(cmd) { |
456 | case DIOCGWEDGEINFO: | | 455 | case DIOCGWEDGEINFO: |
457 | { | | 456 | { |
458 | struct dkwedge_info *dkw = (void *) data; | | 457 | struct dkwedge_info *dkw = (void *) data; |