2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define UUID_PREFIX "LVM-"
27 int emit_to_buffer(char **buffer, size_t *size, const char *fmt, ...)
28 __attribute__ ((format(printf, 3, 4)));
30 char *build_dm_name(struct dm_pool *mem, const char *vg,
31 const char *lv, const char *layer);
32 char *build_dm_uuid(struct dm_pool *mem, const char *lvid,
35 int validate_name(const char *n);
36 int validate_tag(const char *n);
38 int apply_lvname_restrictions(const char *name);
39 int is_reserved_lvname(const char *name);
42 * Returns number of occurrences of c in first len characters of str.
44 unsigned count_chars(const char *str, size_t len, const int c);
47 * Returns what length of escaped string would be including terminating NUL.
49 size_t escaped_len(const char *str);
52 * Copies a string from src to out.
53 * Double quotation marks and backslashes are quoted with a backslash.
54 * Caller must ensure *out has enough space - see escaped_len().
57 char *escape_double_quotes(char *out, const char *src);
60 * Removes quoting of double quotation marks and backslashes in situ.
62 void unescape_double_quotes(char *src);
65 * Unescape colons and at signs in situ and save the substring starting
66 * at the position of the first unescaped colon and the first unescaped
69 void unescape_colons_and_at_signs(char *src,
70 char **substr_first_unquoted_colon,
71 char **substr_first_unquoted_at_sign);