opendb: pass down a pointer to the fd in odb_open_file()
[jelmer/samba4-debian.git] / source / ntvfs / common / opendb.c
index 36144d0406b09a20cb1c1d62f6ce5323e91be0f7..676706e03f18ddd6f4504253bd2f40ecca106213 100644 (file)
@@ -87,22 +87,22 @@ _PUBLIC_ DATA_BLOB odb_get_key(TALLOC_CTX *mem_ctx, struct odb_lock *lck)
 }
 
 /*
-  register an open file in the open files database. This implements the share_access
-  rules
+  register an open file in the open files database.
+  The share_access rules are implemented by odb_can_open()
+  and it's needed to call odb_can_open() before
+  odb_open_file() otherwise NT_STATUS_INTERNAL_ERROR is returned
 
   Note that the path is only used by the delete on close logic, not
   for comparing with other filenames
 */
 _PUBLIC_ NTSTATUS odb_open_file(struct odb_lock *lck,
                                void *file_handle, const char *path,
-                               uint32_t stream_id, uint32_t share_access,
-                               uint32_t access_mask, bool delete_on_close,
-                               uint32_t open_disposition, bool break_to_none,
+                               int *fd, bool allow_level_II_oplock,
                                uint32_t oplock_level, uint32_t *oplock_granted)
 {
-       return ops->odb_open_file(lck, file_handle, path, stream_id, share_access,
-                                 access_mask, delete_on_close, open_disposition,
-                                 break_to_none, oplock_level, oplock_granted);
+       return ops->odb_open_file(lck, file_handle, path,
+                                 fd, allow_level_II_oplock,
+                                 oplock_level, oplock_granted);
 }
 
 
@@ -118,9 +118,10 @@ _PUBLIC_ NTSTATUS odb_open_file_pending(struct odb_lock *lck, void *private)
 /*
   remove a opendb entry
 */
-_PUBLIC_ NTSTATUS odb_close_file(struct odb_lock *lck, void *file_handle)
+_PUBLIC_ NTSTATUS odb_close_file(struct odb_lock *lck, void *file_handle,
+                                const char **delete_path)
 {
-       return ops->odb_close_file(lck, file_handle);
+       return ops->odb_close_file(lck, file_handle, delete_path);
 }
 
 
@@ -141,6 +142,14 @@ _PUBLIC_ NTSTATUS odb_rename(struct odb_lock *lck, const char *path)
        return ops->odb_rename(lck, path);
 }
 
+/*
+  get back the path of an open file
+*/
+_PUBLIC_ NTSTATUS odb_get_path(struct odb_lock *lck, const char **path)
+{
+       return ops->odb_get_path(lck, path);
+}
+
 /*
   update delete on close flag on an open file
 */
@@ -154,10 +163,9 @@ _PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, bool del_on_clos
   people still have the file open
 */
 _PUBLIC_ NTSTATUS odb_get_delete_on_close(struct odb_context *odb, 
-                                         DATA_BLOB *key, bool *del_on_close, 
-                                         int *open_count, char **path)
+                                         DATA_BLOB *key, bool *del_on_close)
 {
-       return ops->odb_get_delete_on_close(odb, key, del_on_close, open_count, path);
+       return ops->odb_get_delete_on_close(odb, key, del_on_close);
 }