1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 /* 27 * Copyright (c) 2013, 2016 by Delphix. All rights reserved. 28 */ 29 30 #ifndef _ZFS_NAMECHECK_H 31 #define _ZFS_NAMECHECK_H extern __attribute__((visibility("default"))) 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 typedef enum { 38 NAME_ERR_LEADING_SLASH, /* name begins with leading slash */ 39 NAME_ERR_EMPTY_COMPONENT, /* name contains an empty component */ 40 NAME_ERR_TRAILING_SLASH, /* name ends with a slash */ 41 NAME_ERR_INVALCHAR, /* invalid character found */ 42 NAME_ERR_MULTIPLE_DELIMITERS, /* multiple '@'/'#' delimiters found */ 43 NAME_ERR_NOLETTER, /* pool doesn't begin with a letter */ 44 NAME_ERR_RESERVED, /* entire name is reserved */ 45 NAME_ERR_DISKLIKE, /* reserved disk name (c[0-9].*) */ 46 NAME_ERR_TOOLONG, /* name is too long */ 47 NAME_ERR_SELF_REF, /* reserved self path name ('.') */ 48 NAME_ERR_PARENT_REF, /* reserved parent path name ('..') */ 49 NAME_ERR_NO_AT, /* permission set is missing '@' */ 50 NAME_ERR_NO_POUND, /* permission set is missing '#' */ 51 } namecheck_err_t; 52 53 #define ZFS_PERMSET_MAXLEN 64 54 55 _ZFS_NAMECHECK_H int zfs_max_dataset_nesting; 56 57 _ZFS_NAMECHECK_H int get_dataset_depth(const char *); 58 _ZFS_NAMECHECK_H int pool_namecheck(const char *, namecheck_err_t *, char *); 59 _ZFS_NAMECHECK_H int entity_namecheck(const char *, namecheck_err_t *, char *); 60 _ZFS_NAMECHECK_H int dataset_namecheck(const char *, namecheck_err_t *, char *); 61 _ZFS_NAMECHECK_H int snapshot_namecheck(const char *, namecheck_err_t *, 62 char *); 63 _ZFS_NAMECHECK_H int bookmark_namecheck(const char *, namecheck_err_t *, 64 char *); 65 _ZFS_NAMECHECK_H int dataset_nestcheck(const char *); 66 _ZFS_NAMECHECK_H int mountpoint_namecheck(const char *, namecheck_err_t *); 67 _ZFS_NAMECHECK_H int zfs_component_namecheck(const char *, namecheck_err_t *, 68 char *); 69 _ZFS_NAMECHECK_H int permset_namecheck(const char *, namecheck_err_t *, 70 char *); 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif /* _ZFS_NAMECHECK_H */ 77