xref: /titanic_50/usr/src/common/zfs/zfs_namecheck.h (revision 239624797d44f53fe395a44e6dac0bdba7b2b8b8)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
51d452cf5Sahrens  * Common Development and Distribution License (the "License").
61d452cf5Sahrens  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
2214843421SMatthew Ahrens  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
2578f17100SMatthew Ahrens /*
2678f17100SMatthew Ahrens  * Copyright (c) 2013 by Delphix. All rights reserved.
2778f17100SMatthew Ahrens  */
28fa9e4066Sahrens 
29fa9e4066Sahrens #ifndef	_ZFS_NAMECHECK_H
30fa9e4066Sahrens #define	_ZFS_NAMECHECK_H
31fa9e4066Sahrens 
32fa9e4066Sahrens #ifdef	__cplusplus
33fa9e4066Sahrens extern "C" {
34fa9e4066Sahrens #endif
35fa9e4066Sahrens 
36fa9e4066Sahrens typedef enum {
37fa9e4066Sahrens 	NAME_ERR_LEADING_SLASH,		/* name begins with leading slash */
38fa9e4066Sahrens 	NAME_ERR_EMPTY_COMPONENT,	/* name contains an empty component */
39fa9e4066Sahrens 	NAME_ERR_TRAILING_SLASH,	/* name ends with a slash */
40fa9e4066Sahrens 	NAME_ERR_INVALCHAR,		/* invalid character found */
41fbc66171SMarcel Telka 	NAME_ERR_MULTIPLE_DELIMITERS,	/* multiple '@'/'#' delimiters found */
42fa9e4066Sahrens 	NAME_ERR_NOLETTER,		/* pool doesn't begin with a letter */
43fa9e4066Sahrens 	NAME_ERR_RESERVED,		/* entire name is reserved */
44fa9e4066Sahrens 	NAME_ERR_DISKLIKE,		/* reserved disk name (c[0-9].*) */
45b81d61a6Slling 	NAME_ERR_TOOLONG,		/* name is too long */
46ecd6cf80Smarks 	NAME_ERR_NO_AT,			/* permission set is missing '@' */
47fa9e4066Sahrens } namecheck_err_t;
48fa9e4066Sahrens 
49ecd6cf80Smarks #define	ZFS_PERMSET_MAXLEN	64
50ecd6cf80Smarks 
51fa9e4066Sahrens int pool_namecheck(const char *, namecheck_err_t *, char *);
52*23962479SMarcel Telka int entity_namecheck(const char *, namecheck_err_t *, char *);
53fa9e4066Sahrens int dataset_namecheck(const char *, namecheck_err_t *, char *);
5489eef05eSrm160521 int mountpoint_namecheck(const char *, namecheck_err_t *);
5578f17100SMatthew Ahrens int zfs_component_namecheck(const char *, namecheck_err_t *, char *);
56ecd6cf80Smarks int permset_namecheck(const char *, namecheck_err_t *, char *);
57fa9e4066Sahrens 
58fa9e4066Sahrens #ifdef	__cplusplus
59fa9e4066Sahrens }
60fa9e4066Sahrens #endif
61fa9e4066Sahrens 
62fa9e4066Sahrens #endif	/* _ZFS_NAMECHECK_H */
63