Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fix
[cascardo/linux.git] / fs / cifs / cifspdu.h
index 7d95054..d619ca7 100644 (file)
 #define BAD_PROT 0xFFFF
 
 /* SMB command codes */
-/* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
- (ie which include no useful data other than the SMB error code itself).
- Knowing this helps avoid response buffer allocations and copy in some cases */
+/*
+ * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
+ * (ie which include no useful data other than the SMB error code itself).
+ * Knowing this helps avoid response buffer allocations and copy in some cases
+ */
 #define SMB_COM_CREATE_DIRECTORY      0x00 /* trivial response */
 #define SMB_COM_DELETE_DIRECTORY      0x01 /* trivial response */
 #define SMB_COM_CLOSE                 0x04 /* triv req/rsp, timestamp ignored */
  */
 #define CIFS_NO_HANDLE        0xFFFF
 
+#define NO_CHANGE_64          cpu_to_le64(0xFFFFFFFFFFFFFFFFULL)
+#define NO_CHANGE_32          0xFFFFFFFFUL
+
 /* IPC$ in ASCII */
 #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
 
@@ -1383,7 +1388,7 @@ struct smb_t2_rsp {
 #define SMB_SET_POSIX_LOCK              0x208
 #define SMB_POSIX_OPEN                  0x209
 #define SMB_POSIX_UNLINK                0x20a
-#define SMB_SET_FILE_UNIX_INFO2
+#define SMB_SET_FILE_UNIX_INFO2         0x20b
 #define SMB_SET_FILE_BASIC_INFO2        0x3ec
 #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo too */
 #define SMB_FILE_ALL_INFO2              0x3fa
@@ -1882,7 +1887,13 @@ typedef struct {
                                                      calls including posix open
                                                      and posix unlink */ 
 #ifdef CONFIG_CIFS_POSIX
-#define CIFS_UNIX_CAP_MASK              0x0000003b
+/* Can not set pathnames cap yet until we send new posix create SMB since
+   otherwise server can treat such handles opened with older ntcreatex
+   (by a new client which knows how to send posix path ops)
+   as non-posix handles (can affect write behavior with byte range locks.
+   We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
+/* #define CIFS_UNIX_CAP_MASK              0x0000003b */
+#define CIFS_UNIX_CAP_MASK              0x0000001b 
 #else 
 #define CIFS_UNIX_CAP_MASK              0x00000013
 #endif /* CONFIG_CIFS_POSIX */
@@ -2098,22 +2109,40 @@ struct cifs_posix_acl { /* access conrol list  (ACL) */
 
 /* end of POSIX ACL definitions */
 
+/* POSIX Open Flags */
+#define SMB_O_RDONLY    0x1
+#define SMB_O_WRONLY   0x2
+#define SMB_O_RDWR     0x4
+#define SMB_O_CREAT    0x10
+#define SMB_O_EXCL     0x20
+#define SMB_O_TRUNC    0x40
+#define SMB_O_APPEND   0x80
+#define SMB_O_SYNC     0x100
+#define SMB_O_DIRECTORY 0x200
+#define SMB_O_NOFOLLOW         0x400
+#define SMB_O_DIRECT   0x800
+
 typedef struct {
-       __u32 OpenFlags; /* same as NT CreateX */
-       __u32 PosixOpenFlags;
-       __u32 Mode;
-       __u16 Level; /* reply level requested (see QPathInfo levels) */
-       __u16 Pad;  /* reserved - MBZ */
+       __le32 OpenFlags; /* same as NT CreateX */
+       __le32 PosixOpenFlags;
+       __le64 Permissions;
+       __le16 Level; /* reply level requested (see QPathInfo levels) */
 } __attribute__((packed)) OPEN_PSX_REQ; /* level 0x209 SetPathInfo data */
 
 typedef struct {
-       /* reply varies based on requested level */
+       __le16 OplockFlags;
+       __u16 Fid;
+       __le32 CreateAction;
+       __le16 ReturnedLevel;
+       __le16 Pad;
+       /* struct following varies based on requested level */
 } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
 
 
 struct file_internal_info {
        __u64  UniqueId; /* inode number */
 } __attribute__((packed));      /* level 0x3ee */
+
 struct file_mode_info {
        __le32  Mode;
 } __attribute__((packed));      /* level 0x3f8 */