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: Test # of args in target's ->init()
details: https://anonhg.NetBSD.org/src/rev/2596c6df89bc
branches: trunk
changeset: 466349:2596c6df89bc
user: tkusumi <tkusumi%NetBSD.org@localhost>
date: Wed Dec 18 14:31:35 2019 +0000
description:
dm: Test # of args in target's ->init()
The # of args is part of target's spec.
Both Linux kernel and DragonFlyBSD test argc on ctr/init.
diffstat:
sys/dev/dm/dm_target_error.c | 9 +++++++--
sys/dev/dm/dm_target_linear.c | 8 +++-----
sys/dev/dm/dm_target_stripe.c | 10 ++++------
sys/dev/dm/dm_target_zero.c | 9 +++++++--
4 files changed, 21 insertions(+), 15 deletions(-)
diffs (125 lines):
diff -r 1e2ff625f2b0 -r 2596c6df89bc sys/dev/dm/dm_target_error.c
--- a/sys/dev/dm/dm_target_error.c Wed Dec 18 13:25:58 2019 +0000
+++ b/sys/dev/dm/dm_target_error.c Wed Dec 18 14:31:35 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_error.c,v 1.25 2019/12/16 14:26:23 tkusumi Exp $ */
+/* $NetBSD: dm_target_error.c,v 1.26 2019/12/18 14:31:35 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.25 2019/12/16 14:26:23 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.26 2019/12/18 14:31:35 tkusumi Exp $");
/*
* This file implements initial version of device-mapper error target.
@@ -101,6 +101,11 @@
dm_target_error_init(dm_table_entry_t *table_en, int argc, char **argv)
{
+ if (argc != 0) {
+ printf("Error target takes 0 args, %d given\n", argc);
+ return EINVAL;
+ }
+
printf("Error target init function called!!\n");
table_en->target_config = NULL;
diff -r 1e2ff625f2b0 -r 2596c6df89bc sys/dev/dm/dm_target_linear.c
--- a/sys/dev/dm/dm_target_linear.c Wed Dec 18 13:25:58 2019 +0000
+++ b/sys/dev/dm/dm_target_linear.c Wed Dec 18 14:31:35 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_linear.c,v 1.32 2019/12/15 16:14:27 tkusumi Exp $ */
+/* $NetBSD: dm_target_linear.c,v 1.33 2019/12/18 14:31:35 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.32 2019/12/15 16:14:27 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.33 2019/12/18 14:31:35 tkusumi Exp $");
/*
* This file implements initial version of device-mapper dklinear target.
@@ -59,12 +59,10 @@
dm_target_linear_config_t *tlc;
dm_pdev_t *dmp;
- /*
if (argc != 2) {
- printf("Linear target takes 2 args\n");
+ printf("Linear target takes 2 args, %d given\n", argc);
return EINVAL;
}
- */
aprint_debug("Linear target init function called %s--%s!!\n",
argv[0], argv[1]);
diff -r 1e2ff625f2b0 -r 2596c6df89bc sys/dev/dm/dm_target_stripe.c
--- a/sys/dev/dm/dm_target_stripe.c Wed Dec 18 13:25:58 2019 +0000
+++ b/sys/dev/dm/dm_target_stripe.c Wed Dec 18 14:31:35 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.39 2019/12/15 16:14:27 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.40 2019/12/18 14:31:35 tkusumi Exp $*/
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.39 2019/12/15 16:14:27 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.40 2019/12/18 14:31:35 tkusumi Exp $");
/*
* This file implements initial version of device-mapper stripe target.
@@ -139,12 +139,10 @@
dm_target_stripe_config_t *tsc;
int strpc, strpi;
- /*
- if (argc < 4) {
- printf("Stripe target takes 4 or more args\n");
+ if (argc < 2) {
+ printf("Stripe target takes at least 2 args, %d given\n", argc);
return EINVAL;
}
- */
printf("Stripe target init function called!!\n");
printf("Stripe target chunk size %s number of stripes %s\n",
diff -r 1e2ff625f2b0 -r 2596c6df89bc sys/dev/dm/dm_target_zero.c
--- a/sys/dev/dm/dm_target_zero.c Wed Dec 18 13:25:58 2019 +0000
+++ b/sys/dev/dm/dm_target_zero.c Wed Dec 18 14:31:35 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_zero.c,v 1.27 2019/12/16 14:26:23 tkusumi Exp $ */
+/* $NetBSD: dm_target_zero.c,v 1.28 2019/12/18 14:31:35 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.27 2019/12/16 14:26:23 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.28 2019/12/18 14:31:35 tkusumi Exp $");
/*
* This file implements initial version of device-mapper zero target.
@@ -104,6 +104,11 @@
dm_target_zero_init(dm_table_entry_t *table_en, int argc, char **argv)
{
+ if (argc != 0) {
+ printf("Zero target takes 0 args, %d given\n", argc);
+ return EINVAL;
+ }
+
printf("Zero target init function called!!\n");
table_en->target_config = NULL;
Home |
Main Index |
Thread Index |
Old Index