2001-12-17 17:04:10 +03:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2007-08-21 00:55:30 +04:00
* Copyright ( C ) 2004 - 2007 Red Hat , Inc . All rights reserved .
2001-12-17 17:04:10 +03:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-12-17 17:04:10 +03:00
*/
# ifndef _LVM_STRING_H
# define _LVM_STRING_H
2002-01-21 14:06:32 +03:00
# include <stdio.h>
2001-12-17 17:04:10 +03:00
# include <stdarg.h>
2006-04-19 19:33:07 +04:00
# define NAME_LEN 128
2010-04-14 17:01:38 +04:00
# define UUID_PREFIX "LVM-"
2006-04-19 19:33:07 +04:00
2004-09-15 19:02:36 +04:00
struct pool ;
2007-07-20 19:38:19 +04:00
int emit_to_buffer ( char * * buffer , size_t * size , const char * fmt , . . . )
__attribute__ ( ( format ( printf , 3 , 4 ) ) ) ;
2003-09-18 00:35:57 +04:00
2005-10-17 03:03:59 +04:00
char * build_dm_name ( struct dm_pool * mem , const char * vg ,
2004-09-15 19:02:36 +04:00
const char * lv , const char * layer ) ;
2010-04-14 17:01:38 +04:00
char * build_dm_uuid ( struct dm_pool * mem , const char * lvid ,
const char * layer ) ;
2004-09-15 19:02:36 +04:00
2006-04-19 19:33:07 +04:00
int validate_name ( const char * n ) ;
2010-04-23 18:16:32 +04:00
int apply_lvname_restrictions ( const char * name ) ;
int is_reserved_lvname ( const char * name ) ;
2008-03-12 19:03:22 +03:00
/*
* Returns number of occurrences of c in first len characters of str .
*/
unsigned count_chars ( const char * str , size_t len , const int c ) ;
/*
* Returns what length of escaped string would be including terminating NUL .
*/
size_t escaped_len ( const char * str ) ;
/*
* Copies a string from src to out .
* Double quotation marks and backslashes are quoted with a backslash .
* Caller must ensure * out has enough space - see escaped_len ( ) .
* Returns * out .
*/
char * escape_double_quotes ( char * out , const char * src ) ;
/*
* Removes quoting of double quotation marks and backslashes in situ .
*/
void unescape_double_quotes ( char * src ) ;
2007-04-25 22:24:19 +04:00
2001-12-17 17:04:10 +03:00
# endif