Module Name:    src
Committed By:   haad
Date:           Tue Jun  9 18:29:09 UTC 2009

Modified Files:
        src/external/gpl2/lvm2/dist/libdm/ioctl: libdm_netbsd.c

Log Message:
Create default target_params parse routine which is called when we doesn't
find name of a target in known target list. This routine will pass whole param
string in a dictionary with key called params.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c
diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.2 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.3
--- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c:1.2	Fri Jun  5 19:57:25 2009
+++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c	Tue Jun  9 18:29:09 2009
@@ -1,4 +1,4 @@
-/*      $NetBSD: libdm_netbsd.c,v 1.2 2009/06/05 19:57:25 haad Exp $        */
+/*      $NetBSD: libdm_netbsd.c,v 1.3 2009/06/09 18:29:09 haad Exp $        */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@
 static prop_dictionary_t dm_parse_mirror(char *);
 static prop_dictionary_t dm_parse_snapshot(char *);
 static prop_dictionary_t dm_parse_snapshot_origin(char *);
+static prop_dictionary_t dm_parse_default(char *);
 
 static struct nbsd_dm_target_param dmt_parse[] = {
 	{"linear", dm_parse_linear},
@@ -104,8 +105,6 @@
 	dict = NULL;
 	slen = strlen(target);
 
-	printf("Parsing target %s, string %s\n", target, params);
-
 	/* copy parameter string to new buffer */
 	param = dm_malloc(strlen(params) * sizeof(char));
 	strlcpy(param, params, strlen(params)+1);
@@ -119,11 +118,10 @@
 		if (strncmp(target, dmt_parse[i].name, slen) == 0)
 			break;
 	}
-	
-        if (dmt_parse[i].name == NULL)
-                return NULL;
 
-	printf("target found %s, params %s\n", dmt_parse[i].name, params);
+	/* Create default dictionary with key params and with string as a value */
+        if (dmt_parse[i].name == NULL)
+		dm_parse_default(param);
 	
 	dict = dmt_parse[i].parse(param);
 	
@@ -157,9 +155,7 @@
 		if (**ap != '\0')
 	        	ap++;
 	}
-	printf("Linear target params parsing routine called %s -- %d \n", 
-		argv[1], strtol(argv[1], (char **)NULL, 10));
-	
+		
 	prop_dictionary_set_cstring(dict, DM_TARGET_LINEAR_DEVICE, argv[0]);
 	prop_dictionary_set_uint64(dict, DM_TARGET_LINEAR_OFFSET, strtoll(argv[1], (char **)NULL, 10));
 		
@@ -192,7 +188,6 @@
 		if (**ap != '\0')
 	        	ap++;
 	}
-	printf("Stripe target params parsing routine called\n");
 	
 	prop_dictionary_set_uint64(dict, DM_TARGET_STRIPE_STRIPES, 
 		strtol(argv[0], (char **)NULL, 10));
@@ -253,6 +248,18 @@
 	return dict;
 }
 
+static prop_dictionary_t 
+dm_parse_default(char *params)
+{
+	prop_dictionary_t dict;
+	
+	dict = prop_dictionary_create();
+
+	prop_dictionary_set_cstring(dict, DM_TABLE_PARAMS, params);
+	
+	return dict;
+}
+
 int
 nbsd_get_dm_major(uint32_t *major,  int type)
 {

Reply via email to