aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/xattr.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-05-04 23:12:25 -0400
committerSteve French <smfrench@gmail.com>2013-05-04 23:17:23 -0400
commitf96637be081141d6f8813429499f164260b49d70 (patch)
treec91f5a9b5a2b7a67bbeda15d7c9805655547a098 /fs/cifs/xattr.c
parentf7f7c1850eb98da758731ea7edfa830ebefe24cd (diff)
[CIFS] cifs: Rename cERROR and cFYI to cifs_dbg
It's not obvious from reading the macro names that these macros are for debugging. Convert the names to a single more typical kernel style cifs_dbg macro. cERROR(1, ...) -> cifs_dbg(VFS, ...) cFYI(1, ...) -> cifs_dbg(FYI, ...) cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...) Move the terminating format newline from the macro to the call site. Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the "CIFS VFS: " prefix for VFS messages. Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y) $ size fs/cifs/cifs.ko* text data bss dec hex filename 265245 2525 132 267902 4167e fs/cifs/cifs.ko.new 268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old Other miscellaneous changes around these conversions: o Miscellaneous typo fixes o Add terminating \n's to almost all formats and remove them from the macros to be more kernel style like. A few formats previously had defective \n's o Remove unnecessary OOM messages as kmalloc() calls dump_stack o Coalesce formats to make grep easier, added missing spaces when coalescing formats o Use %s, __func__ instead of embedded function name o Removed unnecessary "cifs: " prefixes o Convert kzalloc with multiply to kcalloc o Remove unused cifswarn macro Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/xattr.c')
-rw-r--r--fs/cifs/xattr.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 5142f2c60278..09afda4cc58e 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -68,12 +68,12 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
68 goto remove_ea_exit; 68 goto remove_ea_exit;
69 } 69 }
70 if (ea_name == NULL) { 70 if (ea_name == NULL) {
71 cFYI(1, "Null xattr names not supported"); 71 cifs_dbg(FYI, "Null xattr names not supported\n");
72 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) 72 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
73 && (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))) { 73 && (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))) {
74 cFYI(1, 74 cifs_dbg(FYI,
75 "illegal xattr request %s (only user namespace supported)", 75 "illegal xattr request %s (only user namespace supported)\n",
76 ea_name); 76 ea_name);
77 /* BB what if no namespace prefix? */ 77 /* BB what if no namespace prefix? */
78 /* Should we just pass them to server, except for 78 /* Should we just pass them to server, except for
79 system and perhaps security prefixes? */ 79 system and perhaps security prefixes? */
@@ -134,19 +134,19 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
134 search server for EAs or streams to 134 search server for EAs or streams to
135 returns as xattrs */ 135 returns as xattrs */
136 if (value_size > MAX_EA_VALUE_SIZE) { 136 if (value_size > MAX_EA_VALUE_SIZE) {
137 cFYI(1, "size of EA value too large"); 137 cifs_dbg(FYI, "size of EA value too large\n");
138 rc = -EOPNOTSUPP; 138 rc = -EOPNOTSUPP;
139 goto set_ea_exit; 139 goto set_ea_exit;
140 } 140 }
141 141
142 if (ea_name == NULL) { 142 if (ea_name == NULL) {
143 cFYI(1, "Null xattr names not supported"); 143 cifs_dbg(FYI, "Null xattr names not supported\n");
144 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) 144 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
145 == 0) { 145 == 0) {
146 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 146 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
147 goto set_ea_exit; 147 goto set_ea_exit;
148 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) 148 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0)
149 cFYI(1, "attempt to set cifs inode metadata"); 149 cifs_dbg(FYI, "attempt to set cifs inode metadata\n");
150 150
151 ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ 151 ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
152 rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, 152 rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
@@ -167,8 +167,6 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
167 struct cifs_ntsd *pacl; 167 struct cifs_ntsd *pacl;
168 pacl = kmalloc(value_size, GFP_KERNEL); 168 pacl = kmalloc(value_size, GFP_KERNEL);
169 if (!pacl) { 169 if (!pacl) {
170 cFYI(1, "%s: Can't allocate memory for ACL",
171 __func__);
172 rc = -ENOMEM; 170 rc = -ENOMEM;
173 } else { 171 } else {
174 memcpy(pacl, ea_value, value_size); 172 memcpy(pacl, ea_value, value_size);
@@ -179,7 +177,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
179 kfree(pacl); 177 kfree(pacl);
180 } 178 }
181#else 179#else
182 cFYI(1, "Set CIFS ACL not supported yet"); 180 cifs_dbg(FYI, "Set CIFS ACL not supported yet\n");
183#endif /* CONFIG_CIFS_ACL */ 181#endif /* CONFIG_CIFS_ACL */
184 } else { 182 } else {
185 int temp; 183 int temp;
@@ -193,9 +191,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
193 ACL_TYPE_ACCESS, cifs_sb->local_nls, 191 ACL_TYPE_ACCESS, cifs_sb->local_nls,
194 cifs_sb->mnt_cifs_flags & 192 cifs_sb->mnt_cifs_flags &
195 CIFS_MOUNT_MAP_SPECIAL_CHR); 193 CIFS_MOUNT_MAP_SPECIAL_CHR);
196 cFYI(1, "set POSIX ACL rc %d", rc); 194 cifs_dbg(FYI, "set POSIX ACL rc %d\n", rc);
197#else 195#else
198 cFYI(1, "set POSIX ACL not supported"); 196 cifs_dbg(FYI, "set POSIX ACL not supported\n");
199#endif 197#endif
200 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT, 198 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
201 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { 199 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
@@ -206,13 +204,13 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
206 ACL_TYPE_DEFAULT, cifs_sb->local_nls, 204 ACL_TYPE_DEFAULT, cifs_sb->local_nls,
207 cifs_sb->mnt_cifs_flags & 205 cifs_sb->mnt_cifs_flags &
208 CIFS_MOUNT_MAP_SPECIAL_CHR); 206 CIFS_MOUNT_MAP_SPECIAL_CHR);
209 cFYI(1, "set POSIX default ACL rc %d", rc); 207 cifs_dbg(FYI, "set POSIX default ACL rc %d\n", rc);
210#else 208#else
211 cFYI(1, "set default POSIX ACL not supported"); 209 cifs_dbg(FYI, "set default POSIX ACL not supported\n");
212#endif 210#endif
213 } else { 211 } else {
214 cFYI(1, "illegal xattr request %s (only user namespace" 212 cifs_dbg(FYI, "illegal xattr request %s (only user namespace supported)\n",
215 " supported)", ea_name); 213 ea_name);
216 /* BB what if no namespace prefix? */ 214 /* BB what if no namespace prefix? */
217 /* Should we just pass them to server, except for 215 /* Should we just pass them to server, except for
218 system and perhaps security prefixes? */ 216 system and perhaps security prefixes? */
@@ -263,14 +261,14 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
263 /* return dos attributes as pseudo xattr */ 261 /* return dos attributes as pseudo xattr */
264 /* return alt name if available as pseudo attr */ 262 /* return alt name if available as pseudo attr */
265 if (ea_name == NULL) { 263 if (ea_name == NULL) {
266 cFYI(1, "Null xattr names not supported"); 264 cifs_dbg(FYI, "Null xattr names not supported\n");
267 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) 265 } else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
268 == 0) { 266 == 0) {
269 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 267 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
270 goto get_ea_exit; 268 goto get_ea_exit;
271 269
272 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) { 270 if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) {
273 cFYI(1, "attempt to query cifs inode metadata"); 271 cifs_dbg(FYI, "attempt to query cifs inode metadata\n");
274 /* revalidate/getattr then populate from inode */ 272 /* revalidate/getattr then populate from inode */
275 } /* BB add else when above is implemented */ 273 } /* BB add else when above is implemented */
276 ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ 274 ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */
@@ -295,7 +293,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
295 cifs_sb->mnt_cifs_flags & 293 cifs_sb->mnt_cifs_flags &
296 CIFS_MOUNT_MAP_SPECIAL_CHR); 294 CIFS_MOUNT_MAP_SPECIAL_CHR);
297#else 295#else
298 cFYI(1, "Query POSIX ACL not supported yet"); 296 cifs_dbg(FYI, "Query POSIX ACL not supported yet\n");
299#endif /* CONFIG_CIFS_POSIX */ 297#endif /* CONFIG_CIFS_POSIX */
300 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT, 298 } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
301 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) { 299 strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
@@ -307,7 +305,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
307 cifs_sb->mnt_cifs_flags & 305 cifs_sb->mnt_cifs_flags &
308 CIFS_MOUNT_MAP_SPECIAL_CHR); 306 CIFS_MOUNT_MAP_SPECIAL_CHR);
309#else 307#else
310 cFYI(1, "Query POSIX default ACL not supported yet"); 308 cifs_dbg(FYI, "Query POSIX default ACL not supported yet\n");
311#endif /* CONFIG_CIFS_POSIX */ 309#endif /* CONFIG_CIFS_POSIX */
312 } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, 310 } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL,
313 strlen(CIFS_XATTR_CIFS_ACL)) == 0) { 311 strlen(CIFS_XATTR_CIFS_ACL)) == 0) {
@@ -319,8 +317,8 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
319 full_path, &acllen); 317 full_path, &acllen);
320 if (IS_ERR(pacl)) { 318 if (IS_ERR(pacl)) {
321 rc = PTR_ERR(pacl); 319 rc = PTR_ERR(pacl);
322 cERROR(1, "%s: error %zd getting sec desc", 320 cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
323 __func__, rc); 321 __func__, rc);
324 } else { 322 } else {
325 if (ea_value) { 323 if (ea_value) {
326 if (acllen > buf_size) 324 if (acllen > buf_size)
@@ -332,18 +330,18 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
332 kfree(pacl); 330 kfree(pacl);
333 } 331 }
334#else 332#else
335 cFYI(1, "Query CIFS ACL not supported yet"); 333 cifs_dbg(FYI, "Query CIFS ACL not supported yet\n");
336#endif /* CONFIG_CIFS_ACL */ 334#endif /* CONFIG_CIFS_ACL */
337 } else if (strncmp(ea_name, 335 } else if (strncmp(ea_name,
338 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) { 336 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) {
339 cFYI(1, "Trusted xattr namespace not supported yet"); 337 cifs_dbg(FYI, "Trusted xattr namespace not supported yet\n");
340 } else if (strncmp(ea_name, 338 } else if (strncmp(ea_name,
341 XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) { 339 XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) {
342 cFYI(1, "Security xattr namespace not supported yet"); 340 cifs_dbg(FYI, "Security xattr namespace not supported yet\n");
343 } else 341 } else
344 cFYI(1, 342 cifs_dbg(FYI,
345 "illegal xattr request %s (only user namespace supported)", 343 "illegal xattr request %s (only user namespace supported)\n",
346 ea_name); 344 ea_name);
347 345
348 /* We could add an additional check for streams ie 346 /* We could add an additional check for streams ie
349 if proc/fs/cifs/streamstoxattr is set then 347 if proc/fs/cifs/streamstoxattr is set then