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_sym.c
+++ new/usr/src/uts/common/fs/ctfs/ctfs_sym.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 2007 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/cmn_err.h>
46 46
47 47 /*
48 48 * CTFS routines for the /system/contract/all/<ctid> vnode.
49 49 */
50 50
51 51 /*
52 52 * ctfs_create_symnode
53 53 *
54 54 * Creates and returns a symnode for the specified contract.
55 55 */
56 56 vnode_t *
57 57 ctfs_create_symnode(vnode_t *pvp, contract_t *ct)
58 58 {
59 59 ctfs_symnode_t *symnode;
60 60 vnode_t *vp;
61 61 size_t len;
62 62
63 63 vp = gfs_file_create(sizeof (ctfs_symnode_t), pvp, ctfs_ops_sym);
64 64 vp->v_type = VLNK;
65 65 symnode = vp->v_data;
66 66
67 67 symnode->ctfs_sn_contract = ct;
68 68 symnode->ctfs_sn_size = len = snprintf(NULL, 0, "../%s/%ld",
69 69 ct->ct_type->ct_type_name, (long)ct->ct_id) + 1;
70 70 symnode->ctfs_sn_string = kmem_alloc(len, KM_SLEEP);
71 71 VERIFY(snprintf(symnode->ctfs_sn_string, len, "../%s/%ld",
72 72 ct->ct_type->ct_type_name, (long)ct->ct_id) < len);
73 73
74 74 contract_hold(ct);
75 75
76 76 return (vp);
77 77 }
78 78
79 79 /*
80 80 * ctfs_sym_getattr - VOP_GETATTR entry point
81 81 */
82 82 /* ARGSUSED */
83 83 static int
84 84 ctfs_sym_getattr(
85 85 vnode_t *vp,
86 86 vattr_t *vap,
87 87 int flags,
88 88 cred_t *cr,
89 89 caller_context_t *ct)
90 90 {
91 91 ctfs_symnode_t *symnode = vp->v_data;
92 92
93 93 vap->va_type = VLNK;
94 94 vap->va_mode = 0444;
95 95 vap->va_nlink = 1;
96 96 vap->va_size = symnode->ctfs_sn_size - 1;
97 97 vap->va_mtime = vap->va_atime = vap->va_ctime =
98 98 symnode->ctfs_sn_contract->ct_ctime;
99 99 ctfs_common_getattr(vp, vap);
100 100
101 101 return (0);
102 102 }
103 103
104 104 /*
105 105 * ctfs_sym_readlink - VOP_READLINK entry point
106 106 *
107 107 * Since we built the symlink string in ctfs_create_symnode, this is
108 108 * just a uiomove.
109 109 */
110 110 /* ARGSUSED */
111 111 int
112 112 ctfs_sym_readlink(vnode_t *vp, uio_t *uiop, cred_t *cr, caller_context_t *ct)
113 113 {
114 114 ctfs_symnode_t *symnode = vp->v_data;
115 115
116 116 return (uiomove(symnode->ctfs_sn_string, symnode->ctfs_sn_size - 1,
117 117 UIO_READ, uiop));
118 118 }
119 119
120 120 /*
121 121 * ctfs_sym_inactive - VOP_INACTIVE entry point
122 122 */
123 123 /* ARGSUSED */
124 124 static void
125 125 ctfs_sym_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
126 126 {
127 127 ctfs_symnode_t *symnode;
128 128
129 129 if ((symnode = gfs_file_inactive(vp)) != NULL) {
130 130 contract_rele(symnode->ctfs_sn_contract);
131 131 kmem_free(symnode->ctfs_sn_string, symnode->ctfs_sn_size);
132 132 kmem_free(symnode, sizeof (ctfs_symnode_t));
133 133 }
134 134 }
135 135
↓ open down ↓ |
98 lines elided |
↑ open up ↑ |
136 136 const fs_operation_def_t ctfs_tops_sym[] = {
137 137 { VOPNAME_OPEN, { .vop_open = ctfs_open } },
138 138 { VOPNAME_CLOSE, { .vop_close = ctfs_close } },
139 139 { VOPNAME_IOCTL, { .error = fs_inval } },
140 140 { VOPNAME_GETATTR, { .vop_getattr = ctfs_sym_getattr } },
141 141 { VOPNAME_READLINK, { .vop_readlink = ctfs_sym_readlink } },
142 142 { VOPNAME_ACCESS, { .vop_access = ctfs_access_readonly } },
143 143 { VOPNAME_READDIR, { .error = fs_notdir } },
144 144 { VOPNAME_LOOKUP, { .error = fs_notdir } },
145 145 { VOPNAME_INACTIVE, { .vop_inactive = ctfs_sym_inactive } },
146 - { NULL, NULL }
146 + { NULL, { NULL } }
147 147 };
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX