public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-12-21 12:47 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2011-12-21 12:47 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-12-21 12:47:45
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-config.c
Log message:
Add dm_config_find_str_allow_empty
Support empty string values.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.525&r2=1.526
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.171&r2=1.172
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-config.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
--- LVM2/WHATS_NEW_DM 2011/12/07 12:29:41 1.525
+++ LVM2/WHATS_NEW_DM 2011/12/21 12:47:44 1.526
@@ -6,7 +6,7 @@
Improve man page style for dmsetup.
Fix _get_proc_number to be tolerant of malformed /proc/misc entries.
Add ExecReload to dm-event.service for systemd to reload dmeventd properly.
- Add dm_config_tree_find_str_allow_empty.
+ Add dm_config_tree_find_str_allow_empty and dm_config_find_str_allow_empty.
Fix compile-time pool memory locking with DEBUG_MEM.
Fix valgrind error reports in free of pool chunks with DEBUG_MEM.
Align size of structure chunk for fast pool allocator to 8 bytes.
--- LVM2/libdm/libdevmapper.h 2011/12/18 21:56:03 1.171
+++ LVM2/libdm/libdevmapper.h 2011/12/21 12:47:45 1.172
@@ -1351,6 +1351,7 @@
struct dm_config_node *dm_config_find_node(struct dm_config_node *cn, const char *path);
int dm_config_has_node(const struct dm_config_node *cn, const char *path);
const char *dm_config_find_str(const struct dm_config_node *cn, const char *path, const char *fail);
+const char *dm_config_find_str_allow_empty(const struct dm_config_node *cn, const char *path, const char *fail);
int dm_config_find_int(const struct dm_config_node *cn, const char *path, int fail);
float dm_config_find_float(const struct dm_config_node *cn, const char *path, float fail);
--- LVM2/libdm/libdm-config.c 2011/12/18 21:56:03 1.18
+++ LVM2/libdm/libdm-config.c 2011/12/21 12:47:45 1.19
@@ -772,6 +772,12 @@
return _find_config_str(cn, _find_config_node, path, fail, 0);
}
+const char *dm_config_find_str_allow_empty(const struct dm_config_node *cn,
+ const char *path, const char *fail)
+{
+ return _find_config_str(cn, _find_config_node, path, fail, 1);
+}
+
static int64_t _find_config_int64(const void *start, node_lookup_fn find,
const char *path, int64_t fail)
{
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-03-02 17:31 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2012-03-02 17:31 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-02 17:31:22
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-deptree.c
Log message:
Added dm_tree_node_set_callback() for preload and deactivation hooks
Run users hook after preload for the node is finished,
or after the node has been deactivated.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.581&r2=1.582
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.186&r2=1.187
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.158&r2=1.159
--- LVM2/WHATS_NEW_DM 2012/03/02 13:26:08 1.581
+++ LVM2/WHATS_NEW_DM 2012/03/02 17:31:21 1.582
@@ -1,5 +1,6 @@
Version 1.02.73 -
====================================
+ Added dm_tree_node_set_callback() for preload and deactivation hooks.
Drop unsupported TRIM message for thin pool.
Improve logging for fifo startup in dmeventd.
Add few pointer validation in dmsetup.
--- LVM2/libdm/libdevmapper.h 2012/03/02 13:26:10 1.186
+++ LVM2/libdm/libdevmapper.h 2012/03/02 17:31:22 1.187
@@ -688,6 +688,20 @@
uint32_t read_ahead,
uint32_t read_ahead_flags);
+/*
+ * Set node callback hook before de/activation.
+ * Callback is called before 'activation' of node for activation tree,
+ * or 'deactivation' of node for deactivation tree.
+ */
+typedef enum {
+ DM_NODE_CALLBACK_PRELOADED, /* Node has preload deps */
+ DM_NODE_CALLBACK_DEACTIVATED, /* Node is deactivated */
+} dm_node_callback_t;
+typedef int (*dm_node_callback_fn) (struct dm_tree_node *node,
+ dm_node_callback_t type, void *cb_data);
+void dm_tree_node_set_callback(struct dm_tree_node *node,
+ dm_node_callback_fn cb, void *cb_data);
+
void dm_tree_set_cookie(struct dm_tree_node *node, uint32_t cookie);
uint32_t dm_tree_get_cookie(struct dm_tree_node *node);
--- LVM2/libdm/libdm-deptree.c 2012/03/02 13:26:10 1.158
+++ LVM2/libdm/libdm-deptree.c 2012/03/02 17:31:22 1.159
@@ -263,6 +263,10 @@
* Note: only direct child is allowed
*/
struct dm_tree_node *presuspend_node;
+
+ /* Callback */
+ dm_node_callback_fn callback;
+ void *callback_data;
};
struct dm_tree {
@@ -1588,6 +1592,14 @@
} else if (info.suspended)
dec_suspended();
+ if (child->callback &&
+ !child->callback(child, DM_NODE_CALLBACK_DEACTIVATED,
+ child->callback_data)) {
+ r = 0;
+ // FIXME: break tree shutdown or continue?
+ // hmm what about _node_clear_table()?
+ }
+
if (dm_tree_node_num_children(child, 0)) {
if (!_dm_tree_deactivate_children(child, uuid_prefix, uuid_prefix_len, level + 1))
return_0;
@@ -2445,10 +2457,16 @@
update_devs_flag = 1;
}
- if (update_devs_flag) {
+ if (update_devs_flag ||
+ (!dnode->info.exists && dnode->callback)) {
if (!dm_udev_wait(dm_tree_get_cookie(dnode)))
stack;
dm_tree_set_cookie(dnode, 0);
+
+ if (!dnode->info.exists && dnode->callback &&
+ !dnode->callback(child, DM_NODE_CALLBACK_PRELOADED,
+ dnode->callback_data))
+ return_0;
}
return r;
@@ -3245,3 +3263,10 @@
return 1;
}
+
+void dm_tree_node_set_callback(struct dm_tree_node *dnode,
+ dm_node_callback_fn cb, void *data)
+{
+ dnode->callback = cb;
+ dnode->callback_data = data;
+}
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-02-23 22:45 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2012-02-23 22:45 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-23 22:45:43
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-string.c
Log message:
Introduce dm_strncpy
Should be faster then strncpy - since we could avoid clearing 4KB pages
with each strncpy(...,PATH_MAX).
Also it's easy to check whether string fit - and eventually avoid
to continue working we incomplete string.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.573&r2=1.574
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.183&r2=1.184
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-string.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
--- LVM2/WHATS_NEW_DM 2012/02/23 18:26:28 1.573
+++ LVM2/WHATS_NEW_DM 2012/02/23 22:45:43 1.574
@@ -1,5 +1,6 @@
Version 1.02.73 -
====================================
+ Add dm_strncpy() function as a faster strncpy() replacement.
Version 1.02.72 - 23rd February 2012
====================================
--- LVM2/libdm/libdevmapper.h 2012/02/15 12:23:16 1.183
+++ LVM2/libdm/libdevmapper.h 2012/02/23 22:45:43 1.184
@@ -1211,6 +1211,15 @@
char **substr_first_unquoted_colon,
char **substr_first_unquoted_at_sign);
+/*
+ * Replacement for strncpy() function.
+ *
+ * Copies no more than n bytes from string pointed by src to the buffer
+ * pointed by dest and ensure string is finished with '\0'.
+ * Returns 0 if the whole string does not fit.
+ */
+int dm_strncpy(char *dest, const char *src, size_t n);
+
/**************************
* file/stream manipulation
**************************/
--- LVM2/libdm/libdm-string.c 2012/02/23 18:19:32 1.20
+++ LVM2/libdm/libdm-string.c 2012/02/23 22:45:43 1.21
@@ -410,3 +410,13 @@
*substr_first_unquoted_at_sign = arr_substr_first_unquoted[1];
}
+int dm_strncpy(char *dest, const char *src, size_t n)
+{
+ if (memccpy(dest, src, 0, n))
+ return 1;
+
+ if (n > 0)
+ dest[n - 1] = '\0';
+
+ return 0;
+}
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-02-15 12:23 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2012-02-15 12:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2012-02-15 12:23:16
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-common.h
Log message:
Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.
Just in case of emergency when name mangling code causes any problems so
we can override the default value and switch off the mangling globally.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.564&r2=1.565
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.182&r2=1.183
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.140&r2=1.141
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.13&r2=1.14
--- LVM2/WHATS_NEW_DM 2012/02/15 12:17:34 1.564
+++ LVM2/WHATS_NEW_DM 2012/02/15 12:23:15 1.565
@@ -1,5 +1,7 @@
Version 1.02.71 -
====================================
+ Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.
+ Add dm_lib_init to automatically initialise device-mapper library on load.
Replace any '\' char with '\\' in table specification on input.
Add mangle command to dmsetup to provide renaming to correct mangled form.
Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o.
--- LVM2/libdm/libdevmapper.h 2012/02/15 12:01:28 1.182
+++ LVM2/libdm/libdevmapper.h 2012/02/15 12:23:16 1.183
@@ -365,6 +365,12 @@
*/
int dm_device_has_mounted_fs(uint32_t major, uint32_t minor);
+
+/*
+ * Initialise library
+ */
+void dm_lib_init(void) __attribute__((constructor));
+
/*
* Release library resources
*/
--- LVM2/libdm/libdm-common.c 2012/02/15 11:39:38 1.140
+++ LVM2/libdm/libdm-common.c 2012/02/15 12:23:16 1.141
@@ -43,6 +43,8 @@
# include <selinux/label.h>
#endif
+#define DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME "DM_DEFAULT_NAME_MANGLING_MODE"
+
#define DEV_DIR "/dev/"
#ifdef UDEV_SYNC_SUPPORT
@@ -66,7 +68,7 @@
static int _verbose = 0;
static int _suspended_dev_counter = 0;
-static int _name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
+static int _name_mangling_mode = -1;
#ifdef HAVE_SELINUX_LABEL_H
static struct selabel_handle *_selabel_handle = NULL;
@@ -79,6 +81,22 @@
static int _udev_checking = 1;
#endif
+void dm_lib_init(void)
+{
+ const char *env;
+
+ env = getenv(DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME);
+ if (env && *env) {
+ if (!strcasecmp(env, "none"))
+ _name_mangling_mode = DM_STRING_MANGLING_NONE;
+ else if (!strcasecmp(env, "auto"))
+ _name_mangling_mode = DM_STRING_MANGLING_AUTO;
+ else if (!strcasecmp(env, "hex"))
+ _name_mangling_mode = DM_STRING_MANGLING_HEX;
+ } else
+ _name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
+}
+
/*
* Library users can provide their own logging
* function.
--- LVM2/libdm/libdm-common.h 2012/02/15 11:39:38 1.13
+++ LVM2/libdm/libdm-common.h 2012/02/15 12:23:16 1.14
@@ -18,6 +18,8 @@
#include "libdevmapper.h"
+#define DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME "DM_DEFAULT_NAME_MANGLING_MODE"
+
#define DEV_NAME(dmt) (dmt->mangled_dev_name ? : dmt->dev_name)
int mangle_name(const char *str, size_t len, char *buf,
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-02-15 11:39 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2012-02-15 11:39 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2012-02-15 11:39:38
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-common.h
Log message:
Add dm_task_get_name_mangled/unmangled to libdevmapper.
dm_task_get_name_mangled will always return mangled form of the name while
the dm_task_get_name_unmangled will always return unmangled form of the name
irrespective of the global setting (dm_set/get_name_mangling_mode).
This is handy in situations where we need to detect whether the name is already
mangled or not. Also display functions make use of it.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.559&r2=1.560
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.180&r2=1.181
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.139&r2=1.140
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.12&r2=1.13
--- LVM2/WHATS_NEW_DM 2012/02/15 11:27:01 1.559
+++ LVM2/WHATS_NEW_DM 2012/02/15 11:39:38 1.560
@@ -1,5 +1,6 @@
Version 1.02.71 -
====================================
+ Add dm_task_get_name_mangled/unmangled to libdevmapper.
Mangle device name on dm_task_set_name/newname call if necessary.
Add dm_set/get_name_mangling_mode to set/get name mangling in libdevmapper.
Add configure --with-default-name-mangling.
--- LVM2/libdm/libdevmapper.h 2012/02/15 11:27:01 1.180
+++ LVM2/libdm/libdevmapper.h 2012/02/15 11:39:38 1.181
@@ -171,6 +171,7 @@
struct dm_names *dm_task_get_names(struct dm_task *dmt);
struct dm_versions *dm_task_get_versions(struct dm_task *dmt);
+
int dm_task_set_ro(struct dm_task *dmt);
int dm_task_set_newname(struct dm_task *dmt, const char *newname);
int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid);
@@ -293,6 +294,14 @@
dm_string_mangling_t dm_get_name_mangling_mode(void);
/*
+ * Get mangled/unmangled form of the device-mapper name
+ * irrespective of the global setting (set by dm_set_name_mangling_mode).
+ * The name returned needs to be freed after use by calling dm_free!
+ */
+char *dm_task_get_name_mangled(const struct dm_task *dmt);
+char *dm_task_get_name_unmangled(const struct dm_task *dmt);
+
+/*
* Configure the device-mapper directory
*/
int dm_set_dev_dir(const char *dir);
--- LVM2/libdm/libdm-common.c 2012/02/15 11:27:02 1.139
+++ LVM2/libdm/libdm-common.c 2012/02/15 11:39:38 1.140
@@ -393,6 +393,53 @@
return -1;
}
+/*
+ * Try to unmangle supplied string.
+ * Return value: -1 on error, 0 when no unmangling needed, 1 when unmangling applied
+ */
+int unmangle_name(const char *str, size_t len, char *buf,
+ size_t buf_len, dm_string_mangling_t mode)
+{
+ char str_rest[DM_NAME_LEN];
+ size_t i, j;
+ int code;
+ int r = 0;
+
+ if (!str || !buf)
+ return -1;
+
+ /* Is there anything to do at all? */
+ if (!*str || !len || mode == DM_STRING_MANGLING_NONE)
+ return 0;
+
+ if (buf_len < DM_NAME_LEN) {
+ log_error(INTERNAL_ERROR "unmangle_name: supplied buffer too small");
+ return -1;
+ }
+
+ for (i = 0, j = 0; str[i]; i++, j++) {
+ if (str[i] == '\\' && str[i+1] == 'x') {
+ if (!sscanf(&str[i+2], "%2x%s", &code, str_rest)) {
+ log_debug("Hex encoding mismatch detected in \"%s\" "
+ "while trying to unmangle it.", str);
+ goto out;
+ }
+ buf[j] = (unsigned char) code;
+
+ /* skip the encoded part we've just decoded! */
+ i+= 3;
+
+ /* unmangling applied */
+ r = 1;
+ } else
+ buf[j] = str[i];
+ }
+
+out:
+ buf[j] = '\0';
+ return r;
+}
+
static int _dm_task_set_name(struct dm_task *dmt, const char *name,
dm_string_mangling_t mangling_mode)
{
@@ -490,6 +537,47 @@
return (dmt->dmi.v4->name);
}
+char *dm_task_get_name_mangled(const struct dm_task *dmt)
+{
+ const char *s = dm_task_get_name(dmt);
+ char buf[DM_NAME_LEN];
+ char *rs = NULL;
+ int r;
+
+ /*
+ * We're using 'auto mangling' here. If the name is already mangled,
+ * this is detected and we keep it as it is. If the name is not mangled,
+ * we do mangle it. This way we always get a mangled form of the name.
+ */
+ if ((r = mangle_name(s, strlen(s), buf, sizeof(buf),
+ DM_STRING_MANGLING_AUTO)) < 0)
+ log_error("Failed to mangle device name \"%s\".", s);
+ else if (!(rs = r ? dm_strdup(buf) : dm_strdup(s)))
+ log_error("dm_task_get_name_mangled: dm_strdup failed");
+
+ return rs;
+}
+
+char *dm_task_get_name_unmangled(const struct dm_task *dmt)
+{
+ const char *s = dm_task_get_name(dmt);
+ char buf[DM_NAME_LEN];
+ char *rs = NULL;
+ int r;
+
+ /*
+ * We just want to unmangle the string.
+ * Both auto and hex mode will do it.
+ */
+ if ((r = unmangle_name(s, strlen(s), buf, sizeof(buf),
+ DM_STRING_MANGLING_AUTO)) < 0)
+ log_error("Failed to unmangle device name \"%s\".", s);
+ else if (!(rs = r ? dm_strdup(buf) : dm_strdup(s)))
+ log_error("dm_task_get_name_unmangled: dm_strdup failed");
+
+ return rs;
+}
+
int dm_task_set_newname(struct dm_task *dmt, const char *newname)
{
dm_string_mangling_t mangling_mode = dm_get_name_mangling_mode();
--- LVM2/libdm/libdm-common.h 2012/02/15 11:33:53 1.12
+++ LVM2/libdm/libdm-common.h 2012/02/15 11:39:38 1.13
@@ -23,6 +23,9 @@
int mangle_name(const char *str, size_t len, char *buf,
size_t buf_len, dm_string_mangling_t mode);
+int unmangle_name(const char *str, size_t len, char *buf,
+ size_t buf_len, dm_string_mangling_t mode);
+
struct target *create_target(uint64_t start,
uint64_t len,
const char *type, const char *params);
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-02-15 11:27 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2012-02-15 11:27 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2012-02-15 11:27:02
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-common.h
libdm/ioctl : libdm-iface.c libdm-targets.h
Log message:
Mangle device name on dm_task_set_name/newname call if necessary.
If dm_task_set_name/newname is called, the name provided will be
automatically translated to correct encoded form with the hex enconding
so any character not on udev whitelist will be mangled with \xNN
format where NN is hex value of the character used.
By default, the name mangling mode used is the one set during
configure with the '--with-default-name-mangling' option.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.558&r2=1.559
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.179&r2=1.180
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.33&r2=1.34
--- LVM2/WHATS_NEW_DM 2012/02/15 11:17:57 1.558
+++ LVM2/WHATS_NEW_DM 2012/02/15 11:27:01 1.559
@@ -1,5 +1,7 @@
Version 1.02.71 -
====================================
+ Mangle device name on dm_task_set_name/newname call if necessary.
+ Add dm_set/get_name_mangling_mode to set/get name mangling in libdevmapper.
Add configure --with-default-name-mangling.
Test for parsed words in _umount() dmeventd snapshot plugin.
Fix memory leak in fail path of parse_loop_device_name() in dmsetup.
--- LVM2/libdm/libdevmapper.h 2012/02/15 11:17:58 1.179
+++ LVM2/libdm/libdevmapper.h 2012/02/15 11:27:01 1.180
@@ -287,6 +287,12 @@
} dm_string_mangling_t;
/*
+ * Set/get mangling mode used for device-mapper names.
+ */
+int dm_set_name_mangling_mode(dm_string_mangling_t name_mangling);
+dm_string_mangling_t dm_get_name_mangling_mode(void);
+
+/*
* Configure the device-mapper directory
*/
int dm_set_dev_dir(const char *dir);
--- LVM2/libdm/libdm-common.c 2012/02/13 14:39:24 1.138
+++ LVM2/libdm/libdm-common.c 2012/02/15 11:27:02 1.139
@@ -66,6 +66,7 @@
static int _verbose = 0;
static int _suspended_dev_counter = 0;
+static int _name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
#ifdef HAVE_SELINUX_LABEL_H
static struct selabel_handle *_selabel_handle = NULL;
@@ -201,6 +202,18 @@
return _suspended_dev_counter;
}
+int dm_set_name_mangling_mode(dm_string_mangling_t name_mangling_mode)
+{
+ _name_mangling_mode = name_mangling_mode;
+
+ return 1;
+}
+
+dm_string_mangling_t dm_get_name_mangling_mode(void)
+{
+ return _name_mangling_mode;
+}
+
struct dm_task *dm_task_create(int type)
{
struct dm_task *dmt = dm_zalloc(sizeof(*dmt));
@@ -238,18 +251,18 @@
/*
* Find the name associated with a given device number by scanning _dm_dir.
*/
-static char *_find_dm_name_of_device(dev_t st_rdev)
+static int _find_dm_name_of_device(dev_t st_rdev, char *buf, size_t buf_len)
{
const char *name;
char path[PATH_MAX];
struct dirent *dirent;
DIR *d;
- struct stat buf;
- char *new_name = NULL;
+ struct stat st;
+ int r = 0;
if (!(d = opendir(_dm_dir))) {
log_sys_error("opendir", _dm_dir);
- return NULL;
+ return 0;
}
while ((dirent = readdir(d))) {
@@ -264,13 +277,12 @@
continue;
}
- if (stat(path, &buf))
+ if (stat(path, &st))
continue;
- if (buf.st_rdev == st_rdev) {
- if (!(new_name = dm_strdup(name)))
- log_error("dm_task_set_name: strdup(%s) failed",
- name);
+ if (st.st_rdev == st_rdev) {
+ strncpy(buf, name, buf_len);
+ r = 1;
break;
}
}
@@ -278,72 +290,212 @@
if (closedir(d))
log_sys_error("closedir", _dm_dir);
- return new_name;
+ return r;
}
-int dm_task_set_name(struct dm_task *dmt, const char *name)
+static int _is_whitelisted_char(char c)
{
- char *pos;
- char *new_name = NULL;
- char path[PATH_MAX];
- struct stat st1, st2;
-
- dm_free(dmt->dev_name);
- dmt->dev_name = NULL;
-
/*
- * Path supplied for existing device?
+ * Actually, DM supports any character in a device name.
+ * This whitelist is just for proper integration with udev.
*/
- if ((pos = strrchr(name, '/'))) {
- if (dmt->type == DM_DEVICE_CREATE) {
- log_error("Name \"%s\" invalid. It contains \"/\".", name);
- return 0;
- }
+ if ((c >= '0' && c <= '9') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= 'a' && c <= 'z') ||
+ strchr("#+-.:=@_", c) != NULL)
+ return 1;
- if (stat(name, &st1)) {
- log_error("Device %s not found", name);
- return 0;
- }
+ return 0;
+}
- /*
- * If supplied path points to same device as last component
- * under /dev/mapper, use that name directly. Otherwise call
- * _find_dm_name_of_device() to scan _dm_dir for a match.
- */
- if (dm_snprintf(path, sizeof(path), "%s/%s", _dm_dir,
- pos + 1) == -1) {
- log_error("Couldn't create path for %s", pos + 1);
- return 0;
+/*
+ * Mangle all characters in the input string which are not on a whitelist
+ * with '\xNN' format where NN is the hex value of the character.
+ */
+int mangle_name(const char *str, size_t len, char *buf,
+ size_t buf_len, dm_string_mangling_t mode)
+{
+ int need_mangling = -1; /* -1 don't know yet, 0 no, 1 yes */
+ size_t i, j;
+
+ if (!str || !buf)
+ return -1;
+
+ /* Is there anything to do at all? */
+ if (!*str || !len || mode == DM_STRING_MANGLING_NONE)
+ return 0;
+
+ if (buf_len < DM_NAME_LEN) {
+ log_error(INTERNAL_ERROR "mangle_name: supplied buffer too small");
+ return -1;
+ }
+
+ for (i = 0, j = 0; str[i]; i++) {
+ if (mode == DM_STRING_MANGLING_AUTO) {
+ /*
+ * Detect already mangled part of the string and keep it.
+ * Return error on mixture of mangled/not mangled!
+ */
+ if (str[i] == '\\' && str[i+1] == 'x') {
+ if ((len - i < 4) || (need_mangling == 1))
+ goto bad1;
+ if (buf_len - j < 4)
+ goto bad2;
+
+ memcpy(&buf[j], &str[i], 4);
+ i+=3; j+=4;
+
+ need_mangling = 0;
+ continue;
+ }
}
- if (!stat(path, &st2) && (st1.st_rdev == st2.st_rdev))
- name = pos + 1;
- else if ((new_name = _find_dm_name_of_device(st1.st_rdev)))
- name = new_name;
- else {
- log_error("Device %s not found", name);
- return 0;
+ if (_is_whitelisted_char(str[i])) {
+ /* whitelisted, keep it. */
+ if (buf_len - j < 1)
+ goto bad2;
+ buf[j] = str[i];
+ j++;
+ } else {
+ /*
+ * Not on a whitelist, mangle it.
+ * Return error on mixture of mangled/not mangled
+ * unless a DM_STRING_MANGLING_HEX is used!.
+ */
+ if ((mode != DM_STRING_MANGLING_HEX) && (need_mangling == 0))
+ goto bad1;
+ if (buf_len - j < 4)
+ goto bad2;
+
+ sprintf(&buf[j], "\\x%02x", (unsigned char) str[i]);
+ j+=4;
+
+ need_mangling = 1;
}
}
+ if (buf_len - j < 1)
+ goto bad2;
+ buf[j] = '\0';
+
+ /* All chars in the string whitelisted? */
+ if (need_mangling == -1)
+ need_mangling = 0;
+
+ return need_mangling;
+
+bad1:
+ log_error("The name \"%s\" contains mixed mangled and unmangled "
+ "characters or it's already mangled improperly.", str);
+ return -1;
+bad2:
+ log_error("Mangled form of the name too long for \"%s\".", str);
+ return -1;
+}
+
+static int _dm_task_set_name(struct dm_task *dmt, const char *name,
+ dm_string_mangling_t mangling_mode)
+{
+ char mangled_name[DM_NAME_LEN];
+ int r;
+
+ dm_free(dmt->dev_name);
+ dmt->dev_name = NULL;
+ dm_free(dmt->mangled_dev_name);
+ dmt->mangled_dev_name = NULL;
+
if (strlen(name) >= DM_NAME_LEN) {
- log_error("Name \"%s\" too long", name);
- dm_free(new_name);
+ log_error("Name \"%s\" too long.", name);
+ return 0;
+ }
+
+ if ((r = mangle_name(name, strlen(name), mangled_name,
+ sizeof(mangled_name), mangling_mode)) < 0) {
+ log_error("Failed to mangle device name \"%s\".", name);
return 0;
}
- if (new_name)
- dmt->dev_name = new_name;
- else if (!(dmt->dev_name = dm_strdup(name))) {
- log_error("dm_task_set_name: strdup(%s) failed", name);
+ /* Store mangled_dev_name only if it differs from dev_name! */
+ if (r) {
+ log_debug("Device name mangled [%s]: %s --> %s",
+ mangling_mode == DM_STRING_MANGLING_AUTO ? "auto" : "hex",
+ name, mangled_name);
+ if (!(dmt->mangled_dev_name = dm_strdup(mangled_name))) {
+ log_error("_dm_task_set_name: dm_strdup(%s) failed", mangled_name);
+ return 0;
+ }
+ }
+
+ if (!(dmt->dev_name = dm_strdup(name))) {
+ log_error("_dm_task_set_name: strdup(%s) failed", name);
return 0;
}
return 1;
}
+static int _dm_task_set_name_from_path(struct dm_task *dmt, const char *path,
+ const char *name)
+{
+ char buf[PATH_MAX];
+ struct stat st1, st2;
+ const char *final_name;
+
+ if (dmt->type == DM_DEVICE_CREATE) {
+ log_error("Name \"%s\" invalid. It contains \"/\".", path);
+ return 0;
+ }
+
+ if (stat(path, &st1)) {
+ log_error("Device %s not found", path);
+ return 0;
+ }
+
+ /*
+ * If supplied path points to same device as last component
+ * under /dev/mapper, use that name directly. Otherwise call
+ * _find_dm_name_of_device() to scan _dm_dir for a match.
+ */
+ if (dm_snprintf(buf, sizeof(buf), "%s/%s", _dm_dir, name) == -1) {
+ log_error("Couldn't create path for %s", name);
+ return 0;
+ }
+
+ if (!stat(path, &st2) && (st1.st_rdev == st2.st_rdev))
+ final_name = name;
+ else if (_find_dm_name_of_device(st1.st_rdev, buf, sizeof(buf)))
+ final_name = buf;
+ else {
+ log_error("Device %s not found", name);
+ return 0;
+ }
+
+ /* This is an already existing path - do not mangle! */
+ return _dm_task_set_name(dmt, final_name, DM_STRING_MANGLING_NONE);
+}
+
+int dm_task_set_name(struct dm_task *dmt, const char *name)
+{
+ char *pos;
+
+ /* Path supplied for existing device? */
+ if ((pos = strrchr(name, '/')))
+ return _dm_task_set_name_from_path(dmt, name, pos + 1);
+
+ return _dm_task_set_name(dmt, name, dm_get_name_mangling_mode());
+}
+
+const char *dm_task_get_name(const struct dm_task *dmt)
+{
+ return (dmt->dmi.v4->name);
+}
+
int dm_task_set_newname(struct dm_task *dmt, const char *newname)
{
+ dm_string_mangling_t mangling_mode = dm_get_name_mangling_mode();
+ char mangled_name[DM_NAME_LEN];
+ int r;
+
if (strchr(newname, '/')) {
log_error("Name \"%s\" invalid. It contains \"/\".", newname);
return 0;
@@ -354,10 +506,24 @@
return 0;
}
+ if ((r = mangle_name(newname, strlen(newname), mangled_name,
+ sizeof(mangled_name), mangling_mode)) < 0) {
+ log_error("Failed to mangle new device name \"%s\"", newname);
+ return 0;
+ }
+
+ if (r) {
+ log_debug("New device name mangled [%s]: %s --> %s",
+ mangling_mode == DM_STRING_MANGLING_AUTO ? "auto" : "hex",
+ newname, mangled_name);
+ newname = mangled_name;
+ }
+
if (!(dmt->newname = dm_strdup(newname))) {
log_error("dm_task_set_newname: strdup(%s) failed", newname);
return 0;
}
+
dmt->new_uuid = 0;
return 1;
--- LVM2/libdm/libdm-common.h 2012/01/09 12:26:15 1.10
+++ LVM2/libdm/libdm-common.h 2012/02/15 11:27:02 1.11
@@ -18,6 +18,9 @@
#include "libdevmapper.h"
+int mangle_name(const char *str, size_t len, char *buf,
+ size_t buf_len, dm_string_mangling_t mode);
+
struct target *create_target(uint64_t start,
uint64_t len,
const char *type, const char *params);
--- LVM2/libdm/ioctl/libdm-iface.c 2012/02/08 12:59:20 1.134
+++ LVM2/libdm/ioctl/libdm-iface.c 2012/02/15 11:27:02 1.135
@@ -450,6 +450,7 @@
_dm_zfree_dmi(dmt->dmi.v4);
dm_free(dmt->dev_name);
+ dm_free(dmt->mangled_dev_name);
dm_free(dmt->newname);
dm_free(dmt->message);
dm_free(dmt->geometry);
@@ -674,11 +675,6 @@
MINOR(dmt->dmi.v4->dev), read_ahead);
}
-const char *dm_task_get_name(const struct dm_task *dmt)
-{
- return (dmt->dmi.v4->name);
-}
-
const char *dm_task_get_uuid(const struct dm_task *dmt)
{
return (dmt->dmi.v4->uuid);
--- LVM2/libdm/ioctl/libdm-targets.h 2011/10/19 16:36:02 1.33
+++ LVM2/libdm/ioctl/libdm-targets.h 2012/02/15 11:27:02 1.34
@@ -33,6 +33,7 @@
struct dm_task {
int type;
char *dev_name;
+ char *mangled_dev_name;
struct target *head, *tail;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2012-01-11 12:34 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2012-01-11 12:34 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2012-01-11 12:34:45
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c
Log message:
Add dm_device_get_name to get map name or block device name for given devno.
This is accomplished by reading associated sysfs information. For a dm device,
this is /sys/dev/block/major:minor/dm/name (supported in kernel version >= 2.6.29,
for older kernels, the behaviour is the same as for non-dm devices).
For a non-dm device, this is a readlink on /sys/dev/block/major:minor, e.g.
/sys/dev/block/253:0 --> ../../devices/virtual/block/dm-0.
The last component of the path is a proper kernel name (block device name).
One can request to read only kernel names by setting the 'prefer_kernel_name'
argument if needed.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.529&r2=1.530
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.174&r2=1.175
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.131&r2=1.132
--- LVM2/WHATS_NEW_DM 2012/01/10 02:03:31 1.529
+++ LVM2/WHATS_NEW_DM 2012/01/11 12:34:44 1.530
@@ -1,5 +1,6 @@
Version 1.02.68 -
==================================
+ Add dm_device_get_name to get map name or block device name for given devno.
Remove empty devices when clearing left-over inactive tables in deptree.
Add dm_uuid_prefix/dm_set_uuid_prefix to override hard-coded LVM- prefix.
Improve dmsetup man page about readahead parameter.
--- LVM2/libdm/libdevmapper.h 2012/01/10 02:03:32 1.174
+++ LVM2/libdm/libdevmapper.h 2012/01/11 12:34:45 1.175
@@ -300,6 +300,21 @@
int dm_is_dm_major(uint32_t major);
/*
+ * Get associated device name for given major and minor number by reading
+ * the sysfs content. If this is a dm device, get associated dm name, the one
+ * that appears in /dev/mapper. DM names could be resolved this way only if
+ * kernel used >= 2.6.29, kernel name is found otherwise (e.g. dm-0).
+ * If prefer_kernel_name is set, the kernel name is always preferred over
+ * device-mapper name for dm devices no matter what the kernel version is.
+ * For non-dm devices, we always get associated kernel name, e.g sda, md0 etc.
+ * Returns 0 on error or if sysfs is not used (or configured incorrectly),
+ * otherwise returns 1 and the supplied buffer holds the device name.
+ */
+int dm_device_get_name(uint32_t major, uint32_t minor,
+ int prefer_kernel_name,
+ char *buf, size_t buf_size);
+
+/*
* Determine whether a device has any holders (devices
* using this device). If sysfs is not used (or configured
* incorrectly), returns 0.
--- LVM2/libdm/libdm-common.c 2012/01/10 02:03:32 1.131
+++ LVM2/libdm/libdm-common.c 2012/01/11 12:34:45 1.132
@@ -1165,6 +1165,133 @@
return _default_uuid_prefix;
}
+static int _sysfs_get_dm_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
+{
+ char *sysfs_path, *temp_buf;
+ FILE *fp;
+
+ if (!(sysfs_path = dm_malloc(PATH_MAX)) ||
+ !(temp_buf = dm_malloc(PATH_MAX))) {
+ log_error("_sysfs_get_dm_name: failed to allocate temporary buffers");
+ if (sysfs_path)
+ dm_free(sysfs_path);
+ return 0;
+ }
+
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sdev/block/%" PRIu32 ":%" PRIu32
+ "/dm/name", _sysfs_dir, major, minor) < 0) {
+ log_error("_sysfs_get_dm_name: dm_snprintf failed");
+ goto error;
+ }
+
+ if (!(fp = fopen(sysfs_path, "r"))) {
+ if (errno != ENOENT)
+ log_sys_error("fopen", sysfs_path);
+ else
+ log_sys_debug("fopen", sysfs_path);
+ goto error;
+ }
+
+ if (!fgets(temp_buf, PATH_MAX, fp)) {
+ log_sys_error("fgets", sysfs_path);
+ goto error;
+ }
+ temp_buf[strlen(temp_buf) - 1] = '\0';
+
+ if (fclose(fp))
+ log_sys_error("fclose", sysfs_path);
+
+ if (buf_size < strlen(temp_buf) + 1) {
+ log_error("_sysfs_get_dm_name: supplied buffer too small");
+ goto error;
+ }
+
+ strncpy(buf, temp_buf, buf_size);
+ dm_free(sysfs_path);
+ dm_free(temp_buf);
+ return 1;
+
+error:
+ dm_free(sysfs_path);
+ dm_free(temp_buf);
+ return 0;
+}
+
+static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
+{
+ char *sysfs_path, *temp_buf, *name;
+ ssize_t size;
+
+ if (!(sysfs_path = dm_malloc(PATH_MAX)) ||
+ !(temp_buf = dm_malloc(PATH_MAX))) {
+ log_error("_sysfs_get_kernel_name: failed to allocate temporary buffers");
+ if (sysfs_path)
+ dm_free(sysfs_path);
+ return 0;
+ }
+
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sdev/block/%" PRIu32 ":%" PRIu32,
+ _sysfs_dir, major, minor) < 0) {
+ log_error("_sysfs_get_kernel_name: dm_snprintf failed");
+ goto error;
+ }
+
+ if ((size = readlink(sysfs_path, temp_buf, PATH_MAX)) < 0) {
+ if (errno != ENOENT)
+ log_sys_error("readlink", sysfs_path);
+ else
+ log_sys_debug("readlink", sysfs_path);
+ goto error;
+ }
+ temp_buf[size] = '\0';
+
+ if (!(name = strrchr(temp_buf, '/'))) {
+ log_error("Could not locate device kernel name in sysfs path %s", temp_buf);
+ goto error;
+ }
+ name += 1;
+
+ if (buf_size < strlen(name) + 1) {
+ log_error("_sysfs_get_kernel_name: output buffer too small");
+ goto error;
+ }
+
+ strncpy(buf, name, buf_size);
+ dm_free(sysfs_path);
+ dm_free(temp_buf);
+ return 1;
+
+error:
+ dm_free(sysfs_path);
+ dm_free(temp_buf);
+ return 0;
+}
+
+int dm_device_get_name(uint32_t major, uint32_t minor, int prefer_kernel_name,
+ char *buf, size_t buf_size)
+{
+ if (!*_sysfs_dir)
+ return 0;
+
+ /*
+ * device-mapper devices and prefer_kernel_name = 0
+ * get dm name by reading /sys/dev/block/major:minor/dm/name,
+ * fallback to _sysfs_get_kernel_name if not successful
+ */
+ if (dm_is_dm_major(major) && !prefer_kernel_name) {
+ if (_sysfs_get_dm_name(major, minor, buf, buf_size))
+ return 1;
+ else
+ stack;
+ }
+
+ /*
+ * non-device-mapper devices or prefer_kernel_name = 1
+ * get kernel name using readlink /sys/dev/block/major:minor -> .../dm-X
+ */
+ return _sysfs_get_kernel_name(major, minor, buf, buf_size);
+}
+
int dm_device_has_holders(uint32_t major, uint32_t minor)
{
char sysfs_path[PATH_MAX];
@@ -1235,32 +1362,11 @@
int dm_device_has_mounted_fs(uint32_t major, uint32_t minor)
{
- char sysfs_path[PATH_MAX];
- char temp_path[PATH_MAX];
- char *kernel_dev_name;
- ssize_t size;
-
- if (!*_sysfs_dir)
- return 0;
+ char kernel_dev_name[PATH_MAX];
/* Get kernel device name first */
- if (dm_snprintf(sysfs_path, PATH_MAX, "%sdev/block/%" PRIu32 ":%" PRIu32,
- _sysfs_dir, major, minor) < 0) {
- log_error("sysfs_path dm_snprintf failed");
- return 0;
- }
-
- if ((size = readlink(sysfs_path, temp_path, PATH_MAX)) < 0) {
- log_sys_error("readlink", sysfs_path);
+ if (!dm_device_get_name(major, minor, 1, kernel_dev_name, PATH_MAX))
return 0;
- }
- temp_path[size] = '\0';
-
- if (!(kernel_dev_name = strrchr(temp_path, '/'))) {
- log_error("Could not locate device kernel name in sysfs path %s", temp_path);
- return 0;
- }
- kernel_dev_name += 1;
/* Check /sys/fs/<fs_name>/<kernel_dev_name> presence */
return _mounted_fs_on_device(kernel_dev_name);
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-09-29 8:53 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2011-09-29 8:53 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-29 08:53:49
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-deptree.c
Log message:
Add supporting function for thinp
New dm_tree_node_add_thin_pool_target() and dm_tree_node_add_thin_target()
This API is highly experimental and unstable for now.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.507&r2=1.508
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.153&r2=1.154
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115
--- LVM2/WHATS_NEW_DM 2011/09/25 19:38:59 1.507
+++ LVM2/WHATS_NEW_DM 2011/09/29 08:53:48 1.508
@@ -1,5 +1,6 @@
Version 1.02.68 -
==================================
+ Add functions to support thin provisioning target (API unstable).
Improve libdm-config error path reporting.
Update dmsetup resume man with --addnodeonresume/create options.
Add dependency for dm man pages to man subdirectory make target all:.
--- LVM2/libdm/libdevmapper.h 2011/09/22 17:36:50 1.153
+++ LVM2/libdm/libdevmapper.h 2011/09/29 08:53:48 1.154
@@ -535,6 +535,22 @@
uint32_t slog_region_size);
/* End of Replicator API */
+/* API for thin provisioning is experimental, DO NOT USE. */
+int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
+ uint64_t size,
+ uint64_t transation_id,
+ const char *pool_uuid,
+ const char *metadata_uuid,
+ uint32_t data_block_size,
+ uint64_t low_water_mark,
+ unsigned skip_block_zeroeing); /* Maybe separate _set_ call ? */
+
+int dm_tree_node_add_thin_target(struct dm_tree_node *node,
+ uint64_t size,
+ uint64_t transation_id,
+ const char *thin_pool_uuid,
+ uint32_t device_id);
+
void dm_tree_node_set_presuspend_node(struct dm_tree_node *node,
struct dm_tree_node *presuspend_node);
--- LVM2/libdm/libdm-deptree.c 2011/09/29 08:50:54 1.114
+++ LVM2/libdm/libdm-deptree.c 2011/09/29 08:53:48 1.115
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2005-2011 Red Hat, Inc. All rights reserved.
*
* This file is part of the device-mapper userspace tools.
*
@@ -29,6 +29,12 @@
#define REPLICATOR_LOCAL_SITE 0
+#define THIN_MIN_DATA_SIZE 128
+#define THIN_MAX_DATA_SIZE 2097152
+#define THIN_MAX_DEVICE_ID ((1 << 24) - 1)
+
+#define QUOTE(x) #x
+
/* Supported segment types */
enum {
SEG_CRYPT,
@@ -42,6 +48,8 @@
SEG_SNAPSHOT_MERGE,
SEG_STRIPED,
SEG_ZERO,
+ SEG_THIN_POOL,
+ SEG_THIN,
SEG_RAID1,
SEG_RAID4,
SEG_RAID5_LA,
@@ -71,6 +79,8 @@
{ SEG_SNAPSHOT_MERGE, "snapshot-merge" },
{ SEG_STRIPED, "striped" },
{ SEG_ZERO, "zero"},
+ { SEG_THIN_POOL, "thin-pool"},
+ { SEG_THIN, "thin"},
{ SEG_RAID1, "raid1"},
{ SEG_RAID4, "raid4"},
{ SEG_RAID5_LA, "raid5_la"},
@@ -156,6 +166,14 @@
uint64_t rdevice_index; /* Replicator-dev */
uint64_t rebuilds; /* raid */
+
+ struct dm_tree_node *metadata; /* Thin_pool */
+ struct dm_tree_node *pool; /* Thin_pool, Thin */
+ uint32_t data_block_size; /* Thin_pool */
+ uint64_t low_water_mark; /* Thin_pool */
+ unsigned skip_block_zeroeing; /* Thin_pool */
+ uint32_t device_id; /* Thin */
+
};
/* Per-device properties */
@@ -1825,6 +1843,7 @@
int r;
int target_type_is_raid = 0;
char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE];
+ char pool[DM_FORMAT_DEV_BUFSIZE], metadata[DM_FORMAT_DEV_BUFSIZE];
switch(seg->type) {
case SEG_ERROR:
@@ -1892,6 +1911,20 @@
return_0;
break;
+ case SEG_THIN_POOL:
+ if (!_build_dev_string(metadata, sizeof(metadata), seg->metadata))
+ return_0;
+ if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ return_0;
+ EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %s", metadata, pool,
+ seg->data_block_size, seg->low_water_mark,
+ seg->skip_block_zeroeing ? "1 skip_block_zeroing" : "");
+ break;
+ case SEG_THIN:
+ if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ return_0;
+ EMIT_PARAMS(pos, "%s %d", pool, seg->device_id);
+ break;
}
switch(seg->type) {
@@ -1901,6 +1934,8 @@
case SEG_SNAPSHOT_ORIGIN:
case SEG_SNAPSHOT_MERGE:
case SEG_ZERO:
+ case SEG_THIN_POOL:
+ case SEG_THIN:
break;
case SEG_CRYPT:
case SEG_LINEAR:
@@ -2602,6 +2637,85 @@
return 1;
}
+int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
+ uint64_t size,
+ uint64_t transation_id,
+ const char *pool_uuid,
+ const char *metadata_uuid,
+ uint32_t data_block_size,
+ uint64_t low_water_mark,
+ unsigned skip_block_zeroeing)
+{
+ struct load_segment *seg;
+
+ if (data_block_size < THIN_MIN_DATA_SIZE) {
+ log_error("Data block size %d is lower then "
+ QUOTE(THIN_MIN_DATA_SIZE) " sectors.",
+ data_block_size);
+ return 0;
+ }
+
+ if (data_block_size > THIN_MAX_DATA_SIZE) {
+ log_error("Data block size %d is higher then "
+ QUOTE(THIN_MAX_DATA_SIZE) " sectors.",
+ data_block_size);
+ return 0;
+ }
+
+ if (!(seg = _add_segment(node, SEG_THIN_POOL, size)))
+ return_0;
+
+ if (!(seg->metadata = dm_tree_find_node_by_uuid(node->dtree, metadata_uuid))) {
+ log_error("Missing metadata uuid %s.", metadata_uuid);
+ return 0;
+ }
+
+ if (!_link_tree_nodes(node, seg->metadata))
+ return_0;
+
+ if (!(seg->pool = dm_tree_find_node_by_uuid(node->dtree, pool_uuid))) {
+ log_error("Missing pool uuid %s.", pool_uuid);
+ return 0;
+ }
+
+ if (!_link_tree_nodes(node, seg->pool))
+ return_0;
+
+ seg->data_block_size = data_block_size;
+ seg->low_water_mark = low_water_mark;
+ seg->skip_block_zeroeing = skip_block_zeroeing;
+
+ return 1;
+}
+
+int dm_tree_node_add_thin_target(struct dm_tree_node *node,
+ uint64_t size,
+ uint64_t transation_id,
+ const char *thin_pool_uuid,
+ uint32_t device_id)
+{
+ struct load_segment *seg;
+
+ if (device_id > THIN_MAX_DEVICE_ID) {
+ log_error("Device id %d is higher then " QUOTE(THIN_MAX_DEVICE_ID) ".",
+ device_id);
+ return 0;
+ }
+
+ if (!(seg = _add_segment(node, SEG_THIN, size)))
+ return_0;
+
+ if (!(seg->pool = dm_tree_find_node_by_uuid(node->dtree, thin_pool_uuid))) {
+ log_error("Missing thin pool uuid %s.", thin_pool_uuid);
+ return 0;
+ }
+
+ if (!_link_tree_nodes(node, seg->pool))
+ return_0;
+
+ return 1;
+}
+
static int _add_area(struct dm_tree_node *node, struct load_segment *seg, struct dm_tree_node *dev_node, uint64_t offset)
{
struct seg_area *area;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-09-22 17:36 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2011-09-22 17:36 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-09-22 17:36:51
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-deptree.c
Log message:
Add dm_tree_retry_remove to use retry logic for device removal in a dm_tree.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.503&r2=1.504
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.152&r2=1.153
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.110&r2=1.111
--- LVM2/WHATS_NEW_DM 2011/09/22 17:23:35 1.503
+++ LVM2/WHATS_NEW_DM 2011/09/22 17:36:50 1.504
@@ -1,5 +1,6 @@
Version 1.02.68 -
==================================
+ Add dm_tree_retry_remove to use retry logic for device removal in a dm_tree.
Add dm_device_has_mounted_fs fn to check mounted filesystem on a device.
Add dm_device_has_holders fn to to check use of the device by another device.
Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
--- LVM2/libdm/libdevmapper.h 2011/09/22 17:23:36 1.152
+++ LVM2/libdm/libdevmapper.h 2011/09/22 17:36:50 1.153
@@ -422,6 +422,11 @@
void dm_tree_use_no_flush_suspend(struct dm_tree_node *dnode);
/*
+ * Retry removal of each device if not successful.
+ */
+void dm_tree_retry_remove(struct dm_tree_node *dnode);
+
+/*
* Is the uuid prefix present in the tree?
* Only returns 0 if every node was checked successfully.
* Returns 1 if the tree walk has to be aborted.
--- LVM2/libdm/libdm-deptree.c 2011/09/22 17:33:51 1.110
+++ LVM2/libdm/libdm-deptree.c 2011/09/22 17:36:50 1.111
@@ -222,7 +222,8 @@
struct dm_hash_table *uuids;
struct dm_tree_node root;
int skip_lockfs; /* 1 skips lockfs (for non-snapshots) */
- int no_flush; /* 1 sets noflush (mirrors/multipath) */
+ int no_flush; /* 1 sets noflush (mirrors/multipath) */
+ int retry_remove; /* 1 retries remove if not successful */
uint32_t cookie;
};
@@ -1006,7 +1007,7 @@
}
static int _deactivate_node(const char *name, uint32_t major, uint32_t minor,
- uint32_t *cookie, uint16_t udev_flags)
+ uint32_t *cookie, uint16_t udev_flags, int retry)
{
struct dm_task *dmt;
int r = 0;
@@ -1029,6 +1030,10 @@
if (!dm_task_set_cookie(dmt, cookie, udev_flags))
goto out;
+
+ if (retry)
+ dm_task_retry_remove(dmt);
+
r = dm_task_run(dmt);
/* FIXME Until kernel returns actual name so dm-iface.c can handle it */
@@ -1231,7 +1236,8 @@
continue;
if (!_deactivate_node(name, info.major, info.minor,
- &child->dtree->cookie, child->udev_flags)) {
+ &child->dtree->cookie, child->udev_flags,
+ child->dtree->retry_remove)) {
log_error("Unable to deactivate %s (%" PRIu32
":%" PRIu32 ")", name, info.major,
info.minor);
@@ -1266,6 +1272,11 @@
dnode->dtree->no_flush = 1;
}
+void dm_tree_retry_remove(struct dm_tree_node *dnode)
+{
+ dnode->dtree->retry_remove = 1;
+}
+
int dm_tree_suspend_children(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len)
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-09-22 17:23 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2011-09-22 17:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-09-22 17:23:36
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-file.c
Log message:
Add dm_device_has_holders fn to to check use of the device by another device.
Add dm_device_has_mounted_fs fn to check mounted filesystem on a device.
This requires sysfs directory to be correctly set via dm_set_sysfs_dir
(/sys by default). If sysfs dir is not used or it's set incorrectly,
dm_device_has_{holders,mounted_fs} will return 0!
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.502&r2=1.503
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.151&r2=1.152
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.125&r2=1.126
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-file.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
--- LVM2/WHATS_NEW_DM 2011/09/22 17:17:07 1.502
+++ LVM2/WHATS_NEW_DM 2011/09/22 17:23:35 1.503
@@ -1,5 +1,7 @@
Version 1.02.68 -
==================================
+ Add dm_device_has_mounted_fs fn to check mounted filesystem on a device.
+ Add dm_device_has_holders fn to to check use of the device by another device.
Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
Add dm_set_sysfs_dir to libdevmapper to set sysfs location.
Add --retry option for dmsetup remove to retry removal if not successful.
--- LVM2/libdm/libdevmapper.h 2011/09/22 17:17:07 1.151
+++ LVM2/libdm/libdevmapper.h 2011/09/22 17:23:36 1.152
@@ -267,6 +267,19 @@
int dm_is_dm_major(uint32_t major);
/*
+ * Determine whether a device has any holders (devices
+ * using this device). If sysfs is not used (or configured
+ * incorrectly), returns 0.
+ */
+int dm_device_has_holders(uint32_t major, uint32_t minor);
+
+/*
+ * Determine whether a device contains mounted filesystem.
+ * If sysfs is not used (or configured incorrectly), returns 0.
+ */
+int dm_device_has_mounted_fs(uint32_t major, uint32_t minor);
+
+/*
* Release library resources
*/
void dm_lib_release(void);
@@ -1069,6 +1082,8 @@
*/
int dm_create_dir(const char *dir);
+int dm_is_empty_dir(const char *dir);
+
/*
* Close a stream, with nicer error checking than fclose's.
* Derived from gnulib's close-stream.c.
--- LVM2/libdm/libdm-common.c 2011/09/22 17:17:07 1.125
+++ LVM2/libdm/libdm-common.c 2011/09/22 17:23:36 1.126
@@ -1056,6 +1056,106 @@
return _sysfs_dir;
}
+int dm_device_has_holders(uint32_t major, uint32_t minor)
+{
+ char sysfs_path[PATH_MAX];
+ struct stat st;
+
+ if (!*_sysfs_dir)
+ return 0;
+
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sdev/block/%" PRIu32
+ ":%" PRIu32 "/holders", _sysfs_dir, major, minor) < 0) {
+ log_error("sysfs_path dm_snprintf failed");
+ return 0;
+ }
+
+ if (stat(sysfs_path, &st)) {
+ log_sys_error("stat", sysfs_path);
+ return 0;
+ }
+
+ return !dm_is_empty_dir(sysfs_path);
+}
+
+static int _mounted_fs_on_device(const char *kernel_dev_name)
+{
+ char sysfs_path[PATH_MAX];
+ struct dirent *dirent;
+ DIR *d;
+ struct stat st;
+ int r = 0;
+
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sfs", _sysfs_dir) < 0) {
+ log_error("sysfs_path dm_snprintf failed");
+ return 0;
+ }
+
+ if (!(d = opendir(sysfs_path))) {
+ if (errno != ENOENT)
+ log_sys_error("opendir", sysfs_path);
+ return 0;
+ }
+
+ while ((dirent = readdir(d))) {
+ if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
+ continue;
+
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sfs/%s/%s",
+ _sysfs_dir, dirent->d_name, kernel_dev_name) < 0) {
+ log_error("sysfs_path dm_snprintf failed");
+ break;
+ }
+
+ if (!stat(sysfs_path, &st)) {
+ /* found! */
+ r = 1;
+ break;
+ }
+ else if (errno != ENOENT) {
+ log_sys_error("stat", sysfs_path);
+ break;
+ }
+ }
+
+ if (closedir(d))
+ log_error("_fs_present_on_device: %s: closedir failed", kernel_dev_name);
+
+ return r;
+}
+
+int dm_device_has_mounted_fs(uint32_t major, uint32_t minor)
+{
+ char sysfs_path[PATH_MAX];
+ char temp_path[PATH_MAX];
+ char *kernel_dev_name;
+ ssize_t size;
+
+ if (!*_sysfs_dir)
+ return 0;
+
+ /* Get kernel device name first */
+ if (dm_snprintf(sysfs_path, PATH_MAX, "%sdev/block/%" PRIu32 ":%" PRIu32,
+ _sysfs_dir, major, minor) < 0) {
+ log_error("sysfs_path dm_snprintf failed");
+ return 0;
+ }
+
+ if ((size = readlink(sysfs_path, temp_path, PATH_MAX)) < 0) {
+ log_sys_error("readlink", sysfs_path);
+ return 0;
+ }
+
+ if (!(kernel_dev_name = strrchr(temp_path, '/'))) {
+ log_error("Could not locate device kernel name in sysfs path %s", temp_path);
+ return 0;
+ }
+ kernel_dev_name += 1;
+
+ /* Check /sys/fs/<fs_name>/<kernel_dev_name> presence */
+ return _mounted_fs_on_device(kernel_dev_name);
+}
+
int dm_mknodes(const char *name)
{
struct dm_task *dmt;
--- LVM2/libdm/libdm-file.c 2011/08/04 17:56:12 1.16
+++ LVM2/libdm/libdm-file.c 2011/09/22 17:23:36 1.17
@@ -76,6 +76,26 @@
return 0;
}
+int dm_is_empty_dir(const char *dir)
+{
+ struct dirent *dirent;
+ DIR *d;
+
+ if (!(d = opendir(dir))) {
+ log_sys_error("opendir", dir);
+ return 0;
+ }
+
+ while ((dirent = readdir(d)))
+ if (strcmp(dirent->d_name, ".") && strcmp(dirent->d_name, ".."))
+ break;
+
+ if (closedir(d))
+ log_sys_error("closedir", dir);
+
+ return dirent ? 0 : 1;
+}
+
int dm_fclose(FILE *stream)
{
int prev_fail = ferror(stream);
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-09-22 17:17 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2011-09-22 17:17 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-09-22 17:17:07
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c
Log message:
Add dm_set_sysfs_dir to libdevmapper to set sysfs location.
Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.501&r2=1.502
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125
--- LVM2/WHATS_NEW_DM 2011/09/22 17:12:28 1.501
+++ LVM2/WHATS_NEW_DM 2011/09/22 17:17:07 1.502
@@ -1,5 +1,7 @@
Version 1.02.68 -
==================================
+ Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
+ Add dm_set_sysfs_dir to libdevmapper to set sysfs location.
Add --retry option for dmsetup remove to retry removal if not successful.
Add dm_task_retry_remove fn to use retry logic for device removal.
Remove unused passed parameters for _mirror_emit_segment_line().
--- LVM2/libdm/libdevmapper.h 2011/09/22 17:09:48 1.150
+++ LVM2/libdm/libdevmapper.h 2011/09/22 17:17:07 1.151
@@ -256,6 +256,12 @@
const char *dm_dir(void);
/*
+ * Configure sysfs directory, /sys by default
+ */
+int dm_set_sysfs_dir(const char *dir);
+const char *dm_sysfs_dir(void);
+
+/*
* Determine whether a major number belongs to device-mapper or not.
*/
int dm_is_dm_major(uint32_t major);
--- LVM2/libdm/libdm-common.c 2011/07/08 15:34:47 1.124
+++ LVM2/libdm/libdm-common.c 2011/09/22 17:17:07 1.125
@@ -58,6 +58,7 @@
#endif
static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
+static char _sysfs_dir[PATH_MAX] = "/sys/";
static int _verbose = 0;
static int _suspended_dev_counter = 0;
@@ -1008,32 +1009,53 @@
_pop_node_ops();
}
-int dm_set_dev_dir(const char *dev_dir)
+static int _canonicalize_and_set_dir(const char *src, const char *suffix, size_t max_len, char *dir)
{
size_t len;
const char *slash;
- if (*dev_dir != '/') {
- log_debug("Invalid dev_dir value, %s: "
- "not an absolute name.", dev_dir);
+
+ if (*src != '/') {
+ log_debug("Invalid directory value, %s: "
+ "not an absolute name.", src);
return 0;
}
- len = strlen(dev_dir);
- slash = dev_dir[len-1] == '/' ? "" : "/";
+ len = strlen(src);
+ slash = src[len-1] == '/' ? "" : "/";
- if (dm_snprintf(_dm_dir, sizeof _dm_dir, "%s%s%s", dev_dir, slash, DM_DIR) < 0) {
- log_debug("Invalid dev_dir value, %s: name too long.", dev_dir);
+ if (dm_snprintf(dir, max_len, "%s%s%s", src, slash, suffix ? suffix : "") < 0) {
+ log_debug("Invalid directory value, %s: name too long.", src);
return 0;
}
return 1;
}
+int dm_set_dev_dir(const char *dev_dir)
+{
+ return _canonicalize_and_set_dir(dev_dir, DM_DIR, sizeof _dm_dir, _dm_dir);
+}
+
const char *dm_dir(void)
{
return _dm_dir;
}
+int dm_set_sysfs_dir(const char *sysfs_dir)
+{
+ if (!sysfs_dir || !*sysfs_dir) {
+ _sysfs_dir[0] = '\0';
+ return 1;
+ }
+ else
+ return _canonicalize_and_set_dir(sysfs_dir, NULL, sizeof _sysfs_dir, _sysfs_dir);
+}
+
+const char *dm_sysfs_dir(void)
+{
+ return _sysfs_dir;
+}
+
int dm_mknodes(const char *name)
{
struct dm_task *dmt;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-09-22 17:09 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2011-09-22 17:09 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-09-22 17:09:49
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h
libdm/ioctl : libdm-iface.c libdm-targets.h
Log message:
Add dm_task_retry_remove fn to use retry logic for device removal.
This call ensures that the dm device removal is retried several
times before failing.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.499&r2=1.500
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.149&r2=1.150
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.31&r2=1.32
--- LVM2/WHATS_NEW_DM 2011/09/13 15:13:41 1.499
+++ LVM2/WHATS_NEW_DM 2011/09/22 17:09:48 1.500
@@ -1,6 +1,6 @@
Version 1.02.68 -
==================================
- Retry DM_DEVICE_REMOVE ioctl if device is busy.
+ Add dm_task_retry_remove fn to use retry logic for device removal.
Remove unused passed parameters for _mirror_emit_segment_line().
Add dm_config and string character escaping functions to libdevmapper.
Mark unreleased memory pools as internal error.
--- LVM2/libdm/libdevmapper.h 2011/09/02 01:32:09 1.149
+++ LVM2/libdm/libdevmapper.h 2011/09/22 17:09:48 1.150
@@ -191,6 +191,7 @@
int dm_task_query_inactive_table(struct dm_task *dmt);
int dm_task_suppress_identical_reload(struct dm_task *dmt);
int dm_task_secure_data(struct dm_task *dmt);
+int dm_task_retry_remove(struct dm_task *dmt);
/*
* Enable checks for common mistakes such as issuing ioctls in an unsafe order.
--- LVM2/libdm/ioctl/libdm-iface.c 2011/09/13 15:13:41 1.120
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/09/22 17:09:48 1.121
@@ -828,6 +828,13 @@
return 1;
}
+int dm_task_retry_remove(struct dm_task *dmt)
+{
+ dmt->retry_remove = 1;
+
+ return 1;
+}
+
int dm_task_query_inactive_table(struct dm_task *dmt)
{
dmt->query_inactive_table = 1;
@@ -1539,16 +1546,15 @@
return sanitised_message;
}
-#define DM_REMOVE_IOCTL_RETRIES 25
-
static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
- unsigned repeat_count)
+ unsigned buffer_repeat_count,
+ unsigned retry_repeat_count,
+ int *retryable)
{
struct dm_ioctl *dmi;
int ioctl_with_uevent;
- int retries = DM_REMOVE_IOCTL_RETRIES;
- dmi = _flatten(dmt, repeat_count);
+ dmi = _flatten(dmt, buffer_repeat_count);
if (!dmi) {
log_error("Couldn't create ioctl argument.");
return NULL;
@@ -1609,7 +1615,7 @@
}
log_debug("dm %s %s%s %s%s%s %s%.0d%s%.0d%s"
- "%s%c%c%s%s%s%s%s %.0" PRIu64 " %s [%u]",
+ "%s%c%c%s%s%s%s%s%s %.0" PRIu64 " %s [%u] (*%u)",
_cmd_data_v4[dmt->type].name,
dmt->new_uuid ? "UUID " : "",
dmi->name, dmi->uuid, dmt->newname ? " " : "",
@@ -1624,29 +1630,18 @@
dmt->no_flush ? 'N' : 'F',
dmt->read_only ? "R" : "",
dmt->skip_lockfs ? "S " : "",
+ dmt->retry_remove ? "T " : "",
dmt->secure_data ? "W " : "",
dmt->query_inactive_table ? "I " : "",
dmt->enable_checks ? "C" : "",
dmt->sector, _sanitise_message(dmt->message),
- dmi->data_size);
+ dmi->data_size, retry_repeat_count);
#ifdef DM_IOCTLS
-repeat_dm_ioctl:
if (ioctl(_control_fd, command, dmi) < 0) {
if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
(dmt->type == DM_DEVICE_MKNODES) ||
(dmt->type == DM_DEVICE_STATUS)))
dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */
- /*
- * FIXME: This is a workaround for asynchronous events generated
- * as a result of using the WATCH udev rule with which we
- * have no way of synchronizing. Processing such events in
- * parallel causes devices to be open.
- */
- else if (errno == EBUSY && (dmt->type == DM_DEVICE_REMOVE) && retries--) {
- log_debug("device-mapper: device is busy, retrying removal");
- usleep(200000);
- goto repeat_dm_ioctl;
- }
else {
if (_log_suppress)
log_verbose("device-mapper: %s ioctl "
@@ -1658,6 +1653,9 @@
"failed: %s",
_cmd_data_v4[dmt->type].name,
strerror(errno));
+
+ *retryable = errno == EBUSY;
+
_dm_zfree_dmi(dmi);
return NULL;
}
@@ -1680,6 +1678,9 @@
update_devs();
}
+#define DM_IOCTL_RETRIES 25
+#define DM_RETRY_USLEEP_DELAY 200000
+
int dm_task_run(struct dm_task *dmt)
{
struct dm_ioctl *dmi;
@@ -1687,6 +1688,8 @@
int check_udev;
int rely_on_udev;
int suspended_counter;
+ unsigned ioctl_retry = 1;
+ int retryable;
if ((unsigned) dmt->type >=
(sizeof(_cmd_data_v4) / sizeof(*_cmd_data_v4))) {
@@ -1734,7 +1737,14 @@
/* FIXME Detect and warn if cookie set but should not be. */
repeat_ioctl:
- if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor))) {
+ if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor,
+ ioctl_retry, &retryable))) {
+ if (retryable && dmt->type == DM_DEVICE_REMOVE &&
+ dmt->retry_remove && ++ioctl_retry <= DM_IOCTL_RETRIES) {
+ usleep(DM_RETRY_USLEEP_DELAY);
+ goto repeat_ioctl;
+ }
+
_udev_complete(dmt);
return 0;
}
--- LVM2/libdm/ioctl/libdm-targets.h 2011/08/09 17:56:48 1.31
+++ LVM2/libdm/ioctl/libdm-targets.h 2011/09/22 17:09:49 1.32
@@ -63,6 +63,7 @@
int cookie_set;
int new_uuid;
int secure_data;
+ int retry_remove;
int enable_checks;
char *uuid;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-08-19 16:26 agk
0 siblings, 0 replies; 23+ messages in thread
From: agk @ 2011-08-19 16:26 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2011-08-19 16:26:03
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-deptree.c
Log message:
restrict dm_tree_node_add_null_area
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.492&r2=1.493
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.106&r2=1.107
--- LVM2/WHATS_NEW_DM 2011/08/12 02:34:08 1.492
+++ LVM2/WHATS_NEW_DM 2011/08/19 16:26:02 1.493
@@ -1,5 +1,6 @@
Version 1.02.67 -
==================================
+ Add dm_tree_node_add_null_area for temporarily-missing raid devs tracked.
Version 1.02.66 - 12th August 2011
==================================
--- LVM2/libdm/libdevmapper.h 2011/08/18 19:41:22 1.143
+++ LVM2/libdm/libdevmapper.h 2011/08/19 16:26:03 1.144
@@ -516,6 +516,10 @@
const char *dev_name,
const char *dlid,
uint64_t offset);
+
+/*
+ * Only for temporarily-missing raid devices where changes are tracked.
+ */
int dm_tree_node_add_null_area(struct dm_tree_node *node, uint64_t offset);
/*
--- LVM2/libdm/libdm-deptree.c 2011/08/18 19:41:22 1.106
+++ LVM2/libdm/libdm-deptree.c 2011/08/19 16:26:03 1.107
@@ -2629,6 +2629,22 @@
seg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment);
+ switch (seg->type) {
+ case SEG_RAID1:
+ case SEG_RAID4:
+ case SEG_RAID5_LA:
+ case SEG_RAID5_RA:
+ case SEG_RAID5_LS:
+ case SEG_RAID5_RS:
+ case SEG_RAID6_ZR:
+ case SEG_RAID6_NR:
+ case SEG_RAID6_NC:
+ break;
+ default:
+ log_error("dm_tree_node_add_null_area() called on an unsupported segment type");
+ return 0;
+ }
+
if (!_add_area(node, seg, NULL, offset))
return_0;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-03-10 12:48 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2011-03-10 12:48 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-03-10 12:48:41
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h
libdm/datastruct: hash.c
Log message:
Use void pointer instead of char for binary key
dm_hash binary functions takes void* key - so there is no need to cast
pointers to char* (also the hash key does not have trailing '\0').
This is slight API change, but presents no change for the API user side
it just allows to write code easier as the casting could be removed.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.454&r2=1.455
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.136&r2=1.137
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/hash.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
--- LVM2/WHATS_NEW_DM 2011/03/08 22:43:19 1.454
+++ LVM2/WHATS_NEW_DM 2011/03/10 12:48:40 1.455
@@ -1,5 +1,6 @@
Version 1.02.64 -
===================================
+ Change dm_hash API for binary data to accept const void *key.
Fix memory access of empty params string in _reload_with_suppression_v4().
Lower severity of selabel_lookup and matchpathcon failure to log_debug.
Accept multiple mapped device names on many dmsetup command lines.
--- LVM2/libdm/libdevmapper.h 2011/02/18 14:38:48 1.136
+++ LVM2/libdm/libdevmapper.h 2011/03/10 12:48:40 1.137
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
*
* This file is part of the device-mapper userspace tools.
*
@@ -713,10 +713,10 @@
int dm_hash_insert(struct dm_hash_table *t, const char *key, void *data);
void dm_hash_remove(struct dm_hash_table *t, const char *key);
-void *dm_hash_lookup_binary(struct dm_hash_table *t, const char *key, uint32_t len);
-int dm_hash_insert_binary(struct dm_hash_table *t, const char *key, uint32_t len,
+void *dm_hash_lookup_binary(struct dm_hash_table *t, const void *key, uint32_t len);
+int dm_hash_insert_binary(struct dm_hash_table *t, const void *key, uint32_t len,
void *data);
-void dm_hash_remove_binary(struct dm_hash_table *t, const char *key, uint32_t len);
+void dm_hash_remove_binary(struct dm_hash_table *t, const void *key, uint32_t len);
unsigned dm_hash_get_num_entries(struct dm_hash_table *t);
void dm_hash_iter(struct dm_hash_table *t, dm_hash_iterate_fn f);
--- LVM2/libdm/datastruct/hash.c 2010/09/30 21:06:52 1.12
+++ LVM2/libdm/datastruct/hash.c 2011/03/10 12:48:41 1.13
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
*
* This file is part of the device-mapper userspace tools.
*
@@ -133,7 +133,7 @@
dm_free(t);
}
-static struct dm_hash_node **_find(struct dm_hash_table *t, const char *key,
+static struct dm_hash_node **_find(struct dm_hash_table *t, const void *key,
uint32_t len)
{
unsigned h = _hash(key, len) & (t->num_slots - 1);
@@ -150,15 +150,15 @@
return c;
}
-void *dm_hash_lookup_binary(struct dm_hash_table *t, const char *key,
- uint32_t len)
+void *dm_hash_lookup_binary(struct dm_hash_table *t, const void *key,
+ uint32_t len)
{
struct dm_hash_node **c = _find(t, key, len);
return *c ? (*c)->data : 0;
}
-int dm_hash_insert_binary(struct dm_hash_table *t, const char *key,
+int dm_hash_insert_binary(struct dm_hash_table *t, const void *key,
uint32_t len, void *data)
{
struct dm_hash_node **c = _find(t, key, len);
@@ -180,7 +180,7 @@
return 1;
}
-void dm_hash_remove_binary(struct dm_hash_table *t, const char *key,
+void dm_hash_remove_binary(struct dm_hash_table *t, const void *key,
uint32_t len)
{
struct dm_hash_node **c = _find(t, key, len);
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-02-18 14:38 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2011-02-18 14:38 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-02-18 14:38:48
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-report.c
Log message:
API change - support more const arg
As dm_report_field_string() doesn't modify content of data pointer,
it can be marked as const.
It's slight API change - but doesn't require any change on the user side
and supports wider range of arguments without const casting.
(i.e. we may use as paramater const lv struct this way: &lv->name)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.446&r2=1.447
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.135&r2=1.136
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-report.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42
--- LVM2/WHATS_NEW_DM 2011/02/09 12:11:21 1.446
+++ LVM2/WHATS_NEW_DM 2011/02/18 14:38:47 1.447
@@ -1,5 +1,6 @@
Version 1.02.64 -
===================================
+ Change dm_report_field_string() API to accept const char *const *data.
Version 1.02.63 - 9th February 2011
===================================
--- LVM2/libdm/libdevmapper.h 2011/02/04 19:33:53 1.135
+++ LVM2/libdm/libdevmapper.h 2011/02/18 14:38:48 1.136
@@ -1123,7 +1123,7 @@
* They take care of allocating copies of the data.
*/
int dm_report_field_string(struct dm_report *rh, struct dm_report_field *field,
- const char **data);
+ const char *const *data);
int dm_report_field_int32(struct dm_report *rh, struct dm_report_field *field,
const int32_t *data);
int dm_report_field_uint32(struct dm_report *rh, struct dm_report_field *field,
--- LVM2/libdm/libdm-report.c 2011/01/25 21:51:31 1.41
+++ LVM2/libdm/libdm-report.c 2011/02/18 14:38:48 1.42
@@ -102,7 +102,7 @@
*/
int dm_report_field_string(struct dm_report *rh,
- struct dm_report_field *field, const char **data)
+ struct dm_report_field *field, const char *const *data)
{
char *repstr;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-02-04 16:08 mbroz
0 siblings, 0 replies; 23+ messages in thread
From: mbroz @ 2011-02-04 16:08 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz@sourceware.org 2011-02-04 16:08:12
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c
libdm/ioctl : libdm-iface.c libdm-targets.h
libdm/misc : dm-ioctl.h
Log message:
Suport DM_SECURE_DATA_FLAG.
It will be user for cryptsetup to ensure buffers are properly
wiped when sending sensitive data (key).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.440&r2=1.441
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.133&r2=1.134
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-ioctl.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8
--- LVM2/WHATS_NEW_DM 2011/01/28 11:41:51 1.440
+++ LVM2/WHATS_NEW_DM 2011/02/04 16:08:11 1.441
@@ -1,5 +1,6 @@
Version 1.02.62 -
===================================
+ Add dm_task_secure_data to libdevmapper to wipe ioctl buffers in kernel.
Set DM_UDEV_DISABLE_OTHER_RULES_FLAG for suspended DM devices in udev rules.
Initialize pool object for each row in _output_as_rows().
--- LVM2/libdm/libdevmapper.h 2011/01/10 13:42:31 1.133
+++ LVM2/libdm/libdevmapper.h 2011/02/04 16:08:11 1.134
@@ -184,6 +184,7 @@
int dm_task_skip_lockfs(struct dm_task *dmt);
int dm_task_query_inactive_table(struct dm_task *dmt);
int dm_task_suppress_identical_reload(struct dm_task *dmt);
+int dm_task_secure_data(struct dm_task *dmt);
/*
* Control read_ahead.
--- LVM2/libdm/libdm-common.c 2011/01/12 20:42:51 1.107
+++ LVM2/libdm/libdm-common.c 2011/02/04 16:08:12 1.108
@@ -200,6 +200,7 @@
dmt->cookie_set = 0;
dmt->query_inactive_table = 0;
dmt->new_uuid = 0;
+ dmt->secure_data = 0;
return dmt;
}
--- LVM2/libdm/ioctl/libdm-iface.c 2011/01/31 11:54:55 1.89
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/02/04 16:08:12 1.90
@@ -1273,6 +1273,13 @@
return 1;
}
+int dm_task_secure_data(struct dm_task *dmt)
+{
+ dmt->secure_data = 1;
+
+ return 1;
+}
+
int dm_task_query_inactive_table(struct dm_task *dmt)
{
dmt->query_inactive_table = 1;
@@ -1521,6 +1528,8 @@
dmi->flags |= DM_READONLY_FLAG;
if (dmt->skip_lockfs)
dmi->flags |= DM_SKIP_LOCKFS_FLAG;
+ if (dmt->secure_data)
+ dmi->flags |= DM_SECURE_DATA_FLAG;
if (dmt->query_inactive_table) {
if (_dm_version_minor < 16)
log_warn("WARNING: Inactive table query unsupported "
@@ -1737,6 +1746,7 @@
task->read_only = dmt->read_only;
task->head = dmt->head;
task->tail = dmt->tail;
+ task->secure_data = dmt->secure_data;
r = dm_task_run(task);
@@ -1940,7 +1950,7 @@
}
log_debug("dm %s %s%s %s%s%s %s%.0d%s%.0d%s"
- "%s%c%c%s%s %.0" PRIu64 " %s [%u]",
+ "%s%c%c%s%s%s %.0" PRIu64 " %s [%u]",
_cmd_data_v4[dmt->type].name,
dmt->new_uuid ? "UUID " : "",
dmi->name, dmi->uuid, dmt->newname ? " " : "",
@@ -1954,6 +1964,7 @@
dmt->no_open_count ? 'N' : 'O',
dmt->no_flush ? 'N' : 'F',
dmt->skip_lockfs ? "S " : "",
+ dmt->secure_data ? "W " : "",
dmt->query_inactive_table ? "I " : "",
dmt->sector, _sanitise_message(dmt->message),
dmi->data_size);
--- LVM2/libdm/ioctl/libdm-targets.h 2010/10/15 01:10:28 1.27
+++ LVM2/libdm/ioctl/libdm-targets.h 2011/02/04 16:08:12 1.28
@@ -63,6 +63,7 @@
uint64_t existing_table_size;
int cookie_set;
int new_uuid;
+ int secure_data;
char *uuid;
};
--- LVM2/libdm/misc/dm-ioctl.h 2010/10/25 11:44:21 1.7
+++ LVM2/libdm/misc/dm-ioctl.h 2011/02/04 16:08:12 1.8
@@ -269,9 +269,9 @@
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 19
+#define DM_VERSION_MINOR 20
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl (2010-10-14)"
+#define DM_VERSION_EXTRA "-ioctl (2011-02-02)"
/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -330,4 +330,10 @@
*/
#define DM_UUID_FLAG (1 << 14) /* In */
+/*
+ * If set, all buffers are wiped after use. Used when sending
+ * or requesting sensitive data like crypt key.
+ */
+#define DM_SECURE_DATA_FLAG (1 << 15) /* In */
+
#endif /* _LINUX_DM_IOCTL_H */
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2011-01-04 14:43 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2011-01-04 14:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2011-01-04 14:43:54
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h
libdm/ioctl : libdm-iface.c
Log message:
Export DM_CONTROL_NODE_UMASK and use it while creating /dev/mapper/control.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.434&r2=1.435
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.131&r2=1.132
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87
--- LVM2/WHATS_NEW_DM 2010/12/21 21:08:52 1.434
+++ LVM2/WHATS_NEW_DM 2011/01/04 14:43:53 1.435
@@ -1,5 +1,6 @@
Version 1.02.61 -
====================================
+ Export DM_CONTROL_NODE_UMASK and use it while creating /dev/mapper/control.
Version 1.02.60 - 20th December 2010
====================================
--- LVM2/libdm/libdevmapper.h 2010/12/20 13:39:12 1.131
+++ LVM2/libdm/libdevmapper.h 2011/01/04 14:43:54 1.132
@@ -1219,6 +1219,7 @@
int dm_udev_wait(uint32_t cookie);
#define DM_DEV_DIR_UMASK 0022
+#define DM_CONTROL_NODE_UMASK 0177
#ifdef __cplusplus
}
--- LVM2/libdm/ioctl/libdm-iface.c 2010/12/13 10:43:58 1.86
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/01/04 14:43:54 1.87
@@ -282,12 +282,14 @@
log_verbose("Creating device %s (%u, %u)", control, major, minor);
(void) dm_prepare_selinux_context(control, S_IFCHR);
+ old_umask = umask(DM_CONTROL_NODE_UMASK);
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
MKDEV(major, minor)) < 0) {
log_sys_error("mknod", control);
(void) dm_prepare_selinux_context(NULL, 0);
return 0;
}
+ umask(old_umask);
(void) dm_prepare_selinux_context(NULL, 0);
return 1;
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2010-10-25 13:13 zkabelac
0 siblings, 0 replies; 23+ messages in thread
From: zkabelac @ 2010-10-25 13:13 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-25 13:13:53
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-string.c
Log message:
Use const pointer for return value of dm_basename
Fix return pointer to const as it is created from passed input const pointer.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.417&r2=1.418
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.127&r2=1.128
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-string.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
--- LVM2/WHATS_NEW_DM 2010/10/15 01:10:27 1.417
+++ LVM2/WHATS_NEW_DM 2010/10/25 13:13:53 1.418
@@ -1,5 +1,6 @@
Version 1.02.56 -
=====================================
+ Fix API for dm_basename() and return const pointer for const input pointer.
Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation.
--- LVM2/libdm/libdevmapper.h 2010/10/15 01:10:28 1.127
+++ LVM2/libdm/libdevmapper.h 2010/10/25 13:13:53 1.128
@@ -955,7 +955,7 @@
/*
* Returns pointer to the last component of the path.
*/
-char *dm_basename(const char *path);
+const char *dm_basename(const char *path);
/**************************
* file/stream manipulation
--- LVM2/libdm/libdm-string.c 2010/07/09 15:34:47 1.12
+++ LVM2/libdm/libdm-string.c 2010/10/25 13:13:53 1.13
@@ -123,11 +123,11 @@
return n;
}
-char *dm_basename(const char *path)
+const char *dm_basename(const char *path)
{
- char *p = strrchr(path, '/');
+ const char *p = strrchr(path, '/');
- return p ? p + 1 : (char *) path;
+ return p ? p + 1 : path;
}
int dm_asprintf(char **result, const char *format, ...)
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2010-10-15 1:10 agk
0 siblings, 0 replies; 23+ messages in thread
From: agk @ 2010-10-15 1:10 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2010-10-15 01:10:29
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c
libdm/ioctl : libdm-iface.c libdm-targets.h
libdm/misc : dm-ioctl.h
man : dmsetup.8.in
tools : dmsetup.c
Log message:
Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation. (pjones)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.416&r2=1.417
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.126&r2=1.127
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-ioctl.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146
--- LVM2/WHATS_NEW_DM 2010/09/27 19:09:34 1.416
+++ LVM2/WHATS_NEW_DM 2010/10/15 01:10:27 1.417
@@ -1,5 +1,7 @@
Version 1.02.56 -
=====================================
+ Add --setuuid to dmsetup rename.
+ Add dm_task_set_newuuid to set uuid of mapped device post-creation.
Version 1.02.55 - 24th September 2010
=====================================
--- LVM2/libdm/libdevmapper.h 2010/09/30 21:06:52 1.126
+++ LVM2/libdm/libdevmapper.h 2010/10/15 01:10:28 1.127
@@ -167,6 +167,7 @@
int dm_task_set_ro(struct dm_task *dmt);
int dm_task_set_newname(struct dm_task *dmt, const char *newname);
+int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid);
int dm_task_set_minor(struct dm_task *dmt, int minor);
int dm_task_set_major(struct dm_task *dmt, int major);
int dm_task_set_major_minor(struct dm_task *dmt, int major, int minor, int allow_default_major_fallback);
--- LVM2/libdm/libdm-common.c 2010/09/30 21:06:52 1.100
+++ LVM2/libdm/libdm-common.c 2010/10/15 01:10:28 1.101
@@ -192,6 +192,7 @@
dmt->event_nr = 0;
dmt->cookie_set = 0;
dmt->query_inactive_table = 0;
+ dmt->new_uuid = 0;
return dmt;
}
--- LVM2/libdm/ioctl/libdm-iface.c 2010/08/18 13:11:57 1.81
+++ LVM2/libdm/ioctl/libdm-iface.c 2010/10/15 01:10:28 1.82
@@ -826,6 +826,11 @@
if (dmt->type == DM_DEVICE_TABLE)
dmi->flags |= DM_STATUS_TABLE_FLAG;
+ if (dmt->new_uuid) {
+ log_error("Changing UUID is not supported by kernel.");
+ goto bad;
+ }
+
log_debug("dm %s %s %s%s%s [%u]", _cmd_data_v1[dmt->type].name,
dmi->name, dmi->uuid, dmt->newname ? " " : "",
dmt->newname ? dmt->newname : "",
@@ -1185,6 +1190,22 @@
return 1;
}
+int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid)
+{
+ if (strlen(newuuid) >= DM_UUID_LEN) {
+ log_error("Uuid \"%s\" too long", newuuid);
+ return 0;
+ }
+
+ if (!(dmt->newname = dm_strdup(newuuid))) {
+ log_error("dm_task_set_newuuid: strdup(%s) failed", newuuid);
+ return 0;
+ }
+ dmt->new_uuid = 1;
+
+ return 1;
+}
+
int dm_task_set_newname(struct dm_task *dmt, const char *newname)
{
if (strchr(newname, '/')) {
@@ -1201,6 +1222,7 @@
log_error("dm_task_set_newname: strdup(%s) failed", newname);
return 0;
}
+ dmt->new_uuid = 0;
return 1;
}
@@ -1399,7 +1421,7 @@
}
if (count && dmt->newname) {
- log_error("targets and newname are incompatible");
+ log_error("targets and rename are incompatible");
return NULL;
}
@@ -1409,12 +1431,12 @@
}
if (dmt->newname && (dmt->sector || dmt->message)) {
- log_error("message and newname are incompatible");
+ log_error("message and rename are incompatible");
return NULL;
}
if (dmt->newname && dmt->geometry) {
- log_error("geometry and newname are incompatible");
+ log_error("geometry and rename are incompatible");
return NULL;
}
@@ -1514,6 +1536,14 @@
"by kernel. It will use live table.");
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
}
+ if (dmt->new_uuid) {
+ if (_dm_version_minor < 19) {
+ log_error("WARNING: Setting UUID unsupported by "
+ "kernel. Aborting operation.");
+ goto bad;
+ }
+ dmi->flags |= DM_NEW_UUID_FLAG;
+ }
dmi->target_count = count;
dmi->event_nr = dmt->event_nr;
@@ -1910,9 +1940,10 @@
}
}
- log_debug("dm %s %s %s%s%s %s%.0d%s%.0d%s"
+ log_debug("dm %s %s%s %s%s%s %s%.0d%s%.0d%s"
"%s%c%c%s%s %.0" PRIu64 " %s [%u]",
_cmd_data_v4[dmt->type].name,
+ dmt->new_uuid ? "UUID " : "",
dmi->name, dmi->uuid, dmt->newname ? " " : "",
dmt->newname ? dmt->newname : "",
dmt->major > 0 ? "(" : "",
@@ -2044,7 +2075,7 @@
case DM_DEVICE_RENAME:
/* FIXME Kernel needs to fill in dmi->name */
- if (dmt->dev_name && !udev_only)
+ if (!dmt->new_uuid && dmt->dev_name && !udev_only)
rename_dev_node(dmt->dev_name, dmt->newname,
check_udev);
break;
--- LVM2/libdm/ioctl/libdm-targets.h 2009/11/06 00:43:09 1.26
+++ LVM2/libdm/ioctl/libdm-targets.h 2010/10/15 01:10:28 1.27
@@ -62,6 +62,7 @@
int suppress_identical_reload;
uint64_t existing_table_size;
int cookie_set;
+ int new_uuid;
char *uuid;
};
--- LVM2/libdm/misc/dm-ioctl.h 2010/06/01 16:08:14 1.5
+++ LVM2/libdm/misc/dm-ioctl.h 2010/10/15 01:10:28 1.6
@@ -46,7 +46,7 @@
* Remove a device, destroy any tables.
*
* DM_DEV_RENAME:
- * Rename a device.
+ * Rename a device or set its uuid if none was previously supplied.
*
* DM_SUSPEND:
* This performs both suspend and resume, depending which flag is
@@ -269,9 +269,9 @@
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 17
+#define DM_VERSION_MINOR 19
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl (2010-03-05)"
+#define DM_VERSION_EXTRA "-ioctl (2010-10-14)"
/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -324,4 +324,10 @@
*/
#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */
+/*
+ * If set, rename changes the uuid not the name. Only permitted
+ * if no uuid was previously supplied: an existing uuid cannot be changed.
+ */
+#define DM_NEW_UUID_FLAG (1 << 14) /* In */
+
#endif /* _LINUX_DM_IOCTL_H */
--- LVM2/man/dmsetup.8.in 2010/05/27 19:00:20 1.35
+++ LVM2/man/dmsetup.8.in 2010/10/15 01:10:28 1.36
@@ -33,6 +33,9 @@
.B dmsetup rename
.I device_name new_name
.br
+.B dmsetup rename
+.I device_name --setuuid uuid
+.br
.B dmsetup message
.I device_name sector message
.br
@@ -285,6 +288,11 @@
.I device_name new_name
.br
Renames a device.
+.IP \fBrename
+.I device_name --setuuid uuid
+.br
+Sets the uuid of a device that was created without a uuid.
+After a uuid has been set it cannot be changed.
.IP \fBresume
.I device_name
.br
--- LVM2/tools/dmsetup.c 2010/09/30 21:06:53 1.145
+++ LVM2/tools/dmsetup.c 2010/10/15 01:10:29 1.146
@@ -140,6 +140,7 @@
READAHEAD_ARG,
ROWS_ARG,
SEPARATOR_ARG,
+ SETUUID_ARG,
SHOWKEYS_ARG,
SORT_ARG,
TABLE_ARG,
@@ -665,7 +666,10 @@
if (!_set_task_device(dmt, (argc == 3) ? argv[1] : NULL, 0))
goto out;
- if (!dm_task_set_newname(dmt, argv[argc - 1]))
+ if (_switches[SETUUID_ARG]) {
+ if (!dm_task_set_newuuid(dmt, argv[argc - 1]))
+ goto out;
+ } else if (!dm_task_set_newname(dmt, argv[argc - 1]))
goto out;
if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
@@ -2699,7 +2703,7 @@
{"load", "<device> [<table_file>]", 0, 2, _load},
{"clear", "<device>", 0, 1, _clear},
{"reload", "<device> [<table_file>]", 0, 2, _load},
- {"rename", "<device> <new_name>", 1, 2, _rename},
+ {"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, _rename},
{"message", "<device> <sector> <message>", 2, -1, _message},
{"ls", "[--target <target_type>] [--exec <command>] [--tree [-o options]]", 0, 0, _ls},
{"info", "[<device>]", 0, 1, _info},
@@ -3106,6 +3110,7 @@
{"readahead", 1, &ind, READAHEAD_ARG},
{"rows", 0, &ind, ROWS_ARG},
{"separator", 1, &ind, SEPARATOR_ARG},
+ {"setuuid", 0, &ind, SETUUID_ARG},
{"showkeys", 0, &ind, SHOWKEYS_ARG},
{"sort", 1, &ind, SORT_ARG},
{"table", 1, &ind, TABLE_ARG},
@@ -3278,6 +3283,8 @@
}
if ((ind == ROWS_ARG))
_switches[ROWS_ARG]++;
+ if ((ind == SETUUID_ARG))
+ _switches[SETUUID_ARG]++;
if ((ind == SHOWKEYS_ARG))
_switches[SHOWKEYS_ARG]++;
if ((ind == TABLE_ARG)) {
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2010-04-28 13:37 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2010-04-28 13:37 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2010-04-28 13:37:38
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h
libdm/ioctl : libdm-iface.c
tools : dmsetup.c
udev : 10-dm.rules.in
Log message:
Add support for new IMPORT{db} udev rule.
This rule appeared in udev v152 and it helps us to support spurious events
where we didn't have any flags set (events originated in udevadm trigger
or the watch rule). These flags are important to direct the rule application.
Now, with the help of this rule, we can regenerate old udev db content.
To implement this correctly, we need to flag all proper DM udev events with
DM_UDEV_PRIMARY_SOURCE_FLAG. That happens automatically for all ioctls
generating events originated in libdevmapper.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.363&r2=1.364
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.111&r2=1.112
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8
--- LVM2/WHATS_NEW_DM 2010/04/26 09:05:50 1.363
+++ LVM2/WHATS_NEW_DM 2010/04/28 13:37:36 1.364
@@ -1,5 +1,7 @@
Version 1.02.47 -
=================================
+ Add support for new IMPORT{db} udev rule.
+ Add DM_UDEV_PRIMARY_SOURCE_FLAG udev flag to recognize proper DM events.
Also include udev libs in libdevmapper.pc when udev_sync is enabled.
Cache bitset locations to speed up _calc_states.
Add a regex optimisation pass for shared character prefixes.
--- LVM2/libdm/libdevmapper.h 2010/04/20 13:58:22 1.111
+++ LVM2/libdm/libdevmapper.h 2010/04/28 13:37:36 1.112
@@ -1094,6 +1094,16 @@
* udev does something improperly.
*/
#define DM_UDEV_DISABLE_LIBRARY_FALLBACK 0x0020
+/*
+ * DM_UDEV_PRIMARY_SOURCE_FLAG is automatically appended by
+ * libdevmapper for all ioctls generating udev uevents. Once used in
+ * udev rules, we know if this is a real "primary sourced" event or not.
+ * We need to distinguish real events originated in libdevmapper from
+ * any spurious events to gather all missing information (e.g. events
+ * generated as a result of "udevadm trigger" command or as a result
+ * of the "watch" udev rule).
+ */
+#define DM_UDEV_PRIMARY_SOURCE_FLAG 0x0040
int dm_cookie_supported(void);
--- LVM2/libdm/ioctl/libdm-iface.c 2010/04/07 15:57:20 1.70
+++ LVM2/libdm/ioctl/libdm-iface.c 2010/04/28 13:37:37 1.71
@@ -1736,31 +1736,44 @@
dmt->type == DM_DEVICE_REMOVE ||
dmt->type == DM_DEVICE_RENAME;
- /*
- * Prevent udev vs. libdevmapper race when processing nodes and
- * symlinks. This can happen when the udev rules are installed and
- * udev synchronisation code is enabled in libdevmapper but the
- * software using libdevmapper does not make use of it (by not calling
- * dm_task_set_cookie before). We need to instruct the udev rules not
- * to be applied at all in this situation so we can gracefully fallback
- * to libdevmapper's node and symlink creation code.
- */
- if (dm_udev_get_sync_support() && !dmt->cookie_set && ioctl_with_uevent) {
- log_debug("Cookie value is not set while trying to call "
- "DM_DEVICE_RESUME, DM_DEVICE_REMOVE or DM_DEVICE_RENAME "
- "ioctl. Please, consider using libdevmapper's udev "
- "synchronisation interface or disable it explicitly "
- "by calling dm_udev_set_sync_support(0).");
- log_debug("Switching off device-mapper and all subsystem related "
- "udev rules. Falling back to libdevmapper node creation.");
+ if (ioctl_with_uevent && dm_cookie_supported()) {
/*
- * Disable general dm and subsystem rules but keep dm disk rules
- * if not flagged out explicitly before. We need /dev/disk content
- * for the software that expects it.
- */
- dmi->event_nr |= (DM_UDEV_DISABLE_DM_RULES_FLAG |
- DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG) <<
+ * Always mark events coming from libdevmapper as
+ * "primary sourced". This is needed to distinguish
+ * any spurious events so we can act appropriately.
+ * This needs to be applied even when udev_sync is
+ * not used because udev flags could be used alone.
+ */
+ dmi->event_nr |= DM_UDEV_PRIMARY_SOURCE_FLAG <<
DM_UDEV_FLAGS_SHIFT;
+
+ /*
+ * Prevent udev vs. libdevmapper race when processing nodes
+ * and symlinks. This can happen when the udev rules are
+ * installed and udev synchronisation code is enabled in
+ * libdevmapper but the software using libdevmapper does not
+ * make use of it (by not calling dm_task_set_cookie before).
+ * We need to instruct the udev rules not to be applied at
+ * all in this situation so we can gracefully fallback to
+ * libdevmapper's node and symlink creation code.
+ */
+ if (!dmt->cookie_set && dm_udev_get_sync_support()) {
+ log_debug("Cookie value is not set while trying to call "
+ "DM_DEVICE_RESUME, DM_DEVICE_REMOVE or DM_DEVICE_RENAME "
+ "ioctl. Please, consider using libdevmapper's udev "
+ "synchronisation interface or disable it explicitly "
+ "by calling dm_udev_set_sync_support(0).");
+ log_debug("Switching off device-mapper and all subsystem related "
+ "udev rules. Falling back to libdevmapper node creation.");
+ /*
+ * Disable general dm and subsystem rules but keep
+ * dm disk rules if not flagged out explicitly before.
+ * We need /dev/disk content for the software that expects it.
+ */
+ dmi->event_nr |= (DM_UDEV_DISABLE_DM_RULES_FLAG |
+ DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG) <<
+ DM_UDEV_FLAGS_SHIFT;
+ }
}
log_debug("dm %s %s %s%s%s %s%.0d%s%.0d%s"
--- LVM2/tools/dmsetup.c 2010/04/07 15:57:20 1.137
+++ LVM2/tools/dmsetup.c 2010/04/28 13:37:37 1.138
@@ -842,7 +842,8 @@
"DISABLE_OTHER_RULES",
"LOW_PRIORITY",
"DISABLE_LIBRARY_FALLBACK",
- 0, 0};
+ "PRIMARY_SOURCE",
+ 0};
if (!(cookie = _get_cookie_value(argv[1])))
return 0;
--- LVM2/udev/10-dm.rules.in 2009/12/07 12:03:47 1.7
+++ LVM2/udev/10-dm.rules.in 2010/04/28 13:37:37 1.8
@@ -44,6 +44,28 @@
ACTION!="add|change", GOTO="dm_end"
+# There is no cookie set nor any flags encoded in events not originating
+# in libdevmapper so we need to detect this and try to behave correctly.
+# For such spurious events, regenerate all flags from current udev database content
+# (this information would normally be inaccessible for spurious ADD and CHANGE events).
+ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="dm_flags_done"
+IMPORT{db}="DM_UDEV_DISABLE_DM_RULES_FLAG"
+IMPORT{db}="DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG"
+IMPORT{db}="DM_UDEV_DISABLE_DISK_RULES_FLAG"
+IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG"
+IMPORT{db}="DM_UDEV_LOW_PRIORITY_FLAG"
+IMPORT{db}="DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG"
+IMPORT{db}="DM_UDEV_FLAG7"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG0"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG2"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG3"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG4"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6"
+IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
+LABEL="dm_flags_done"
+
# Normally, we operate on "change" events only. But when
# coldplugging, there's an "add" event present. We have to
# recognize this and do our actions in this particular
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2009-11-13 12:43 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2009-11-13 12:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2009-11-13 12:43:22
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-deptree.c
libdm/ioctl : libdm-iface.c
tools : dmsetup.c
Log message:
Support udev flags even when udev_sync is disabled or not compiled in.
This provides better support for environments where udev rules are installed
but udev_sync is not compiled in (however, using udev_sync is highly
recommended). It also provides consistent and expected functionality even
when '--noudevsync' option is used.
There is still requirement for kernel >= 2.6.31 for the flags to work though
(it uses DM cookies to pass the flags into the kernel and set them in udev
event environment that we can read in udev rules).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.313&r2=1.314
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128
--- LVM2/WHATS_NEW_DM 2009/11/13 12:33:27 1.313
+++ LVM2/WHATS_NEW_DM 2009/11/13 12:43:21 1.314
@@ -1,5 +1,6 @@
Version 1.02.40 -
===================================
+ Support udev flags even when udev_sync is disabled or not compiled in.
Remove 'last_rule' from udev rules: honor ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}.
Add dmsetup --inactive support.
Add dm_task_query_inactive_table to libdevmapper for kernel driver >= 4.16.
--- LVM2/libdm/libdevmapper.h 2009/11/13 12:33:27 1.102
+++ LVM2/libdm/libdevmapper.h 2009/11/13 12:43:21 1.103
@@ -1032,6 +1032,10 @@
* of udev rules we use by decoding the cookie prefix. When doing the
* notification, we replace the cookie prefix with DM_COOKIE_MAGIC,
* so we notify the right semaphore.
+ * It is still possible to use cookies for passing the flags to udev
+ * rules even when udev_sync is disabled. The base part of the cookie
+ * will be zero (there's no notification semaphore) and prefix will be
+ * set then. However, having udev_sync enabled is highly recommended.
*/
#define DM_COOKIE_MAGIC 0x0D4D
#define DM_UDEV_FLAGS_MASK 0xFFFF0000
@@ -1076,7 +1080,7 @@
int dm_cookie_supported(void);
/*
- * Udev notification functions.
+ * Udev synchronisation functions.
*/
void dm_udev_set_sync_support(int sync_with_udev);
int dm_udev_get_sync_support(void);
--- LVM2/libdm/libdm-common.c 2009/11/06 00:43:09 1.90
+++ LVM2/libdm/libdm-common.c 2009/11/13 12:43:22 1.91
@@ -886,6 +886,8 @@
int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
{
+ if (dm_cookie_supported())
+ dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
*cookie = 0;
return 1;
@@ -1141,8 +1143,11 @@
{
int semid;
+ if (dm_cookie_supported())
+ dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
+
if (!dm_udev_get_sync_support()) {
- dmt->event_nr = *cookie = 0;
+ *cookie = 0;
return 1;
}
@@ -1159,8 +1164,7 @@
goto bad;
}
- dmt->event_nr = (~DM_UDEV_FLAGS_MASK & *cookie) |
- (flags << DM_UDEV_FLAGS_SHIFT);
+ dmt->event_nr |= ~DM_UDEV_FLAGS_MASK & *cookie;
dmt->cookie_set = 1;
log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task "
--- LVM2/libdm/libdm-deptree.c 2009/10/26 14:29:34 1.61
+++ LVM2/libdm/libdm-deptree.c 2009/11/13 12:43:22 1.62
@@ -1039,7 +1039,7 @@
continue;
if (!_deactivate_node(name, info.major, info.minor,
- &dnode->dtree->cookie, dnode->udev_flags)) {
+ &child->dtree->cookie, child->udev_flags)) {
log_error("Unable to deactivate %s (%" PRIu32
":%" PRIu32 ")", name, info.major,
info.minor);
--- LVM2/libdm/ioctl/libdm-iface.c 2009/11/06 00:43:09 1.65
+++ LVM2/libdm/ioctl/libdm-iface.c 2009/11/13 12:43:22 1.66
@@ -1548,6 +1548,7 @@
task->gid = dmt->gid;
task->mode = dmt->mode;
/* FIXME: Just for udev_check in dm_task_run. Can we avoid this? */
+ task->event_nr = dmt->event_nr & DM_UDEV_FLAGS_MASK;
task->cookie_set = dmt->cookie_set;
r = dm_task_run(task);
--- LVM2/tools/dmsetup.c 2009/11/06 00:43:10 1.127
+++ LVM2/tools/dmsetup.c 2009/11/13 12:43:22 1.128
@@ -843,9 +843,17 @@
if (!(cookie = _get_cookie_value(argv[1])))
return 0;
- /* strip flags from the cookie and use cookie magic instead */
- cookie = (cookie & ~DM_UDEV_FLAGS_MASK) |
- (DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT);
+ /*
+ * Strip flags from the cookie and use cookie magic instead.
+ * If the cookie has non-zero prefix and the base is zero then
+ * this one carries flags to control udev rules only and it is
+ * not meant to be for notification. Return with success in this
+ * situation.
+ */
+ if (!(cookie &= ~DM_UDEV_FLAGS_MASK))
+ return 1;
+
+ cookie |= DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT;
return dm_udev_complete(cookie);
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2009-10-22 12:55 prajnoha
0 siblings, 0 replies; 23+ messages in thread
From: prajnoha @ 2009-10-22 12:55 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2009-10-22 12:55:48
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-deptree.c
libdm/ioctl : libdm-iface.c
tools : dmsetup.c
Log message:
Add udev flags support in libdevmapper and provide 'dmsetup udevflags' command to decode them.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.305&r2=1.306
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125
--- LVM2/WHATS_NEW_DM 2009/10/12 04:06:42 1.305
+++ LVM2/WHATS_NEW_DM 2009/10/22 12:55:47 1.306
@@ -1,5 +1,7 @@
Version 1.02.39 -
=====================================
+ Add dmsetup udevflags command to decode udev flags in given cookie value.
+ Add udev flags support in libdevmapper.
Make libdm ABI consistent when built with/without selinux support.
Version 1.02.38 - 25th September 2009
--- LVM2/libdm/libdevmapper.h 2009/09/25 11:58:00 1.97
+++ LVM2/libdm/libdevmapper.h 2009/10/22 12:55:47 1.98
@@ -164,7 +164,7 @@
int dm_task_set_uid(struct dm_task *dmt, uid_t uid);
int dm_task_set_gid(struct dm_task *dmt, gid_t gid);
int dm_task_set_mode(struct dm_task *dmt, mode_t mode);
-int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie);
+int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags);
int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr);
int dm_task_set_geometry(struct dm_task *dmt, const char *cylinders, const char *heads, const char *sectors, const char *start);
int dm_task_set_message(struct dm_task *dmt, const char *message);
@@ -1014,7 +1014,38 @@
void dm_report_field_set_value(struct dm_report_field *field, const void *value,
const void *sortvalue);
+/* Cookie prefixes.
+ * The cookie value consists of a prefix (16 bits) and a base (16 bits).
+ * We can use the prefix to store the flags. These flags are sent to
+ * kernel within given dm task. When returned back to userspace in
+ * DM_COOKIE udev environment variable, we can control several aspects
+ * of udev rules we use by decoding the cookie prefix. When doing the
+ * notification, we replace the cookie prefix with DM_COOKIE_MAGIC,
+ * so we notify the right semaphore.
+ */
#define DM_COOKIE_MAGIC 0x0D4D
+#define DM_UDEV_FLAGS_MASK 0xFFFF0000
+#define DM_UDEV_FLAGS_SHIFT 16
+/*
+ * DM_UDEV_DISABLE_SUBSYTEM_RULES_FLAG is set in case we need to disable
+ * subsystem udev rules, but still we need the general DM udev rules to
+ * be applied (to create the nodes and symlinks under /dev and /dev/disk).
+ */
+#define DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG 0x0001
+/*
+ * DM_UDEV_DISABLE_DISK_RULES_FLAG is set in case we need to disable
+ * general DM rules that set symlinks in /dev/disk directory.
+ */
+#define DM_UDEV_DISABLE_DISK_RULES_FLAG 0x0002
+/*
+ * DM_UDEV_LOW_PRIORITY_FLAG is set in case we need to instruct the
+ * udev rules to give low priority to the device that is currently
+ * processed. For example, this provides a way to select which symlinks
+ * could be overwritten by high priority ones if their names are equal.
+ * Common situation is a name based on FS UUID while using origin and
+ * snapshot devices.
+ */
+#define DM_UDEV_LOW_PRIORITY_FLAG 0x0004
int dm_cookie_supported(void);
--- LVM2/libdm/libdm-common.c 2009/10/12 04:06:42 1.86
+++ LVM2/libdm/libdm-common.c 2009/10/22 12:55:47 1.87
@@ -876,7 +876,7 @@
return 0;
}
-int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie)
+int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
{
*cookie = 0;
@@ -1129,7 +1129,7 @@
return 0;
}
-int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie)
+int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
{
int semid;
@@ -1151,11 +1151,11 @@
goto bad;
}
- dmt->event_nr = *cookie;
+ dmt->event_nr = (0x0000FFFF & *cookie) | (flags << 16);
dmt->cookie_set = 1;
- log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task",
- dmt->event_nr, semid);
+ log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task "
+ "with flags 0x%" PRIx16, *cookie, semid, flags);
return 1;
--- LVM2/libdm/libdm-deptree.c 2009/09/25 18:30:27 1.58
+++ LVM2/libdm/libdm-deptree.c 2009/10/22 12:55:48 1.59
@@ -841,7 +841,7 @@
if (!dm_task_no_open_count(dmt))
log_error("Failed to disable open_count");
- if (!dm_task_set_cookie(dmt, cookie))
+ if (!dm_task_set_cookie(dmt, cookie, 0))
goto out;
r = dm_task_run(dmt);
@@ -881,7 +881,7 @@
if (!dm_task_no_open_count(dmt))
log_error("Failed to disable open_count");
- if (!dm_task_set_cookie(dmt, cookie))
+ if (!dm_task_set_cookie(dmt, cookie, 0))
goto out;
r = dm_task_run(dmt);
@@ -924,7 +924,7 @@
if (!dm_task_set_read_ahead(dmt, read_ahead, read_ahead_flags))
log_error("Failed to set read ahead");
- if (!dm_task_set_cookie(dmt, cookie))
+ if (!dm_task_set_cookie(dmt, cookie, 0))
goto out;
if ((r = dm_task_run(dmt)))
--- LVM2/libdm/ioctl/libdm-iface.c 2009/09/25 11:58:00 1.62
+++ LVM2/libdm/ioctl/libdm-iface.c 2009/10/22 12:55:48 1.63
@@ -1492,8 +1492,14 @@
*/
static int _udev_complete(struct dm_task *dmt)
{
- if (dmt->cookie_set)
- return dm_udev_complete(dmt->event_nr);
+ uint32_t cookie;
+
+ if (dmt->cookie_set) {
+ /* strip flags from the cookie and use cookie magic instead */
+ cookie = (dmt->event_nr & ~DM_UDEV_FLAGS_MASK) |
+ (DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT);
+ return dm_udev_complete(cookie);
+ }
return 1;
}
--- LVM2/tools/dmsetup.c 2009/09/11 15:53:58 1.124
+++ LVM2/tools/dmsetup.c 2009/10/22 12:55:48 1.125
@@ -595,7 +595,7 @@
if (_switches[NOTABLE_ARG])
dm_udev_set_sync_support(0);
- if (!dm_task_set_cookie(dmt, &cookie) ||
+ if (!dm_task_set_cookie(dmt, &cookie, 0) ||
!dm_task_run(dmt))
goto out;
@@ -630,7 +630,7 @@
if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
goto out;
- if (!dm_task_set_cookie(dmt, &cookie) ||
+ if (!dm_task_set_cookie(dmt, &cookie, 0) ||
!dm_task_run(dmt))
goto out;
@@ -758,15 +758,70 @@
return r;
}
-static int _udevcomplete(int argc, char **argv, void *data __attribute((unused)))
+static uint32_t _get_cookie_value(char *str_value)
{
- uint32_t cookie;
+ unsigned long int value;
char *p;
- if (!(cookie = (uint32_t) strtoul(argv[1], &p, 0)) || *p) {
+ if (!(value = strtoul(str_value, &p, 0)) ||
+ *p ||
+ (value == ULONG_MAX && errno == ERANGE) ||
+ value > 0xFFFFFFFF) {
err("Incorrect cookie value");
return 0;
}
+ else
+ return (uint32_t) value;
+}
+
+static int _udevflags(int args, char **argv, void *data __attribute((unused)))
+{
+ uint32_t cookie;
+ uint16_t flags;
+ int i;
+ static const char *dm_flag_names[] = {"DISABLE_SUBSYSTEM_RULES",
+ "DISABLE_DISK_RULES",
+ "LOW_PRIORITY",
+ 0, 0, 0, 0, 0};
+
+ if (!(cookie = _get_cookie_value(argv[1])))
+ return 0;
+
+ flags = cookie >> DM_UDEV_FLAGS_SHIFT;
+
+ for (i = 0; i < DM_UDEV_FLAGS_SHIFT; i++)
+ if (1 << i & flags) {
+ if (i < DM_UDEV_FLAGS_SHIFT / 2 && dm_flag_names[i])
+ printf("DM_UDEV_%s_FLAG='1'\n", dm_flag_names[i]);
+ else if (i < DM_UDEV_FLAGS_SHIFT / 2)
+ /*
+ * This is just a fallback. Each new DM flag
+ * should have its symbolic name assigned.
+ */
+ printf("DM_UDEV_FLAG%d='1'\n", i);
+ else
+ /*
+ * We can't assign symbolic names to subsystem
+ * flags. Their semantics vary based on the
+ * subsystem that is currently used.
+ */
+ printf("DM_SUBSYSTEM_UDEV_FLAG%d='1'\n",
+ i - DM_UDEV_FLAGS_SHIFT / 2);
+ }
+
+ return 1;
+}
+
+static int _udevcomplete(int argc, char **argv, void *data __attribute((unused)))
+{
+ uint32_t cookie;
+
+ if (!(cookie = _get_cookie_value(argv[1])))
+ return 0;
+
+ /* strip flags from the cookie and use cookie magic instead */
+ cookie = (cookie & ~DM_UDEV_FLAGS_MASK) |
+ (DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT);
return dm_udev_complete(cookie);
}
@@ -953,7 +1008,7 @@
_read_ahead_flags))
goto out;
- if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie))
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, 0))
goto out;
r = dm_task_run(dmt);
@@ -2436,6 +2491,7 @@
{"table", "[<device>] [--target <target_type>] [--showkeys]", 0, 1, _status},
{"wait", "<device> [<event_nr>]", 0, 2, _wait},
{"mknodes", "[<device>]", 0, 1, _mknodes},
+ {"udevflags", "<cookie>", 1, 1, _udevflags},
{"udevcomplete", "<cookie>", 1, 1, _udevcomplete},
{"udevcomplete_all", "", 0, 0, _udevcomplete_all},
{"udevcookies", "", 0, 0, _udevcookies},
^ permalink raw reply [flat|nested] 23+ messages in thread
* LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...
@ 2009-06-03 11:40 agk
0 siblings, 0 replies; 23+ messages in thread
From: agk @ 2009-06-03 11:40 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2009-06-03 11:40:23
Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-string.c
Log message:
Make mempool optional in dm_split_lvm_name()
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.269&r2=1.270
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.87&r2=1.88
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-string.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/WHATS_NEW_DM 2009/05/22 15:23:11 1.269
+++ LVM2/WHATS_NEW_DM 2009/06/03 11:40:23 1.270
@@ -1,5 +1,6 @@
Version 1.02.33 -
===============================
+ Make mempool optional in dm_split_lvm_name().
Version 1.02.32 - 21st May 2009
===============================
--- LVM2/libdm/libdevmapper.h 2009/05/20 09:52:37 1.87
+++ LVM2/libdm/libdevmapper.h 2009/06/03 11:40:23 1.88
@@ -819,6 +819,8 @@
/*
* Break up the name of a mapped device into its constituent
* Volume Group, Logical Volume and Layer (if present).
+ * If mem is supplied, the result is allocated from the mempool.
+ * Otherwise the strings are changed in situ.
*/
int dm_split_lvm_name(struct dm_pool *mem, const char *dmname,
char **vgname, char **lvname, char **layer);
--- LVM2/libdm/libdm-string.c 2008/11/03 18:59:59 1.10
+++ LVM2/libdm/libdm-string.c 2009/06/03 11:40:23 1.11
@@ -93,7 +93,7 @@
int dm_split_lvm_name(struct dm_pool *mem, const char *dmname,
char **vgname, char **lvname, char **layer)
{
- if (!(*vgname = dm_pool_strdup(mem, dmname)))
+ if (mem && !(*vgname = dm_pool_strdup(mem, dmname)))
return 0;
_unquote(*layer = _unquote(*lvname = _unquote(*vgname)));
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2012-03-02 17:31 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 12:47 LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm zkabelac
-- strict thread matches above, loose matches on Subject: below --
2012-03-02 17:31 zkabelac
2012-02-23 22:45 zkabelac
2012-02-15 12:23 prajnoha
2012-02-15 11:39 prajnoha
2012-02-15 11:27 prajnoha
2012-01-11 12:34 prajnoha
2011-09-29 8:53 zkabelac
2011-09-22 17:36 prajnoha
2011-09-22 17:23 prajnoha
2011-09-22 17:17 prajnoha
2011-09-22 17:09 prajnoha
2011-08-19 16:26 agk
2011-03-10 12:48 zkabelac
2011-02-18 14:38 zkabelac
2011-02-04 16:08 mbroz
2011-01-04 14:43 prajnoha
2010-10-25 13:13 zkabelac
2010-10-15 1:10 agk
2010-04-28 13:37 prajnoha
2009-11-13 12:43 prajnoha
2009-10-22 12:55 prajnoha
2009-06-03 11:40 agk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).