Source-Changes-HG archive

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

[src/trunk]: src/external/gpl2/lvm2/dist Revert my commit which added knowled...



details:   https://anonhg.NetBSD.org/src/rev/c0abc57d6fbc
branches:  trunk
changeset: 749526:c0abc57d6fbc
user:      haad <haad%NetBSD.org@localhost>
date:      Tue Dec 01 23:11:17 2009 +0000

description:
Revert my commit which added knowledge about dm targets to libdevmapper,
this breaks abstraction. Because only lvmtools/lvmlib and device-mapper can
have knowledge about target mapping and libdevmapper only passes requests
from lvmtools to kernel and back. Bump major library and driver version.

Requested by: yamt@

diffstat:

 external/gpl2/lvm2/dist/include/dm-ioctl.h             |    4 +-
 external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c |   10 +-
 external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c     |  208 +----------------
 3 files changed, 5 insertions(+), 217 deletions(-)

diffs (292 lines):

diff -r 3abe9cf141a1 -r c0abc57d6fbc external/gpl2/lvm2/dist/include/dm-ioctl.h
--- a/external/gpl2/lvm2/dist/include/dm-ioctl.h        Tue Dec 01 22:36:31 2009 +0000
+++ b/external/gpl2/lvm2/dist/include/dm-ioctl.h        Tue Dec 01 23:11:17 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dm-ioctl.h,v 1.2 2009/06/05 20:11:21 haad Exp $        */
+/*     $NetBSD: dm-ioctl.h,v 1.3 2009/12/01 23:11:17 haad Exp $        */
 
 /*
  * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
@@ -259,7 +259,7 @@
 #define DM_TARGET_MSG   _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY    _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
-#define DM_VERSION_MAJOR       4
+#define DM_VERSION_MAJOR       6
 #define DM_VERSION_MINOR       15
 #define DM_VERSION_PATCHLEVEL  0
 #define DM_VERSION_EXTRA       "-ioctl (2008-04-23)"
diff -r 3abe9cf141a1 -r c0abc57d6fbc external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c
--- a/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c    Tue Dec 01 22:36:31 2009 +0000
+++ b/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c    Tue Dec 01 23:11:17 2009 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: libdm-nbsd-iface.c,v 1.2 2009/06/05 19:57:25 haad Exp $        */
+/*      $NetBSD: libdm-nbsd-iface.c,v 1.3 2009/12/01 23:11:17 haad Exp $        */
 
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
@@ -367,8 +367,6 @@
        
        nbsd_get_dm_major(&dm_major, DM_BLOCK_MAJOR);
 
-       log_error("format_dev %d--%d %d", dev_major, dev_minor, bufsize);
-
        if (bufsize < 8)
                return 0;
        
@@ -595,7 +593,6 @@
 {
        prop_array_t cmd_array;
        prop_dictionary_t target_spec;
-       prop_dictionary_t target_param;
        
        struct target *t;
        
@@ -620,10 +617,7 @@
                strlcpy(type,t->type,DM_MAX_TYPE_NAME);
 
                prop_dictionary_set_cstring(target_spec,DM_TABLE_TYPE,type);
-               
-               target_param = nbsd_dm_parse_param(type, t->params);
-               prop_dictionary_set(target_spec, DM_TABLE_PARAMS, target_param);
-               prop_object_release(target_param);
+               prop_dictionary_set_cstring(target_spec,DM_TABLE_PARAMS,t->params);
 
                prop_array_set(cmd_array,count,target_spec);
 
diff -r 3abe9cf141a1 -r c0abc57d6fbc external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c
--- a/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c        Tue Dec 01 22:36:31 2009 +0000
+++ b/external/gpl2/lvm2/dist/libdm/ioctl/libdm_netbsd.c        Tue Dec 01 23:11:17 2009 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: libdm_netbsd.c,v 1.3 2009/06/09 18:29:09 haad Exp $        */
+/*      $NetBSD: libdm_netbsd.c,v 1.4 2009/12/01 23:11:17 haad Exp $        */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -39,7 +39,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <netbsd-dm.h>
@@ -48,11 +47,6 @@
 
 #include "lib.h"
 
-struct nbsd_dm_target_param {
-       char *name;
-       prop_dictionary_t (*parse)(char *);
-};
-
 #define DMI_SIZE 16 * 1024
 
 static int dm_list_versions(prop_dictionary_t, struct dm_ioctl *);
@@ -60,206 +54,6 @@
 static int dm_dev_deps(prop_dictionary_t, struct dm_ioctl *);
 static int dm_table_status(prop_dictionary_t, struct dm_ioctl *);
 
-static prop_dictionary_t dm_parse_linear(char *);
-static prop_dictionary_t dm_parse_stripe(char *);
-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},
-       {"striped", dm_parse_stripe},
-       {"mirror", dm_parse_mirror},
-       {"snapshot", dm_parse_snapshot},
-       {"snapshot-origin", dm_parse_snapshot_origin},
-       {NULL, NULL},
-};
-
-/*
- * Parse params string to target specific proplib dictionary.
- *
- * <key>params</key>
- * <dict>
- *     <key>device</key>
- *     <array>
- *          <dict>
- *              <key>device</key>
- *              <string>/dev/wd1a</string>
- *              <key>offset</key>
- *              <integer>0x384</integer>
- *          </dict>
- *     </array>
- * <!-- Other target config stuff -->
- * </dict>
- *
- */
-prop_dictionary_t 
-nbsd_dm_parse_param(const char *target, const char *params)
-{
-       int i;
-       size_t slen, dlen;
-       prop_dictionary_t dict;
-       char *param;
-       
-       dict = NULL;
-       slen = strlen(target);
-
-       /* copy parameter string to new buffer */
-       param = dm_malloc(strlen(params) * sizeof(char));
-       strlcpy(param, params, strlen(params)+1);
-
-        for(i = 0; dmt_parse[i].name != NULL; i++) {
-               dlen = strlen(dmt_parse[i].name);
-               
-               if (slen != dlen)
-                       continue;
-                       
-               if (strncmp(target, dmt_parse[i].name, slen) == 0)
-                       break;
-       }
-
-       /* 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);
-       
-       dm_free(param);
-       
-       return dict;
-}
-
-/*
- * Example line sent to dm from lvm tools when using linear target.                                                                              
- * start length linear device1 offset1
- * 0 65536 linear /dev/hda 0 
- */
-static prop_dictionary_t 
-dm_parse_linear(char *params)
-{
-       prop_dictionary_t dict;
-       char **ap, *argv[3];
-       
-       dict = prop_dictionary_create();
-       
-       if (params == NULL)
-               return dict;
-
-               /*                                                                                                                                        
-        * Parse a string, containing tokens delimited by white space,                                                                            
-        * into an argument vector                                                                                                                
-        */
-       for (ap = argv; ap < &argv[2] &&
-           (*ap = strsep(&params, " \t")) != NULL;) {
-               if (**ap != '\0')
-                       ap++;
-       }
-               
-       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));
-               
-       return dict;
-}
-
-/*
- * Example line sent to dm from lvm tools when using striped target.                                                                              
- * start length striped #stripes chunk_size device1 offset1 ... deviceN offsetN                                                                   
- * 0 65536 striped 2 512 /dev/hda 0 /dev/hdb 0                                                                                                    
- */
-static prop_dictionary_t 
-dm_parse_stripe(char *params)
-{
-       prop_dictionary_t dict, dev_dict;
-       prop_array_t dev_array;
-       char **ap, *argv[10]; /* Limit number of disk stripes to 10 */
-
-       dict = prop_dictionary_create();
-       
-       if (params == NULL)
-               return dict;
-
-               /*                                                                                                                                        
-        * Parse a string, containing tokens delimited by white space,                                                                            
-        * into an argument vector                                                                                                                
-        */
-       for (ap = argv; ap < &argv[9] &&
-           (*ap = strsep(&params, " \t")) != NULL;) {
-               if (**ap != '\0')
-                       ap++;
-       }
-       
-       prop_dictionary_set_uint64(dict, DM_TARGET_STRIPE_STRIPES, 
-               strtol(argv[0], (char **)NULL, 10));
-       prop_dictionary_set_uint64(dict, DM_TARGET_STRIPE_CHUNKSIZE,
-               strtol(argv[1], (char **)NULL, 10));
-       
-       dev_array = prop_array_create();
-       
-       dev_dict = prop_dictionary_create();
-       prop_dictionary_set_cstring(dev_dict, DM_TARGET_STRIPE_DEVICE, argv[2]);
-       prop_dictionary_set_uint64(dev_dict, DM_TARGET_STRIPE_OFFSET, 
-               strtol(argv[3], (char **)NULL, 10));
-
-       prop_array_add(dev_array, dev_dict);
-       prop_object_release(dev_dict);
-       
-       dev_dict = prop_dictionary_create();
-       prop_dictionary_set_cstring(dev_dict, DM_TARGET_STRIPE_DEVICE, argv[4]);
-       prop_dictionary_set_uint64(dev_dict, DM_TARGET_STRIPE_OFFSET, 
-               strtol(argv[5], (char **)NULL, 10));
-
-       prop_array_add(dev_array, dev_dict);
-       prop_object_release(dev_dict);
-               
-       prop_dictionary_set(dict, DM_TARGET_STRIPE_DEVARRAY, dev_array);
-       prop_object_release(dev_array);
-       
-       return dict;
-}
-
-static prop_dictionary_t 
-dm_parse_mirror(char *params)
-{
-       prop_dictionary_t dict;
-       
-       dict = prop_dictionary_create();
-       
-       return dict;
-}
-
-static prop_dictionary_t 
-dm_parse_snapshot(char *params)
-{
-       prop_dictionary_t dict;
-       
-       dict = prop_dictionary_create();
-       
-       return dict;
-}
-
-static prop_dictionary_t 
-dm_parse_snapshot_origin(char *params)
-{
-       prop_dictionary_t dict;
-       
-       dict = prop_dictionary_create();
-       
-       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)
 {



Home | Main Index | Thread Index | Old Index