From 7a5fa7f12ec439ef5a4af29aa86498f799b6b9a5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Feb 2007 21:05:34 +0000 Subject: r21191: Add in the POSIX open/mkdir/unlink calls. Move more error code returns to NTSTATUS. Client test code to follow... See if this passes the build-farm before I add it into 3.0.25. Jeremy. (This used to be commit 83dbbdff345fa9e427c9579183f4380004bf3dd7) --- source3/include/smb.h | 27 ++++++++++++++++----------- source3/include/trans2.h | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 12 deletions(-) (limited to 'source3/include') diff --git a/source3/include/smb.h b/source3/include/smb.h index 71ff656385..7bc5c0a414 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -515,6 +515,7 @@ typedef struct files_struct { BOOL aio_write_behind; BOOL lockdb_clean; BOOL initial_delete_on_close; /* Only set at NTCreateX if file was created. */ + BOOL posix_open; char *fsp_name; struct vfs_fsp_data *vfs_extension; @@ -736,6 +737,8 @@ struct pending_message_list { DATA_BLOB private_data; }; +#define SHARE_MODE_FLAG_POSIX_OPEN 0x1 + /* struct returned by get_share_modes */ struct share_mode_entry { struct process_id pid; @@ -752,6 +755,7 @@ struct share_mode_entry { SMB_INO_T inode; unsigned long share_file_id; uint32 uid; /* uid of file opener. */ + uint16 flags; /* POSIX_OPEN only defined so far... */ }; /* oplock break message definition - linearization of share_mode_entry. @@ -769,10 +773,11 @@ Offset Data length. 36 SMB_INO_T inode 8 bytes 44 unsigned long file_id 4 bytes 48 uint32 uid 4 bytes -52 +52 uint16 flags 2 bytes +54 */ -#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 52 +#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 54 struct share_mode_lock { const char *servicepath; /* canonicalized. */ @@ -1580,19 +1585,19 @@ extern int chain_size; * Note these must fit into 16-bits. */ -#define NO_OPLOCK 0 -#define EXCLUSIVE_OPLOCK 1 -#define BATCH_OPLOCK 2 -#define LEVEL_II_OPLOCK 4 +#define NO_OPLOCK 0x0 +#define EXCLUSIVE_OPLOCK 0x1 +#define BATCH_OPLOCK 0x2 +#define LEVEL_II_OPLOCK 0x4 /* The following are Samba-private. */ -#define INTERNAL_OPEN_ONLY 8 -#define FAKE_LEVEL_II_OPLOCK 16 /* Client requested no_oplock, but we have to +#define INTERNAL_OPEN_ONLY 0x8 +#define FAKE_LEVEL_II_OPLOCK 0x10 /* Client requested no_oplock, but we have to * inform potential level2 holders on * write. */ -#define DEFERRED_OPEN_ENTRY 32 -#define UNUSED_SHARE_MODE_ENTRY 64 -#define FORCE_OPLOCK_BREAK_TO_NONE 128 +#define DEFERRED_OPEN_ENTRY 0x20 +#define UNUSED_SHARE_MODE_ENTRY 0x40 +#define FORCE_OPLOCK_BREAK_TO_NONE 0x80 /* None of the following should ever appear in fsp->oplock_request. */ #define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY|DEFERRED_OPEN_ENTRY|UNUSED_SHARE_MODE_ENTRY|FORCE_OPLOCK_BREAK_TO_NONE) diff --git a/source3/include/trans2.h b/source3/include/trans2.h index 92c5a2e963..44e85d8489 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -446,6 +446,13 @@ Offset Size Name /* Only valid for setfileinfo */ #define SMB_SET_POSIX_LOCK 0x208 +/* The set info levels for POSIX path operations. */ +#define SMB_POSIX_PATH_OPEN 0x209 +#define SMB_POSIX_PATH_UNLINK 0x20A + +#define SMB_QUERY_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */ +#define SMB_SET_FILE_UNIX_INFO2 0x20B + /* Transact 2 Find First levels */ #define SMB_FIND_FILE_UNIX 0x202 @@ -477,6 +484,7 @@ Offset Size Name #define CIFS_UNIX_EXTATTR_CAP 0x8 /* for support of chattr (chflags) and lsattr */ #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x10 /* Use POSIX pathnames on the wire. */ +#define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP 0x20 /* We can cope with POSIX open/mkdir/unlink etc. */ #define SMB_QUERY_POSIX_FS_INFO 0x201 @@ -579,7 +587,7 @@ number of entries sent will be zero. #define SMB_POSIX_IGNORE_ACE_ENTRIES 0xFFFF -/* Definition of SMB_SET_POSIX_LOCK */ +/* Definition of parameter block of SMB_SET_POSIX_LOCK */ /* [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock [2 bytes] lock_flags - 1 = Wait (only valid for setlock) @@ -602,4 +610,37 @@ number of entries sent will be zero. #define POSIX_LOCK_TYPE_WRITE 1 #define POSIX_LOCK_TYPE_UNLOCK 2 +/* SMB_POSIX_PATH_OPEN "open_mode" definitions. */ +#define SMB_O_RDONLY 0x1 +#define SMB_O_WRONLY 0x2 +#define SMB_O_RDWR 0x4 + +#define SMB_ACCMODE 0x7 + +#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 + +/* Definition of request parameter block for SMB_POSIX_PATH_OPEN */ +/* + [4 bytes] flags (as smb_ntcreate_Flags). + [4 bytes] open_mode + [4 bytes] mode_t - same encoding as "Standard UNIX permissions" above. + [2 bytes] ret_info_level - optimization. Info level to be returned. +*/ + +/* Definition of reply data block for SMB_POSIX_PATH_OPEN */ + +#define SMB_NO_INFO_LEVEL_RETURNED 0xFFFF + +/* + [2 bytes] reply info level - as requested or 0xFFFF if not available. + [n bytes] - info level reply - if available. +*/ + #endif -- cgit