CIFS: Make SMB2_open use cifs_open_parms struct
[cascardo/linux.git] / fs / cifs / smb2inode.c
index fff6dfb..9841df7 100644 (file)
@@ -41,21 +41,25 @@ static int
 smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
                   struct cifs_sb_info *cifs_sb, const char *full_path,
                   __u32 desired_access, __u32 create_disposition,
-                  __u32 file_attributes, __u32 create_options,
-                  void *data, int command)
+                  __u32 create_options, void *data, int command)
 {
        int rc, tmprc = 0;
-       u64 persistent_fid, volatile_fid;
        __le16 *utf16_path;
        __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
+       struct cifs_open_parms oparms;
+       struct cifs_fid fid;
 
        utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
        if (!utf16_path)
                return -ENOMEM;
 
-       rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
-                      desired_access, create_disposition, file_attributes,
-                      create_options, &oplock, NULL);
+       oparms.tcon = tcon;
+       oparms.desired_access = desired_access;
+       oparms.disposition = create_disposition;
+       oparms.create_options = create_options;
+       oparms.fid = &fid;
+
+       rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL);
        if (rc) {
                kfree(utf16_path);
                return rc;
@@ -65,8 +69,8 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
        case SMB2_OP_DELETE:
                break;
        case SMB2_OP_QUERY_INFO:
-               tmprc = SMB2_query_info(xid, tcon, persistent_fid,
-                                       volatile_fid,
+               tmprc = SMB2_query_info(xid, tcon, fid.persistent_fid,
+                                       fid.volatile_fid,
                                        (struct smb2_file_all_info *)data);
                break;
        case SMB2_OP_MKDIR:
@@ -76,19 +80,21 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
                 */
                break;
        case SMB2_OP_RENAME:
-               tmprc = SMB2_rename(xid, tcon, persistent_fid, volatile_fid,
-                                   (__le16 *)data);
+               tmprc = SMB2_rename(xid, tcon, fid.persistent_fid,
+                                   fid.volatile_fid, (__le16 *)data);
                break;
        case SMB2_OP_HARDLINK:
-               tmprc = SMB2_set_hardlink(xid, tcon, persistent_fid,
-                                         volatile_fid, (__le16 *)data);
+               tmprc = SMB2_set_hardlink(xid, tcon, fid.persistent_fid,
+                                         fid.volatile_fid, (__le16 *)data);
                break;
        case SMB2_OP_SET_EOF:
-               tmprc = SMB2_set_eof(xid, tcon, persistent_fid, volatile_fid,
-                                    current->tgid, (__le64 *)data);
+               tmprc = SMB2_set_eof(xid, tcon, fid.persistent_fid,
+                                    fid.volatile_fid, current->tgid,
+                                    (__le64 *)data);
                break;
        case SMB2_OP_SET_INFO:
-               tmprc = SMB2_set_info(xid, tcon, persistent_fid, volatile_fid,
+               tmprc = SMB2_set_info(xid, tcon, fid.persistent_fid,
+                                     fid.volatile_fid,
                                      (FILE_BASIC_INFO *)data);
                break;
        default:
@@ -96,7 +102,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
                break;
        }
 
-       rc = SMB2_close(xid, tcon, persistent_fid, volatile_fid);
+       rc = SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
        if (tmprc)
                rc = tmprc;
        kfree(utf16_path);
@@ -129,8 +135,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
                return -ENOMEM;
 
        rc = smb2_open_op_close(xid, tcon, cifs_sb, full_path,
-                               FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0,
-                               smb2_data, SMB2_OP_QUERY_INFO);
+                               FILE_READ_ATTRIBUTES, FILE_OPEN, 0, smb2_data,
+                               SMB2_OP_QUERY_INFO);
        if (rc)
                goto out;
 
@@ -145,7 +151,7 @@ smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
           struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name,
-                                 FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
+                                 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
                                  CREATE_NOT_FILE, NULL, SMB2_OP_MKDIR);
 }
 
@@ -164,7 +170,7 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
        dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
        data.Attributes = cpu_to_le32(dosattrs);
        tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name,
-                                  FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
+                                  FILE_WRITE_ATTRIBUTES, FILE_CREATE,
                                   CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
        if (tmprc == 0)
                cifs_i->cifsAttrs = dosattrs;
@@ -175,7 +181,7 @@ smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
           struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-                                 0, CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
+                                 CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
                                  NULL, SMB2_OP_DELETE);
 }
 
@@ -184,7 +190,7 @@ smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
            struct cifs_sb_info *cifs_sb)
 {
        return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-                                 0, CREATE_DELETE_ON_CLOSE, NULL,
+                                 CREATE_DELETE_ON_CLOSE, NULL,
                                  SMB2_OP_DELETE);
 }
 
@@ -203,7 +209,7 @@ smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
        }
 
        rc = smb2_open_op_close(xid, tcon, cifs_sb, from_name, access,
-                               FILE_OPEN, 0, 0, smb2_to_name, command);
+                               FILE_OPEN, 0, smb2_to_name, command);
 smb2_rename_path:
        kfree(smb2_to_name);
        return rc;
@@ -234,7 +240,7 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
 {
        __le64 eof = cpu_to_le64(size);
        return smb2_open_op_close(xid, tcon, cifs_sb, full_path,
-                                 FILE_WRITE_DATA, FILE_OPEN, 0, 0, &eof,
+                                 FILE_WRITE_DATA, FILE_OPEN, 0, &eof,
                                  SMB2_OP_SET_EOF);
 }
 
@@ -250,7 +256,7 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
        if (IS_ERR(tlink))
                return PTR_ERR(tlink);
        rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path,
-                               FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, 0, buf,
+                               FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
                                SMB2_OP_SET_INFO);
        cifs_put_tlink(tlink);
        return rc;