4 * Copyright (C) International Business Machines Corp., 2002, 2011
5 * Author(s): Steve French (sfrench@us.ibm.com),
6 * Pavel Shilovsky ((pshilovsky@samba.org) 2012
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 * the GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/stat.h>
24 #include <linux/slab.h>
25 #include <linux/pagemap.h>
26 #include <asm/div64.h>
30 #include "cifsproto.h"
31 #include "cifs_debug.h"
32 #include "cifs_fs_sb.h"
33 #include "cifs_unicode.h"
35 #include "smb2proto.h"
38 smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
39 int disposition, int desired_access, int create_options,
40 struct cifs_fid *fid, __u32 *oplock, FILE_ALL_INFO *buf,
41 struct cifs_sb_info *cifs_sb)
45 struct smb2_file_all_info *smb2_data = NULL;
47 smb2_path = cifs_convert_path_to_utf16(path, cifs_sb);
48 if (smb2_path == NULL) {
53 smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2,
55 if (smb2_data == NULL) {
60 desired_access |= FILE_READ_ATTRIBUTES;
62 rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid,
63 &fid->volatile_fid, desired_access, disposition,
69 /* open response does not have IndexNumber field - get it */
70 rc = SMB2_get_srv_num(xid, tcon, fid->persistent_fid,
72 &smb2_data->IndexNumber);
74 /* let get_inode_info disable server inode numbers */
75 smb2_data->IndexNumber = 0;
78 move_smb2_info_to_cifs(buf, smb2_data);