Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[deliverable/linux.git] / fs / cifs / smb2file.c
index 5da1b55a22581c5dd38daec3164c2ac32eb82a71..3f17b455083141c572fac5d88e95e56fbe54f89a 100644 (file)
 #include "fscache.h"
 #include "smb2proto.h"
 
-void
-smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
-{
-       oplock &= 0xFF;
-       if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
-               return;
-       if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) {
-               cinode->clientCanCacheAll = true;
-               cinode->clientCanCacheRead = true;
-               cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n",
-                        &cinode->vfs_inode);
-       } else if (oplock == SMB2_OPLOCK_LEVEL_II) {
-               cinode->clientCanCacheAll = false;
-               cinode->clientCanCacheRead = true;
-               cifs_dbg(FYI, "Level II Oplock granted on inode %p\n",
-                        &cinode->vfs_inode);
-       } else {
-               cinode->clientCanCacheAll = false;
-               cinode->clientCanCacheRead = false;
-       }
-}
-
 int
-smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
-              int disposition, int desired_access, int create_options,
-              struct cifs_fid *fid, __u32 *oplock, FILE_ALL_INFO *buf,
-              struct cifs_sb_info *cifs_sb)
+smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
+              __u32 *oplock, FILE_ALL_INFO *buf)
 {
        int rc;
        __le16 *smb2_path;
        struct smb2_file_all_info *smb2_data = NULL;
        __u8 smb2_oplock[17];
+       struct cifs_fid *fid = oparms->fid;
 
-       smb2_path = cifs_convert_path_to_utf16(path, cifs_sb);
+       smb2_path = cifs_convert_path_to_utf16(oparms->path, oparms->cifs_sb);
        if (smb2_path == NULL) {
                rc = -ENOMEM;
                goto out;
@@ -80,21 +57,19 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
                goto out;
        }
 
-       desired_access |= FILE_READ_ATTRIBUTES;
-       *smb2_oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
+       oparms->desired_access |= FILE_READ_ATTRIBUTES;
+       *smb2_oplock = SMB2_OPLOCK_LEVEL_BATCH;
 
-       if (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING)
+       if (oparms->tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING)
                memcpy(smb2_oplock + 1, fid->lease_key, SMB2_LEASE_KEY_SIZE);
 
-       rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid,
-                      &fid->volatile_fid, desired_access, disposition,
-                      0, 0, smb2_oplock, smb2_data);
+       rc = SMB2_open(xid, oparms, smb2_path, smb2_oplock, smb2_data, NULL);
        if (rc)
                goto out;
 
        if (buf) {
                /* open response does not have IndexNumber field - get it */
-               rc = SMB2_get_srv_num(xid, tcon, fid->persistent_fid,
+               rc = SMB2_get_srv_num(xid, oparms->tcon, fid->persistent_fid,
                                      fid->volatile_fid,
                                      &smb2_data->IndexNumber);
                if (rc) {
This page took 0.0258 seconds and 5 git commands to generate.