2001-12-17 14:04:10 +00:00
/*
2013-09-26 11:37:40 -05:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2007-08-20 20:55:30 +00:00
* Copyright ( C ) 2004 - 2007 Red Hat , Inc . All rights reserved .
2001-12-17 14:04:10 +00:00
*
2004-03-30 19:35:44 +00: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-20 20:55:30 +00:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 19:35:44 +00:00
*
2007-08-20 20:55:30 +00:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 19:35:44 +00:00
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 11:49:46 +01:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2001-12-17 14:04:10 +00:00
*/
# ifndef _LVM_STRING_H
# define _LVM_STRING_H
2006-04-19 15:33:07 +00:00
# define NAME_LEN 128
2010-04-14 13:01:38 +00:00
# define UUID_PREFIX "LVM-"
2006-04-19 15:33:07 +00:00
2014-04-17 10:48:55 +02:00
# include <sys/types.h>
struct dm_pool ;
2004-09-15 15:02:36 +00:00
struct pool ;
2014-03-11 17:13:47 +01:00
struct logical_volume ;
2004-09-15 15:02:36 +00:00
2014-05-07 13:52:01 +02:00
typedef enum name_error {
NAME_VALID = 0 ,
NAME_INVALID_EMPTY = - 1 ,
2015-02-23 17:09:35 +00:00
NAME_INVALID_HYPHEN = - 2 ,
2014-05-07 13:52:01 +02:00
NAME_INVALID_DOTS = - 3 ,
NAME_INVALID_CHARSET = - 4 ,
NAME_INVALID_LENGTH = - 5
} name_error_t ;
2013-09-26 11:37:40 -05:00
2007-07-20 15:38:19 +00:00
int emit_to_buffer ( char * * buffer , size_t * size , const char * fmt , . . . )
__attribute__ ( ( format ( printf , 3 , 4 ) ) ) ;
2003-09-17 20:35:57 +00:00
2014-03-11 17:13:47 +01:00
char * build_dm_uuid ( struct dm_pool * mem , const struct logical_volume * lvid ,
2010-04-14 13:01:38 +00:00
const char * layer ) ;
2004-09-15 15:02:36 +00:00
2006-04-19 15:33:07 +00:00
int validate_name ( const char * n ) ;
2013-09-26 11:37:40 -05:00
name_error_t validate_name_detailed ( const char * n ) ;
2010-11-17 10:19:29 +00:00
int validate_tag ( const char * n ) ;
2006-04-19 15:33:07 +00:00
2015-02-23 19:47:03 +00:00
void copy_systemid_chars ( const char * src , char * dst ) ;
2014-10-24 12:29:04 -05:00
2010-04-23 14:16:32 +00:00
int apply_lvname_restrictions ( const char * name ) ;
2017-12-11 18:12:47 +01:00
int is_component_lvname ( const char * name ) ;
2010-04-23 14:16:32 +00:00
int is_reserved_lvname ( const char * name ) ;
2016-07-14 14:46:38 +01:00
/*
* Provided with a NULL - terminated argument list of const char *
* substrings that might be contained within the string str , use
* strstr ( ) to search str for each in turn and return a pointer to the
* first match or else NULL .
*/
char * first_substring ( const char * str , . . . ) ;
2001-12-17 14:04:10 +00:00
# endif