Print this page
fixup .text where possible
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/ctfs/ctfs_all.c
+++ new/usr/src/uts/common/fs/ctfs/ctfs_all.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 -#pragma ident "%Z%%M% %I% %E% SMI"
27 26
27 +
28 28 #include <sys/types.h>
29 29 #include <sys/param.h>
30 30 #include <sys/time.h>
31 31 #include <sys/cred.h>
32 32 #include <sys/vfs.h>
33 33 #include <sys/vfs_opreg.h>
34 34 #include <sys/gfs.h>
35 35 #include <sys/vnode.h>
36 36 #include <sys/systm.h>
37 37 #include <sys/errno.h>
38 38 #include <sys/sysmacros.h>
39 39 #include <fs/fs_subr.h>
40 40 #include <sys/contract.h>
41 41 #include <sys/contract_impl.h>
42 42 #include <sys/ctfs.h>
43 43 #include <sys/ctfs_impl.h>
44 44 #include <sys/file.h>
45 45 #include <sys/pathname.h>
46 46
47 47 /*
48 48 * CTFS routines for the /system/contract/all vnode.
49 49 */
50 50
51 51 static int ctfs_adir_do_readdir(vnode_t *, void *, int *, offset_t *,
52 52 offset_t *, void *, int);
53 53 static int ctfs_adir_do_lookup(vnode_t *, const char *, vnode_t **, ino64_t *,
54 54 cred_t *, int, int *, pathname_t *);
55 55
56 56 /*
57 57 * ctfs_create_adirnode
58 58 */
59 59 /* ARGSUSED */
60 60 vnode_t *
61 61 ctfs_create_adirnode(vnode_t *pvp)
62 62 {
63 63 vnode_t *vp = gfs_dir_create(sizeof (ctfs_adirnode_t), pvp,
64 64 ctfs_ops_adir, NULL, NULL, CTFS_NAME_MAX, ctfs_adir_do_readdir,
65 65 ctfs_adir_do_lookup);
66 66
67 67 return (vp);
68 68 }
69 69
70 70 /*
71 71 * ctfs_adir_getattr - VOP_GETATTR entry point
72 72 */
73 73 /* ARGSUSED */
74 74 static int
75 75 ctfs_adir_getattr(
76 76 vnode_t *vp,
77 77 vattr_t *vap,
78 78 int flags,
79 79 cred_t *cr,
80 80 caller_context_t *ct)
81 81 {
82 82 int i, total;
83 83
84 84 vap->va_type = VDIR;
85 85 vap->va_mode = 0555;
86 86 for (i = 0, total = 0; i < ct_ntypes; i++)
87 87 total += contract_type_count(ct_types[i]);
88 88 vap->va_nlink = 2;
89 89 vap->va_size = 2 + total;
90 90 vap->va_ctime.tv_sec = vp->v_vfsp->vfs_mtime;
91 91 vap->va_ctime.tv_nsec = 0;
92 92 vap->va_mtime = vap->va_atime = vap->va_ctime;
93 93 ctfs_common_getattr(vp, vap);
94 94
95 95 return (0);
96 96 }
97 97
98 98 /* ARGSUSED */
99 99 static int
100 100 ctfs_adir_do_lookup(vnode_t *vp, const char *nm, vnode_t **vpp, ino64_t *inop,
101 101 cred_t *cr, int flags, int *deflags, pathname_t *rpnp)
102 102 {
103 103 int i;
104 104 contract_t *ct;
105 105
106 106 i = stoi((char **)&nm);
107 107 if (*nm != '\0')
108 108 return (ENOENT);
109 109
110 110 ct = contract_ptr(i, VTOZONE(vp)->zone_uniqid);
111 111 if (ct == NULL)
112 112 return (ENOENT);
113 113
114 114 *vpp = ctfs_create_symnode(vp, ct);
115 115 *inop = CTFS_INO_CT_LINK(ct->ct_id);
116 116 contract_rele(ct);
117 117
118 118 return (0);
119 119 }
120 120
121 121 /* ARGSUSED */
122 122 static int
123 123 ctfs_adir_do_readdir(vnode_t *vp, void *dp, int *eofp,
124 124 offset_t *offp, offset_t *nextp, void *unused, int flags)
125 125 {
126 126 uint64_t zuniqid;
127 127 ctid_t next;
128 128 struct dirent64 *odp = dp;
129 129
130 130 ASSERT(!(flags & V_RDDIR_ENTFLAGS));
131 131
132 132 zuniqid = VTOZONE(vp)->zone_uniqid;
133 133 next = contract_lookup(zuniqid, *offp);
134 134
135 135 if (next == -1) {
136 136 *eofp = 1;
137 137 return (0);
138 138 }
139 139
140 140 odp->d_ino = CTFS_INO_CT_LINK(next);
141 141 numtos(next, odp->d_name);
142 142 *offp = next;
143 143 *nextp = next + 1;
144 144
145 145 return (0);
146 146 }
147 147
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
148 148 const fs_operation_def_t ctfs_tops_adir[] = {
149 149 { VOPNAME_OPEN, { .vop_open = ctfs_open } },
150 150 { VOPNAME_CLOSE, { .vop_close = ctfs_close } },
151 151 { VOPNAME_IOCTL, { .error = fs_inval } },
152 152 { VOPNAME_GETATTR, { .vop_getattr = ctfs_adir_getattr } },
153 153 { VOPNAME_ACCESS, { .vop_access = ctfs_access_dir } },
154 154 { VOPNAME_READDIR, { .vop_readdir = gfs_vop_readdir } },
155 155 { VOPNAME_LOOKUP, { .vop_lookup = gfs_vop_lookup } },
156 156 { VOPNAME_SEEK, { .vop_seek = fs_seek } },
157 157 { VOPNAME_INACTIVE, { .vop_inactive = gfs_vop_inactive } },
158 - { NULL, NULL }
158 + { NULL, { NULL } }
159 159 };
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX