Fix the mess with ldb includes.
[ira/wip.git] / source4 / ntvfs / posix / vfs_posix.h
index 78b63612da4adb8361baeeea0af9ab5afe800b8a..b032ab3f931a9965ec232eae275513eb98a0e0d2 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_
 #include "system/filesys.h"
 #include "ntvfs/ntvfs.h"
 #include "ntvfs/common/ntvfs_common.h"
-#include "dsdb/samdb/samdb.h"
+#include "libcli/wbclient/wbclient.h"
+#include "lib/events/events.h"
+
+struct pvfs_wait;
+struct pvfs_oplock;
 
 /* this is the private structure for the posix vfs backend. It is used
    to hold per-connection (per tree connect) state information */
@@ -44,15 +47,21 @@ struct pvfs_state {
        struct brl_context *brl_context;
        struct odb_context *odb_context;
        struct notify_context *notify_context;
-       struct sidmap_context *sidmap;
+       struct wbc_context *wbc_ctx;
 
        /* a list of pending async requests. Needed to support
           ntcancel */
        struct pvfs_wait *wait_list;
 
-       /* the sharing violation timeout */
+       /* the sharing violation timeout (nsecs) */
        uint_t sharing_violation_delay;
 
+       /* the oplock break timeout (secs) */
+       uint_t oplock_break_timeout;
+
+       /* the write time update delay (nsecs) */
+       uint_t writetime_delay;
+
        /* filesystem attributes (see FS_ATTR_*) */
        uint32_t fs_attribs;
 
@@ -119,9 +128,9 @@ struct pvfs_filename {
        char *full_name;
        const char *stream_name; /* does not include :$DATA suffix */
        uint32_t stream_id;      /* this uses a hash, so is probabilistic */
-       BOOL has_wildcard;
-       BOOL exists;          /* true if the base filename exists */
-       BOOL stream_exists;   /* true if the stream exists */
+       bool has_wildcard;
+       bool exists;          /* true if the base filename exists */
+       bool stream_exists;   /* true if the stream exists */
        struct stat st;
        struct pvfs_dos_fileinfo dos;
 };
@@ -151,16 +160,28 @@ struct pvfs_file_handle {
        uint64_t seek_offset;
        uint64_t position;
 
-       BOOL have_opendb_entry;
+       bool have_opendb_entry;
+
+       /*
+        * we need to wait for oplock break requests from other processes,
+        * and we need to remember the pvfs_file so we can correctly
+        * forward the oplock break to the client
+        */
+       struct pvfs_oplock *oplock;
 
        /* we need this hook back to our parent for lock destruction */
        struct pvfs_state *pvfs;
 
-       /* have we set a sticky write time that we should remove on close */
-       BOOL sticky_write_time;
+       struct {
+               bool update_triggered;
+               struct tevent_timer *update_event;
+               bool update_on_close;
+               NTTIME close_time;
+               bool update_forced;
+       } write_time;
 
        /* the open went through to completion */
-       BOOL open_completed;
+       bool open_completed;
 };
 
 /* open file state */
@@ -204,12 +225,13 @@ struct pvfs_search_state {
        time_t last_used;
        uint_t num_ea_names;
        struct ea_name *ea_names;
-       struct timed_event *te;
+       struct tevent_timer *te;
 };
 
 /* flags to pvfs_resolve_name() */
 #define PVFS_RESOLVE_WILDCARD    (1<<0)
 #define PVFS_RESOLVE_STREAMS     (1<<1)
+#define PVFS_RESOLVE_NO_OPENDB   (1<<2)
 
 /* flags in pvfs->flags */
 #define PVFS_FLAG_CI_FILESYSTEM  (1<<0) /* the filesystem is case insensitive */
@@ -229,18 +251,27 @@ struct pvfs_dir;
 /* types of notification for pvfs wait events */
 enum pvfs_wait_notice {PVFS_WAIT_EVENT, PVFS_WAIT_TIMEOUT, PVFS_WAIT_CANCEL};
 
+/*
+  state of a pending retry
+*/
+struct pvfs_odb_retry;
+
 #define PVFS_EADB                      "posix:eadb"
 #define PVFS_XATTR                     "posix:xattr"
 #define PVFS_FAKE_OPLOCKS              "posix:fakeoplocks"
 #define PVFS_SHARE_DELAY               "posix:sharedelay"
+#define PVFS_OPLOCK_TIMEOUT            "posix:oplocktimeout"
+#define PVFS_WRITETIME_DELAY           "posix:writetimeupdatedelay"
 #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_XATTR_DEFAULT                     true
+#define PVFS_FAKE_OPLOCKS_DEFAULT              false
+#define PVFS_SHARE_DELAY_DEFAULT               1000000 /* nsecs */
+#define PVFS_OPLOCK_TIMEOUT_DEFAULT            30 /* secs */
+#define PVFS_WRITETIME_DELAY_DEFAULT           2000000 /* nsecs */
 #define PVFS_ALLOCATION_ROUNDING_DEFAULT       512
 #define PVFS_SEARCH_INACTIVITY_DEFAULT         300
 
@@ -252,6 +283,7 @@ struct pvfs_acl_ops {
 };
 
 #include "ntvfs/posix/vfs_posix_proto.h"
+#include "ntvfs/posix/vfs_acl_proto.h"
 
 NTSTATUS pvfs_aio_pread(struct ntvfs_request *req, union smb_read *rd,
                        struct pvfs_file *f, uint32_t maxcnt);