mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-25 21:57:45 +03:00
Remove tag length restriction and allow / = ! : # & characters.
This commit is contained in:
parent
676492a634
commit
212f7e0409
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.77 -
|
Version 2.02.77 -
|
||||||
===================================
|
===================================
|
||||||
|
Remove tag length restriction and allow / = ! : # & characters.
|
||||||
Support repetition of --addtag and --deltag arguments.
|
Support repetition of --addtag and --deltag arguments.
|
||||||
Add infrastructure for specific cmdline arguments to be repeated in groups.
|
Add infrastructure for specific cmdline arguments to be repeated in groups.
|
||||||
Split the_args cmdline arguments and values into arg_props and arg_values.
|
Split the_args cmdline arguments and values into arg_props and arg_values.
|
||||||
|
@ -285,6 +285,25 @@ void unescape_colons_and_at_signs(char *src,
|
|||||||
*substr_first_unquoted_at_sign = arr_substr_first_unquoted[1];
|
*substr_first_unquoted_at_sign = arr_substr_first_unquoted[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A-Za-z0-9._-+/=!:&#
|
||||||
|
*/
|
||||||
|
int validate_tag(const char *n)
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
register int len = 0;
|
||||||
|
|
||||||
|
if (!n || !*n)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while ((len++, c = *n++))
|
||||||
|
if (!isalnum(c) && c != '.' && c != '_' && c != '-' && c != '+' && c != '/'
|
||||||
|
&& c != '=' && c != '!' && c != ':' && c != '&' && c != '#')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device layer names are all of the form <vg>-<lv>-<layer>, any
|
* Device layer names are all of the form <vg>-<lv>-<layer>, any
|
||||||
* other hyphens that appear in these names are quoted with yet
|
* other hyphens that appear in these names are quoted with yet
|
||||||
|
@ -33,6 +33,7 @@ char *build_dm_uuid(struct dm_pool *mem, const char *lvid,
|
|||||||
const char *layer);
|
const char *layer);
|
||||||
|
|
||||||
int validate_name(const char *n);
|
int validate_name(const char *n);
|
||||||
|
int validate_tag(const char *n);
|
||||||
|
|
||||||
int apply_lvname_restrictions(const char *name);
|
int apply_lvname_restrictions(const char *name);
|
||||||
int is_reserved_lvname(const char *name);
|
int is_reserved_lvname(const char *name);
|
||||||
|
@ -205,6 +205,7 @@ is mounted read-only when the script runs.
|
|||||||
.TP
|
.TP
|
||||||
\fB--addtag tag\fP
|
\fB--addtag tag\fP
|
||||||
Add the tag \fBtag\fP to a PV, VG or LV.
|
Add the tag \fBtag\fP to a PV, VG or LV.
|
||||||
|
Supply this argument multiple times to add more than one tag at once.
|
||||||
A tag is a word that can be used to group LVM2 objects of the same type
|
A tag is a word that can be used to group LVM2 objects of the same type
|
||||||
together.
|
together.
|
||||||
Tags can be given on the command line in place of PV, VG or LV
|
Tags can be given on the command line in place of PV, VG or LV
|
||||||
@ -221,10 +222,13 @@ Only the new LVM2 metadata format supports tagging: objects using the
|
|||||||
LVM1 metadata format cannot be tagged because the on-disk format does not
|
LVM1 metadata format cannot be tagged because the on-disk format does not
|
||||||
support it.
|
support it.
|
||||||
Snapshots cannot be tagged.
|
Snapshots cannot be tagged.
|
||||||
Characters allowed in tags are: A-Z a-z 0-9 _ + . -
|
Characters allowed in tags are: A-Z a-z 0-9 _ + . - and
|
||||||
|
as of version 2.02.78 the following characters are also
|
||||||
|
accepted: / = ! : # &
|
||||||
.TP
|
.TP
|
||||||
\fB--deltag tag\fP
|
\fB--deltag tag\fP
|
||||||
Delete the tag \fBtag\fP from a PV, VG or LV, if it's present.
|
Delete the tag \fBtag\fP from a PV, VG or LV, if it's present.
|
||||||
|
Supply this argument multiple times to remove more than one tag at once.
|
||||||
.TP
|
.TP
|
||||||
\fB--alloc AllocationPolicy\fP
|
\fB--alloc AllocationPolicy\fP
|
||||||
The allocation policy to use: \fBcontiguous\fP, \fBcling\fP, \fBnormal\fP, \fBanywhere\fP or \fBinherit\fP.
|
The allocation policy to use: \fBcontiguous\fP, \fBcling\fP, \fBnormal\fP, \fBanywhere\fP or \fBinherit\fP.
|
||||||
|
@ -418,7 +418,7 @@ int tag_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *
|
|||||||
if (*pos == '@')
|
if (*pos == '@')
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
if (!validate_name(pos))
|
if (!validate_tag(pos))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
av->value = pos;
|
av->value = pos;
|
||||||
|
@ -222,7 +222,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
vgname = lv_name;
|
vgname = lv_name;
|
||||||
|
|
||||||
if (*vgname == '@') {
|
if (*vgname == '@') {
|
||||||
if (!validate_name(vgname + 1)) {
|
if (!validate_tag(vgname + 1)) {
|
||||||
log_error("Skipping invalid tag %s",
|
log_error("Skipping invalid tag %s",
|
||||||
vgname);
|
vgname);
|
||||||
continue;
|
continue;
|
||||||
@ -528,7 +528,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
for (; opt < argc; opt++) {
|
for (; opt < argc; opt++) {
|
||||||
vg_name = argv[opt];
|
vg_name = argv[opt];
|
||||||
if (*vg_name == '@') {
|
if (*vg_name == '@') {
|
||||||
if (!validate_name(vg_name + 1)) {
|
if (!validate_tag(vg_name + 1)) {
|
||||||
log_error("Skipping invalid tag %s",
|
log_error("Skipping invalid tag %s",
|
||||||
vg_name);
|
vg_name);
|
||||||
if (ret_max < EINVALID_CMD_LINE)
|
if (ret_max < EINVALID_CMD_LINE)
|
||||||
@ -698,7 +698,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
if (at_sign && (at_sign == argv[opt])) {
|
if (at_sign && (at_sign == argv[opt])) {
|
||||||
tagname = at_sign + 1;
|
tagname = at_sign + 1;
|
||||||
|
|
||||||
if (!validate_name(tagname)) {
|
if (!validate_tag(tagname)) {
|
||||||
log_error("Skipping invalid tag %s",
|
log_error("Skipping invalid tag %s",
|
||||||
tagname);
|
tagname);
|
||||||
if (ret_max < EINVALID_CMD_LINE)
|
if (ret_max < EINVALID_CMD_LINE)
|
||||||
@ -1113,7 +1113,7 @@ struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int
|
|||||||
|
|
||||||
if (at_sign && (at_sign == argv[i])) {
|
if (at_sign && (at_sign == argv[i])) {
|
||||||
tagname = at_sign + 1;
|
tagname = at_sign + 1;
|
||||||
if (!validate_name(tagname)) {
|
if (!validate_tag(tagname)) {
|
||||||
log_error("Skipping invalid tag %s", tagname);
|
log_error("Skipping invalid tag %s", tagname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user