summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-09-05 20:36:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:03:31 -0500
commit34721ad233227300d9c2e8b5483ba2c6c798a7da (patch)
treebf21c382d78ebda8dfcd4bd5a046cfce5da4987d /source3/include
parent1171bc9a99358d943f75494fcdaf1a62e594789e (diff)
downloadsamba-34721ad233227300d9c2e8b5483ba2c6c798a7da.tar.gz
samba-34721ad233227300d9c2e8b5483ba2c6c798a7da.tar.bz2
samba-34721ad233227300d9c2e8b5483ba2c6c798a7da.zip
r10042: Add in external LGPL library for accessing the share mode db. Allow
others to examine & test. May not end up here eventually... Jeremy. (This used to be commit 7cc70ae63399eacd55bd0bf51ac2c7b004d761bf)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/smb_share_modes.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/source3/include/smb_share_modes.h b/source3/include/smb_share_modes.h
new file mode 100644
index 0000000000..5a79e171d5
--- /dev/null
+++ b/source3/include/smb_share_modes.h
@@ -0,0 +1,103 @@
+/*
+ Samba share mode database library.
+
+ Copyright (C) Jeremy Allison 2005.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _SMB_SHARE_MODES_H_
+#define _SMB_STATE_MODES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include "tdb.h"
+
+/* Database context handle. */
+struct smbdb_ctx {
+ TDB_CONTEXT *smb_tdb;
+};
+
+/* Share mode entry. */
+/*
+ We use 64 bit types for device and inode as
+ we don't know what size mode Samba has been
+ compiled in - dev/ino may be 32, may be 64
+ bits. This interface copes with either.
+*/
+
+struct smb_share_mode_entry {
+ uint64_t dev;
+ uint64_t ino;
+ uint32_t share_access;
+ uint32_t access_mask;
+ struct timeval open_time;
+ uint32_t file_id;
+ pid_t pid;
+};
+
+/*
+ * open/close sharemode database.
+ */
+
+struct smbdb_ctx *smb_share_mode_db_open(const char *db_path);
+int smb_share_mode_db_close(struct smbdb_ctx *db_ctx);
+
+/*
+ * lock/unlock entry in sharemode database.
+ */
+
+int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino);
+
+int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino);
+
+/*
+ * Share mode database accessor functions.
+ */
+
+int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino,
+ struct smb_share_mode_entry **pp_list,
+ unsigned char *p_delete_on_close);
+
+int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino,
+ const struct smb_share_mode_entry *set_entry,
+ const char *path);
+
+int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino,
+ const struct smb_share_mode_entry *set_entry);
+
+int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx,
+ uint64_t dev,
+ uint64_t ino,
+ const struct smb_share_mode_entry *set_entry,
+ const struct smb_share_mode_entry *new_entry);
+
+#ifdef __cplusplus
+}
+#endif
+#endif