CIFS: Make transport routines work with SMB2
[profile/ivi/kernel-x86-ivi.git] / fs / cifs / smb2ops.c
1 /*
2  *  SMB2 version specific operations
3  *
4  *  Copyright (c) 2012, Jeff Layton <jlayton@redhat.com>
5  *
6  *  This library is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License v2 as published
8  *  by the Free Software Foundation.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13  *  the GNU Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public License
16  *  along with this library; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19
20 #include "cifsglob.h"
21 #include "smb2pdu.h"
22 #include "smb2proto.h"
23
24 static __u64
25 smb2_get_next_mid(struct TCP_Server_Info *server)
26 {
27         __u64 mid;
28         /* for SMB2 we need the current value */
29         spin_lock(&GlobalMid_Lock);
30         mid = server->CurrentMid++;
31         spin_unlock(&GlobalMid_Lock);
32         return mid;
33 }
34
35 struct smb_version_operations smb21_operations = {
36         .setup_request = smb2_setup_request,
37         .check_receive = smb2_check_receive,
38         .get_next_mid = smb2_get_next_mid,
39 };
40
41 struct smb_version_values smb21_values = {
42         .version_string = SMB21_VERSION_STRING,
43         .lock_cmd = SMB2_LOCK,
44 };