aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-02-12 15:32:36 -0500
committerSteve French <sfrench@us.ibm.com>2008-02-12 15:32:36 -0500
commit90c81e0b0eda214196cbe4340facbce8cc797ee7 (patch)
treea516944067e6437a88705a3d96157d07de3dae51 /fs/cifs/cifsacl.c
parentad7a2926b9e53cfb3020d15bdfacacc54e2b63da (diff)
[CIFS] clean up some hard to read ifdefs
Christoph had noticed too many ifdefs in the CIFS code making it hard to read. This patch removes about a quarter of them from the C files in cifs by improving a few key ifdefs in the .h files. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 842aaa92168d..49485108454f 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -215,9 +215,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
215 215
216 if (flags & GENERIC_ALL) { 216 if (flags & GENERIC_ALL) {
217 *pmode |= (S_IRWXUGO & (*pbits_to_set)); 217 *pmode |= (S_IRWXUGO & (*pbits_to_set));
218#ifdef CONFIG_CIFS_DEBUG2 218 cFYI(DBG2, ("all perms"));
219 cFYI(1, ("all perms"));
220#endif
221 return; 219 return;
222 } 220 }
223 if ((flags & GENERIC_WRITE) || 221 if ((flags & GENERIC_WRITE) ||
@@ -230,9 +228,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
230 ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) 228 ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
231 *pmode |= (S_IXUGO & (*pbits_to_set)); 229 *pmode |= (S_IXUGO & (*pbits_to_set));
232 230
233#ifdef CONFIG_CIFS_DEBUG2 231 cFYI(DBG2, ("access flags 0x%x mode now 0x%x", flags, *pmode));
234 cFYI(1, ("access flags 0x%x mode now 0x%x", flags, *pmode));
235#endif
236 return; 232 return;
237} 233}
238 234
@@ -261,9 +257,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
261 if (mode & S_IXUGO) 257 if (mode & S_IXUGO)
262 *pace_flags |= SET_FILE_EXEC_RIGHTS; 258 *pace_flags |= SET_FILE_EXEC_RIGHTS;
263 259
264#ifdef CONFIG_CIFS_DEBUG2 260 cFYI(DBG2, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
265 cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
266#endif
267 return; 261 return;
268} 262}
269 263
@@ -357,11 +351,9 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
357 return; 351 return;
358 } 352 }
359 353
360#ifdef CONFIG_CIFS_DEBUG2 354 cFYI(DBG2, ("DACL revision %d size %d num aces %d",
361 cFYI(1, ("DACL revision %d size %d num aces %d",
362 le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), 355 le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
363 le32_to_cpu(pdacl->num_aces))); 356 le32_to_cpu(pdacl->num_aces)));
364#endif
365 357
366 /* reset rwx permissions for user/group/other. 358 /* reset rwx permissions for user/group/other.
367 Also, if num_aces is 0 i.e. DACL has no ACEs, 359 Also, if num_aces is 0 i.e. DACL has no ACEs,
@@ -494,13 +486,11 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
494 le32_to_cpu(pntsd->gsidoffset)); 486 le32_to_cpu(pntsd->gsidoffset));
495 dacloffset = le32_to_cpu(pntsd->dacloffset); 487 dacloffset = le32_to_cpu(pntsd->dacloffset);
496 dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); 488 dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);
497#ifdef CONFIG_CIFS_DEBUG2 489 cFYI(DBG2, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
498 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
499 "sacloffset 0x%x dacloffset 0x%x", 490 "sacloffset 0x%x dacloffset 0x%x",
500 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), 491 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
501 le32_to_cpu(pntsd->gsidoffset), 492 le32_to_cpu(pntsd->gsidoffset),
502 le32_to_cpu(pntsd->sacloffset), dacloffset)); 493 le32_to_cpu(pntsd->sacloffset), dacloffset));
503#endif
504/* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ 494/* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */
505 rc = parse_sid(owner_sid_ptr, end_of_acl); 495 rc = parse_sid(owner_sid_ptr, end_of_acl);
506 if (rc) 496 if (rc)
@@ -635,9 +625,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
635 struct super_block *sb; 625 struct super_block *sb;
636 struct cifs_sb_info *cifs_sb; 626 struct cifs_sb_info *cifs_sb;
637 627
638#ifdef CONFIG_CIFS_DEBUG2 628 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
639 cFYI(1, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
640#endif
641 629
642 if (!inode) 630 if (!inode)
643 return (rc); 631 return (rc);
@@ -668,9 +656,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
668 } 656 }
669 657
670 rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); 658 rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
671#ifdef CONFIG_CIFS_DEBUG2 659 cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
672 cFYI(1, ("SetCIFSACL rc = %d", rc));
673#endif
674 if (unlock_file == TRUE) 660 if (unlock_file == TRUE)
675 atomic_dec(&open_file->wrtPending); 661 atomic_dec(&open_file->wrtPending);
676 else 662 else
@@ -688,9 +674,7 @@ void acl_to_uid_mode(struct inode *inode, const char *path)
688 u32 acllen = 0; 674 u32 acllen = 0;
689 int rc = 0; 675 int rc = 0;
690 676
691#ifdef CONFIG_CIFS_DEBUG2 677 cFYI(DBG2, ("converting ACL to mode for %s", path));
692 cFYI(1, ("converting ACL to mode for %s", path));
693#endif
694 pntsd = get_cifs_acl(&acllen, inode, path); 678 pntsd = get_cifs_acl(&acllen, inode, path);
695 679
696 /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ 680 /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
@@ -711,9 +695,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
711 struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ 695 struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
712 struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ 696 struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
713 697
714#ifdef CONFIG_CIFS_DEBUG2 698 cFYI(DBG2, ("set ACL from mode for %s", path));
715 cFYI(1, ("set ACL from mode for %s", path));
716#endif
717 699
718 /* Get the security descriptor */ 700 /* Get the security descriptor */
719 pntsd = get_cifs_acl(&acllen, inode, path); 701 pntsd = get_cifs_acl(&acllen, inode, path);
@@ -735,16 +717,12 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
735 717
736 rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode); 718 rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode);
737 719
738#ifdef CONFIG_CIFS_DEBUG2 720 cFYI(DBG2, ("build_sec_desc rc: %d", rc));
739 cFYI(1, ("build_sec_desc rc: %d", rc));
740#endif
741 721
742 if (!rc) { 722 if (!rc) {
743 /* Set the security descriptor */ 723 /* Set the security descriptor */
744 rc = set_cifs_acl(pnntsd, acllen, inode, path); 724 rc = set_cifs_acl(pnntsd, acllen, inode, path);
745#ifdef CONFIG_CIFS_DEBUG2 725 cFYI(DBG2, ("set_cifs_acl rc: %d", rc));
746 cFYI(1, ("set_cifs_acl rc: %d", rc));
747#endif
748 } 726 }
749 727
750 kfree(pnntsd); 728 kfree(pnntsd);