r23792: convert Samba4 to GPLv3
[samba.git] / source4 / ntvfs / posix / vfs_posix.h
index 335cfdf4e08b1babfa7bf520a7d96110f0f5ca63..b08110915b7dc50cad030ff1d076fae34270b382 100644 (file)
@@ -7,7 +7,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef _VFS_POSIX_H_
@@ -26,7 +25,7 @@
 #include "librpc/gen_ndr/xattr.h"
 #include "system/filesys.h"
 #include "ntvfs/ntvfs.h"
-#include "ntvfs/common/proto.h"
+#include "ntvfs/common/ntvfs_common.h"
 #include "dsdb/samdb/samdb.h"
 
 /* this is the private structure for the posix vfs backend. It is used
@@ -63,9 +62,6 @@ struct pvfs_state {
        uint32_t alloc_size_rounding;
 
        struct {
-               /* an id tree mapping open file handle -> struct pvfs_file */
-               struct idr_context *idtree;
-
                /* the open files as DLINKLIST */
                struct pvfs_file *list;
        } files;
@@ -86,6 +82,17 @@ struct pvfs_state {
                const struct dom_sid *creator_owner;
                const struct dom_sid *creator_group;            
        } sid_cache;
+
+       /* the acl backend */
+       const struct pvfs_acl_ops *acl_ops;
+
+       /* non-flag share options */
+       struct {
+               mode_t dir_mask;
+               mode_t force_dir_mode;
+               mode_t create_mask;
+               mode_t force_create_mode;
+       } options;
 };
 
 /* this is the basic information needed about a file from the filesystem */
@@ -134,9 +141,6 @@ struct pvfs_file_handle {
        /* a unique file key to be used for open file locking */
        DATA_BLOB odb_locking_key;
 
-       /* a unique file key to be used for byte range locking */
-       DATA_BLOB brl_locking_key;
-
        uint32_t create_options;
 
        /* this is set by the mode_information level. What does it do? */
@@ -153,13 +157,16 @@ struct pvfs_file_handle {
 
        /* have we set a sticky write time that we should remove on close */
        BOOL sticky_write_time;
+
+       /* the open went through to completion */
+       BOOL open_completed;
 };
 
 /* open file state */
 struct pvfs_file {
        struct pvfs_file *next, *prev;
        struct pvfs_file_handle *handle;
-       uint16_t fnum;
+       struct ntvfs_handle *ntvfs;
 
        struct pvfs_state *pvfs;
 
@@ -167,23 +174,21 @@ struct pvfs_file {
        uint32_t share_access;
        uint32_t access_mask;
 
-       /* we need to remember the session it was opened on,
-          as it is illegal to operate on someone elses fnum */
-       struct auth_session_info *session_info;
-
-       /* we need to remember the client pid that 
-          opened the file so SMBexit works */
-       uint16_t smbpid;
-
        /* a list of pending locks - used for locking cancel operations */
        struct pvfs_pending_lock *pending_list;
 
+       /* a file handle to be used for byte range locking */
+       struct brl_handle *brl_handle;
+
        /* a count of active locks - used to avoid calling brl_close on
           file close */
        uint64_t lock_count;
 
        /* for directories, a buffer of pending notify events */
        struct pvfs_notify_buffer *notify_buffer;
+
+       /* for directories, the state of an incomplete SMB2 Find */
+       struct pvfs_search_state *search;
 };
 
 /* the state of a search started with pvfs_search_first() */
@@ -191,7 +196,7 @@ struct pvfs_search_state {
        struct pvfs_search_state *prev, *next;
        struct pvfs_state *pvfs;
        uint16_t handle;
-       uint_t current_index;
+       off_t current_index;
        uint16_t search_attrib;
        uint16_t must_attrib;
        struct pvfs_dir *dir;
@@ -215,6 +220,7 @@ struct pvfs_search_state {
 #define PVFS_FLAG_STRICT_LOCKING (1<<6)
 #define PVFS_FLAG_XATTR_ENABLE   (1<<7)
 #define PVFS_FLAG_FAKE_OPLOCKS   (1<<8)
+#define PVFS_FLAG_LINUX_AIO      (1<<9)
 
 /* forward declare some anonymous structures */
 struct pvfs_dir;
@@ -222,6 +228,33 @@ struct pvfs_dir;
 /* types of notification for pvfs wait events */
 enum pvfs_wait_notice {PVFS_WAIT_EVENT, PVFS_WAIT_TIMEOUT, PVFS_WAIT_CANCEL};
 
+#define PVFS_EADB                      "posix:eadb"
+#define PVFS_XATTR                     "posix:xattr"
+#define PVFS_FAKE_OPLOCKS              "posix:fakeoplocks"
+#define PVFS_SHARE_DELAY               "posix:sharedelay"
+#define PVFS_ALLOCATION_ROUNDING       "posix:allocationrounding"
+#define PVFS_SEARCH_INACTIVITY         "posix:searchinactivity"
+#define PVFS_ACL                       "posix:acl"
+#define PVFS_AIO                       "posix:aio"
+
+#define PVFS_XATTR_DEFAULT                     True
+#define PVFS_FAKE_OPLOCKS_DEFAULT              False
+#define PVFS_SHARE_DELAY_DEFAULT               1000000
+#define PVFS_ALLOCATION_ROUNDING_DEFAULT       512
+#define PVFS_SEARCH_INACTIVITY_DEFAULT         300
+
+struct pvfs_acl_ops {
+       const char *name;
+       NTSTATUS (*acl_load)(struct pvfs_state *, struct pvfs_filename *, int , TALLOC_CTX *, 
+                            struct security_descriptor **);
+       NTSTATUS (*acl_save)(struct pvfs_state *, struct pvfs_filename *, int , struct security_descriptor *);
+};
+
 #include "ntvfs/posix/vfs_posix_proto.h"
 
+NTSTATUS pvfs_aio_pread(struct ntvfs_request *req, union smb_read *rd,
+                       struct pvfs_file *f, uint32_t maxcnt);
+NTSTATUS pvfs_aio_pwrite(struct ntvfs_request *req, union smb_write *wr,
+                        struct pvfs_file *f);
+
 #endif /* _VFS_POSIX_H_ */