Samba 3: added Samba 3.0.24 sources
[tomato.git] / release / src / router / samba3 / source / include / smb_share_modes.h
blob1e04ea496de2ca5ef4f4fd62c2746844e792c752
1 /*
2 Samba share mode database library.
4 Copyright (C) Jeremy Allison 2005.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _SMB_SHARE_MODES_H_
22 #define _SMB_STATE_MODES_H_
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 #if HAVE_INTTYPES_H
29 # include <inttypes.h>
30 #else
31 # if HAVE_STDINT_H
32 # include <stdint.h>
33 # endif
34 #endif
36 #include "tdb.h"
38 /* Database context handle. */
39 struct smbdb_ctx {
40 TDB_CONTEXT *smb_tdb;
43 /* Share mode entry. */
45 We use 64 bit types for device and inode as
46 we don't know what size mode Samba has been
47 compiled in - dev/ino may be 32, may be 64
48 bits. This interface copes with either.
51 struct smb_share_mode_entry {
52 uint64_t dev;
53 uint64_t ino;
54 uint32_t share_access;
55 uint32_t access_mask;
56 struct timeval open_time;
57 uint32_t file_id;
58 struct process_id pid;
62 * open/close sharemode database.
65 struct smbdb_ctx *smb_share_mode_db_open(const char *db_path);
66 int smb_share_mode_db_close(struct smbdb_ctx *db_ctx);
69 * lock/unlock entry in sharemode database.
72 int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
73 uint64_t dev,
74 uint64_t ino);
76 int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
77 uint64_t dev,
78 uint64_t ino);
81 * Share mode database accessor functions.
84 int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
85 uint64_t dev,
86 uint64_t ino,
87 struct smb_share_mode_entry **pp_list,
88 unsigned char *p_delete_on_close);
90 int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx,
91 uint64_t dev,
92 uint64_t ino,
93 const struct smb_share_mode_entry *set_entry,
94 const char *path);
96 int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
97 uint64_t dev,
98 uint64_t ino,
99 const struct smb_share_mode_entry *set_entry);
101 int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx,
102 uint64_t dev,
103 uint64_t ino,
104 const struct smb_share_mode_entry *set_entry,
105 const struct smb_share_mode_entry *new_entry);
107 #ifdef __cplusplus
109 #endif
110 #endif