public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: agk@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/misc lvm-string.c Date: Tue, 06 Sep 2011 15:38:00 -0000 [thread overview] Message-ID: <20110906153846.8780.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2011-09-06 15:38:45 Modified files: lib/misc : lvm-string.c Log message: tdata->tpool Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-string.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31 --- LVM2/lib/misc/lvm-string.c 2011/09/06 00:26:43 1.30 +++ LVM2/lib/misc/lvm-string.c 2011/09/06 15:38:44 1.31 @@ -95,58 +95,40 @@ int apply_lvname_restrictions(const char *name) { - if (!strncmp(name, "snapshot", 8)) { - log_error("Names starting \"snapshot\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (!strncmp(name, "pvmove", 6)) { - log_error("Names starting \"pvmove\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_mlog")) { - log_error("Names including \"_mlog\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_mimage")) { - log_error("Names including \"_mimage\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_rimage")) { - log_error("Names including \"_rimage\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_rmeta")) { - log_error("Names including \"_rmeta\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_vorigin")) { - log_error("Names including \"_vorigin\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_tdata")) { - log_error("Names including \"_tpool\" are reserved. " - "Please choose a different LV name."); - return 0; - } - - if (strstr(name, "_tmeta")) { - log_error("Names including \"_tpool\" are reserved. " - "Please choose a different LV name."); - return 0; + const char *reserved_prefixes[] = { + "snapshot", + "pvmove", + NULL + }; + + const char *reserved_strings[] = { + "_mlog", + "_mimage", + "_rimage", + "_rmeta", + "_vorigin", + "_tpool", + "_tmeta", + NULL + }; + + unsigned i; + const char *s; + + for (i = 0; (s = reserved_prefixes[i]); i++) { + if (!strncmp(name, s, strlen(s))) { + log_error("Names starting \"%s\" are reserved. " + "Please choose a different LV name.", s); + return 0; + } + } + + for (i = 0; (s = reserved_strings[i]); i++) { + if (strstr(name, s)) { + log_error("Names including \"%s\" are reserved. " + "Please choose a different LV name.", s); + return 0; + } } return 1;
reply other threads:[~2011-09-06 15:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20110906153846.8780.qmail@sourceware.org \ --to=agk@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).