summaryrefslogtreecommitdiff
path: root/fs/cifs/smb1ops.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-19 03:20:26 +0400
committerSteve French <smfrench@gmail.com>2012-09-25 06:46:26 +0400
commitfb1214e48f735cdb68446adb77ec37aa3de60697 (patch)
tree158dbfbedaf396f013e70f5288fdc906e990391c /fs/cifs/smb1ops.c
parent4b4de76e35518fc0c636f628abca8c1b19ad6689 (diff)
downloadlinux-fb1214e48f735cdb68446adb77ec37aa3de60697.tar.xz
CIFS: Move open code to ops struct
Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r--fs/cifs/smb1ops.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index b170da0a882d..907b30865000 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -607,6 +607,33 @@ cifs_mkdir_setinfo(struct inode *inode, const char *full_path,
cifsInode->cifsAttrs = dosattrs;
}
+static int
+cifs_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)
+{
+ if (!(tcon->ses->capabilities & CAP_NT_SMBS))
+ return SMBLegacyOpen(xid, tcon, path, disposition,
+ desired_access, CREATE_NOT_DIR,
+ &fid->netfid, oplock, buf,
+ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
+ & CIFS_MOUNT_MAP_SPECIAL_CHR);
+ return CIFSSMBOpen(xid, tcon, path, disposition, desired_access,
+ create_options, &fid->netfid, oplock, buf,
+ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
+ CIFS_MOUNT_MAP_SPECIAL_CHR);
+}
+
+static void
+cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
+{
+ struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
+ cfile->fid.netfid = fid->netfid;
+ cifs_set_oplock_level(cinode, oplock);
+ cinode->can_cache_brlcks = cinode->clientCanCacheAll;
+}
+
struct smb_version_operations smb1_operations = {
.send_cancel = send_nt_cancel,
.compare_fids = cifs_compare_fids,
@@ -646,6 +673,8 @@ struct smb_version_operations smb1_operations = {
.rmdir = CIFSSMBRmDir,
.unlink = CIFSSMBDelFile,
.rename_pending_delete = cifs_rename_pending_delete,
+ .open = cifs_open_file,
+ .set_fid = cifs_set_fid,
};
struct smb_version_values smb1_values = {