5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2014 Gary Mills
24 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
25 */
26
27 #include <libsysevent.h>
28 #include <pthread.h>
29 #include <stdlib.h>
30 #include <errno.h>
31 #include <fnmatch.h>
32 #include <strings.h>
33 #include <unistd.h>
34 #include <assert.h>
35 #include <libgen.h>
36 #include <libintl.h>
37 #include <alloca.h>
38 #include <ctype.h>
39 #include <sys/acl.h>
40 #include <sys/stat.h>
41 #include <sys/brand.h>
42 #include <sys/mntio.h>
43 #include <sys/mnttab.h>
44 #include <sys/nvpair.h>
5800 uuid_copy(uuid, ze->zone_uuid);
5801 free(ze);
5802 return (Z_OK);
5803 } else {
5804 return (Z_NO_ZONE);
5805 }
5806 }
5807
5808 /*
5809 * File-system convenience functions.
5810 */
5811 boolean_t
5812 zonecfg_valid_fs_type(const char *type)
5813 {
5814 /*
5815 * We already know which FS types don't work.
5816 */
5817 if (strcmp(type, "proc") == 0 ||
5818 strcmp(type, "mntfs") == 0 ||
5819 strcmp(type, "autofs") == 0 ||
5820 strncmp(type, "nfs", sizeof ("nfs") - 1) == 0 ||
5821 strcmp(type, "cachefs") == 0)
5822 return (B_FALSE);
5823 /*
5824 * The caller may do more detailed verification to make sure other
5825 * aspects of this filesystem type make sense.
5826 */
5827 return (B_TRUE);
5828 }
5829
5830 /*
5831 * Generally uninteresting rctl convenience functions.
5832 */
5833
5834 int
5835 zonecfg_construct_rctlblk(const struct zone_rctlvaltab *rctlval,
5836 rctlblk_t *rctlblk)
5837 {
5838 unsigned long long ull;
5839 char *endp;
5840 rctl_priv_t priv;
5841 rctl_qty_t limit;
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2014 Gary Mills
24 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #include <libsysevent.h>
29 #include <pthread.h>
30 #include <stdlib.h>
31 #include <errno.h>
32 #include <fnmatch.h>
33 #include <strings.h>
34 #include <unistd.h>
35 #include <assert.h>
36 #include <libgen.h>
37 #include <libintl.h>
38 #include <alloca.h>
39 #include <ctype.h>
40 #include <sys/acl.h>
41 #include <sys/stat.h>
42 #include <sys/brand.h>
43 #include <sys/mntio.h>
44 #include <sys/mnttab.h>
45 #include <sys/nvpair.h>
5801 uuid_copy(uuid, ze->zone_uuid);
5802 free(ze);
5803 return (Z_OK);
5804 } else {
5805 return (Z_NO_ZONE);
5806 }
5807 }
5808
5809 /*
5810 * File-system convenience functions.
5811 */
5812 boolean_t
5813 zonecfg_valid_fs_type(const char *type)
5814 {
5815 /*
5816 * We already know which FS types don't work.
5817 */
5818 if (strcmp(type, "proc") == 0 ||
5819 strcmp(type, "mntfs") == 0 ||
5820 strcmp(type, "autofs") == 0 ||
5821 strncmp(type, "nfs", sizeof ("nfs") - 1) == 0)
5822 return (B_FALSE);
5823 /*
5824 * The caller may do more detailed verification to make sure other
5825 * aspects of this filesystem type make sense.
5826 */
5827 return (B_TRUE);
5828 }
5829
5830 /*
5831 * Generally uninteresting rctl convenience functions.
5832 */
5833
5834 int
5835 zonecfg_construct_rctlblk(const struct zone_rctlvaltab *rctlval,
5836 rctlblk_t *rctlblk)
5837 {
5838 unsigned long long ull;
5839 char *endp;
5840 rctl_priv_t priv;
5841 rctl_qty_t limit;
|