1168404Spjd/*
2168404Spjd * CDDL HEADER START
3168404Spjd *
4168404Spjd * The contents of this file are subject to the terms of the
5168404Spjd * Common Development and Distribution License (the "License").
6168404Spjd * You may not use this file except in compliance with the License.
7168404Spjd *
8168404Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9168404Spjd * or http://www.opensolaris.org/os/licensing.
10168404Spjd * See the License for the specific language governing permissions
11168404Spjd * and limitations under the License.
12168404Spjd *
13168404Spjd * When distributing Covered Code, include this CDDL HEADER in each
14168404Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15168404Spjd * If applicable, add the following below this CDDL HEADER, with the
16168404Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17168404Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18168404Spjd *
19168404Spjd * CDDL HEADER END
20168404Spjd */
21168404Spjd/*
22209962Smm * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23168404Spjd * Use is subject to license terms.
24168404Spjd */
25263407Sdelphij/*
26263407Sdelphij * Copyright (c) 2013 by Delphix. All rights reserved.
27263407Sdelphij */
28168404Spjd
29168404Spjd#ifndef	_ZFS_NAMECHECK_H
30168404Spjd#define	_ZFS_NAMECHECK_H
31168404Spjd
32168404Spjd#ifdef	__cplusplus
33168404Spjdextern "C" {
34168404Spjd#endif
35168404Spjd
36168404Spjdtypedef enum {
37168404Spjd	NAME_ERR_LEADING_SLASH,		/* name begins with leading slash */
38168404Spjd	NAME_ERR_EMPTY_COMPONENT,	/* name contains an empty component */
39168404Spjd	NAME_ERR_TRAILING_SLASH,	/* name ends with a slash */
40168404Spjd	NAME_ERR_INVALCHAR,		/* invalid character found */
41168404Spjd	NAME_ERR_MULTIPLE_AT,		/* multiple '@' characters found */
42168404Spjd	NAME_ERR_NOLETTER,		/* pool doesn't begin with a letter */
43168404Spjd	NAME_ERR_RESERVED,		/* entire name is reserved */
44168404Spjd	NAME_ERR_DISKLIKE,		/* reserved disk name (c[0-9].*) */
45168404Spjd	NAME_ERR_TOOLONG,		/* name is too long */
46185029Spjd	NAME_ERR_NO_AT,			/* permission set is missing '@' */
47168404Spjd} namecheck_err_t;
48168404Spjd
49185029Spjd#define	ZFS_PERMSET_MAXLEN	64
50185029Spjd
51168404Spjdint pool_namecheck(const char *, namecheck_err_t *, char *);
52168404Spjdint dataset_namecheck(const char *, namecheck_err_t *, char *);
53185029Spjdint mountpoint_namecheck(const char *, namecheck_err_t *);
54263407Sdelphijint zfs_component_namecheck(const char *, namecheck_err_t *, char *);
55185029Spjdint permset_namecheck(const char *, namecheck_err_t *, char *);
56168404Spjd
57168404Spjd#ifdef	__cplusplus
58168404Spjd}
59168404Spjd#endif
60168404Spjd
61168404Spjd#endif	/* _ZFS_NAMECHECK_H */
62