aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsacl.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2014-01-16 06:53:36 -0500
committerSteve French <smfrench@gmail.com>2014-01-20 10:52:13 -0500
commitd81b8a40e2ece0a9ab57b1fe1798e291e75bf8fc (patch)
treea3fd90c8172375499b2ad8f5f21ba633a3e522b3 /fs/cifs/cifsacl.c
parent0360d605a236355f9501d21175e405536e2acd48 (diff)
CIFS: Cleanup cifs open codepath
Rename CIFSSMBOpen to CIFS_open and make it take cifs_open_parms structure as a parm. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r--fs/cifs/cifsacl.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 51f5e0ee7237..8f9b4f710d4a 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -895,9 +895,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
895 int oplock = 0; 895 int oplock = 0;
896 unsigned int xid; 896 unsigned int xid;
897 int rc, create_options = 0; 897 int rc, create_options = 0;
898 __u16 fid;
899 struct cifs_tcon *tcon; 898 struct cifs_tcon *tcon;
900 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 899 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
900 struct cifs_fid fid;
901 struct cifs_open_parms oparms;
901 902
902 if (IS_ERR(tlink)) 903 if (IS_ERR(tlink))
903 return ERR_CAST(tlink); 904 return ERR_CAST(tlink);
@@ -908,12 +909,19 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
908 if (backup_cred(cifs_sb)) 909 if (backup_cred(cifs_sb))
909 create_options |= CREATE_OPEN_BACKUP_INTENT; 910 create_options |= CREATE_OPEN_BACKUP_INTENT;
910 911
911 rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 912 oparms.tcon = tcon;
912 create_options, &fid, &oplock, NULL, cifs_sb->local_nls, 913 oparms.cifs_sb = cifs_sb;
913 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 914 oparms.desired_access = READ_CONTROL;
915 oparms.create_options = create_options;
916 oparms.disposition = FILE_OPEN;
917 oparms.path = path;
918 oparms.fid = &fid;
919 oparms.reconnect = false;
920
921 rc = CIFS_open(xid, &oparms, &oplock, NULL);
914 if (!rc) { 922 if (!rc) {
915 rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen); 923 rc = CIFSSMBGetCIFSACL(xid, tcon, fid.netfid, &pntsd, pacllen);
916 CIFSSMBClose(xid, tcon, fid); 924 CIFSSMBClose(xid, tcon, fid.netfid);
917 } 925 }
918 926
919 cifs_put_tlink(tlink); 927 cifs_put_tlink(tlink);
@@ -950,10 +958,11 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
950 int oplock = 0; 958 int oplock = 0;
951 unsigned int xid; 959 unsigned int xid;
952 int rc, access_flags, create_options = 0; 960 int rc, access_flags, create_options = 0;
953 __u16 fid;
954 struct cifs_tcon *tcon; 961 struct cifs_tcon *tcon;
955 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 962 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
956 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 963 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
964 struct cifs_fid fid;
965 struct cifs_open_parms oparms;
957 966
958 if (IS_ERR(tlink)) 967 if (IS_ERR(tlink))
959 return PTR_ERR(tlink); 968 return PTR_ERR(tlink);
@@ -969,18 +978,25 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
969 else 978 else
970 access_flags = WRITE_DAC; 979 access_flags = WRITE_DAC;
971 980
972 rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, access_flags, 981 oparms.tcon = tcon;
973 create_options, &fid, &oplock, NULL, cifs_sb->local_nls, 982 oparms.cifs_sb = cifs_sb;
974 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 983 oparms.desired_access = access_flags;
984 oparms.create_options = create_options;
985 oparms.disposition = FILE_OPEN;
986 oparms.path = path;
987 oparms.fid = &fid;
988 oparms.reconnect = false;
989
990 rc = CIFS_open(xid, &oparms, &oplock, NULL);
975 if (rc) { 991 if (rc) {
976 cifs_dbg(VFS, "Unable to open file to set ACL\n"); 992 cifs_dbg(VFS, "Unable to open file to set ACL\n");
977 goto out; 993 goto out;
978 } 994 }
979 995
980 rc = CIFSSMBSetCIFSACL(xid, tcon, fid, pnntsd, acllen, aclflag); 996 rc = CIFSSMBSetCIFSACL(xid, tcon, fid.netfid, pnntsd, acllen, aclflag);
981 cifs_dbg(NOISY, "SetCIFSACL rc = %d\n", rc); 997 cifs_dbg(NOISY, "SetCIFSACL rc = %d\n", rc);
982 998
983 CIFSSMBClose(xid, tcon, fid); 999 CIFSSMBClose(xid, tcon, fid.netfid);
984out: 1000out:
985 free_xid(xid); 1001 free_xid(xid);
986 cifs_put_tlink(tlink); 1002 cifs_put_tlink(tlink);