[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-1024-g73d5f14
Tim Prouty
tprouty at samba.org
Fri Feb 20 06:32:27 GMT 2009
The branch, master has been updated
via 73d5f14c04f2487f67695ce2e9ff025e25b2b026 (commit)
via 53bcd162ee4fd55fc5cc3293596f8733ce636b11 (commit)
via 04a7213eb6a2b776c17a5b56ba3b66e3c3444507 (commit)
via 2b53b791938bf6b6855b854561dcff70dbc328d3 (commit)
via e4675ce8db436ac572fcc476b9bfb1116e997f9f (commit)
via 6fbebb5369211b72545a1dd588bc6b9fa04210a1 (commit)
from 669f2a02e29195aaba8cb2f3e50cb2ce66b904a6 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 73d5f14c04f2487f67695ce2e9ff025e25b2b026
Author: Tim Prouty <tprouty at samba.org>
Date: Tue Feb 17 20:39:03 2009 -0800
s3 OneFS: Add shadow copy module
commit 53bcd162ee4fd55fc5cc3293596f8733ce636b11
Author: Tim Prouty <tprouty at samba.org>
Date: Tue Feb 17 18:38:58 2009 -0800
s3 OneFS: Add file_id_create implementation to take advantage of snapshots
commit 04a7213eb6a2b776c17a5b56ba3b66e3c3444507
Author: Tim Prouty <tprouty at samba.org>
Date: Mon Feb 16 16:06:45 2009 -0800
s3: Change the vfs_GetWd cache to use the file_id struct
commit 2b53b791938bf6b6855b854561dcff70dbc328d3
Author: Tim Prouty <tprouty at samba.org>
Date: Mon Feb 16 14:55:52 2009 -0800
s3: Remove unused inform_level2_message struct
commit e4675ce8db436ac572fcc476b9bfb1116e997f9f
Author: Tim Prouty <tprouty at samba.org>
Date: Sun Feb 15 23:45:28 2009 -0800
s3: Add extid to the dev/inode pair
This extends the file_id struct to add an additional generic uint64_t
field: extid. For backwards compatibility with dev/inodes stored in
xattr_tdbs and acl_tdbs, the ext id is ignored for these databases.
This patch should cause no functional change on systems that don't use
SMB_VFS_FILE_ID_CREATE to set the extid.
Existing code that uses the smb_share_mode library will need to be
updated to be compatibile with the new extid.
commit 6fbebb5369211b72545a1dd588bc6b9fa04210a1
Author: Tim Prouty <tprouty at samba.org>
Date: Sun Feb 15 23:38:53 2009 -0800
s3: Modify SMB_VFS_FILE_ID_CREATE to take a stat struct
Since file_id_create_dev is incompatible with the concept of file_ids,
it is now static and in the one file that needs it.
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_opaque.c | 2 +-
examples/VFS/skel_transparent.c | 4 +-
source3/Makefile.in | 5 +
source3/configure.in | 3 +-
source3/include/locking.h | 1 +
source3/include/proto.h | 4 +-
source3/include/smb.h | 56 +--
source3/include/smb_share_modes.h | 11 +-
source3/include/vfs.h | 3 +-
source3/include/vfs_macros.h | 6 +-
source3/lib/file_id.c | 47 +-
source3/libsmb/smb_share_modes.c | 39 +-
source3/locking/locking.c | 6 +-
source3/modules/onefs_shadow_copy.c | 782 +++++++++++++++++++++++++++++++
source3/modules/onefs_shadow_copy.h | 32 ++
source3/modules/vfs_acl_tdb.c | 6 +
source3/modules/vfs_default.c | 15 +-
source3/modules/vfs_fileid.c | 6 +-
source3/modules/vfs_full_audit.c | 6 +-
source3/modules/vfs_onefs.c | 18 +
source3/modules/vfs_onefs_shadow_copy.c | 717 ++++++++++++++++++++++++++++
source3/modules/vfs_streams_depot.c | 3 +-
source3/modules/vfs_xattr_tdb.c | 23 +-
source3/smbd/globals.c | 3 +-
source3/smbd/nttrans.c | 2 +
source3/smbd/open.c | 4 +-
source3/smbd/oplock.c | 28 +-
source3/smbd/oplock_irix.c | 18 +
source3/smbd/vfs.c | 15 +-
29 files changed, 1737 insertions(+), 128 deletions(-)
create mode 100644 source3/modules/onefs_shadow_copy.c
create mode 100644 source3/modules/onefs_shadow_copy.h
create mode 100644 source3/modules/vfs_onefs_shadow_copy.c
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 2eb7a94..5845f62 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -292,7 +292,7 @@ static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags
}
static struct file_id skel_file_id_create(vfs_handle_struct *handle,
- SMB_DEV_T dev, SMB_INO_T inode)
+ const SMB_STRUCT_STAT *sbuf)
{
struct file_id id_zero;
ZERO_STRUCT(id_zero);
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 5670965..7036c73 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -284,9 +284,9 @@ static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags
}
static struct file_id skel_file_id_create(vfs_handle_struct *handle,
- SMB_DEV_T dev, SMB_INO_T inode)
+ const SMB_STRUCT_STAT *sbuf)
{
- return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode);
+ return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
}
static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 9bac719..6ff90fc 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -667,6 +667,7 @@ VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
VFS_ONEFS_OBJ = modules/vfs_onefs.o modules/onefs_acl.o modules/onefs_system.o \
modules/onefs_open.o modules/onefs_streams.o modules/onefs_dir.c \
modules/onefs_cbrl.o
+VFS_ONEFS_SHADOW_COPY_OBJ = modules/vfs_onefs_shadow_copy.o modules/onefs_shadow_copy.o
PERFCOUNT_ONEFS_OBJ = modules/perfcount_onefs.o
PERFCOUNT_TEST_OBJ = modules/perfcount_test.o
@@ -2559,6 +2560,10 @@ bin/onefs. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_ONEFS_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_ONEFS_OBJ) @ONEFS_LIBS@
+bin/onefs_shadow_copy. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_ONEFS_SHADOW_COPY_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(VFS_ONEFS_SHADOW_COPY_OBJ)
+
bin/pc_onefs. at SHLIBEXT@: $(BINARY_PREREQS) $(PERFCOUNT_ONEFS_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(PERFCOUNT_ONEFS_OBJ)
diff --git a/source3/configure.in b/source3/configure.in
index 57d475f..b163a9d 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1084,7 +1084,7 @@ AC_TRY_LINK([#include <isi_version/isi_version.h>],
echo $samba_cv_HAVE_ONEFS
if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
- default_shared_modules="$default_shared_modules vfs_onefs perfcount_onefs"
+ default_shared_modules="$default_shared_modules vfs_onefs vfs_onefs_shadow_copy perfcount_onefs"
ONEFS_LIBS="-lisi_acl -lisi_ecs -lisi_event -lisi_util"
# Need to also add general libs for oplocks support
save_LIBS="$save_LIBS -lisi_ecs -lisi_event -lisi_util -ldevstat"
@@ -6178,6 +6178,7 @@ SMB_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
SMB_MODULE(vfs_acl_tdb, \$(VFS_ACL_TDB_OBJ), "bin/acl_tdb.$SHLIBEXT", VFS)
SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_onefs_shadow_copy, \$(VFS_ONEFS_SHADOW_COPY), "bin/onefs_shadow_copy.$SHLIBEXT", VFS)
SMB_SUBSYSTEM(VFS,smbd/vfs.o)
diff --git a/source3/include/locking.h b/source3/include/locking.h
index 3fd5b94..1833ba3 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -49,6 +49,7 @@ struct file_id {
other than a dev_t for the device */
uint64_t devid;
uint64_t inode;
+ uint64_t extid; /* Support systems that use an extended id (e.g. snapshots). */
};
struct byte_range_lock {
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3806c96..ab1f2f4 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -508,12 +508,12 @@ void dump_core_setup(const char *progname);
/* The following definitions come from lib/file_id.c */
-struct file_id file_id_create_dev(SMB_DEV_T dev, SMB_INO_T inode);
struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
const char *file_id_string_tos(const struct file_id *id);
void push_file_id_16(char *buf, const struct file_id *id);
-void pull_file_id_16(char *buf, struct file_id *id);
+void push_file_id_24(char *buf, const struct file_id *id);
+void pull_file_id_24(char *buf, struct file_id *id);
/* The following definitions come from lib/gencache.c */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index bef0fd1..f020887 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -758,18 +758,19 @@ Offset Data length.
16 uint32 private_options 4
20 uint32 time sec 4
24 uint32 time usec 4
-28 SMB_DEV_T dev 8 bytes.
-36 SMB_INO_T inode 8 bytes
-44 unsigned long file_id 4 bytes
-48 uint32 uid 4 bytes
-52 uint16 flags 2 bytes
-54
+28 uint64 dev 8 bytes
+36 uint64 inode 8 bytes
+44 uint64 extid 8 bytes
+52 unsigned long file_id 4 bytes
+56 uint32 uid 4 bytes
+60 uint16 flags 2 bytes
+62
*/
#ifdef CLUSTER_SUPPORT
-#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 58
+#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 66
#else
-#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 54
+#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 62
#endif
struct share_mode_lock {
@@ -1620,48 +1621,43 @@ enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
#define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK)
#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK))
-struct inform_level2_message {
- SMB_DEV_T dev;
- SMB_INO_T inode;
- uint16 mid;
- unsigned long target_file_id;
- unsigned long source_file_id;
-};
-
/* kernel_oplock_message definition.
struct kernel_oplock_message {
- SMB_DEV_T dev;
- SMB_INO_T inode;
+ uint64_t dev;
+ uint64_t inode;
+ unit64_t extid;
unsigned long file_id;
};
Offset Data length.
-0 SMB_DEV_T dev 8 bytes.
-8 SMB_INO_T inode 8 bytes
-16 unsigned long file_id 4 bytes
-20
+0 uint64_t dev 8 bytes
+8 uint64_t inode 8 bytes
+16 uint64_t extid 8 bytes
+24 unsigned long file_id 4 bytes
+28
*/
-#define MSG_SMB_KERNEL_BREAK_SIZE 20
+#define MSG_SMB_KERNEL_BREAK_SIZE 28
/* file_renamed_message definition.
struct file_renamed_message {
- SMB_DEV_T dev;
- SMB_INO_T inode;
+ uint64_t dev;
+ uint64_t inode;
char names[1]; A variable area containing sharepath and filename.
};
Offset Data length.
-0 SMB_DEV_T dev 8 bytes.
-8 SMB_INO_T inode 8 bytes
-16 char [] name zero terminated namelen bytes
-minimum length == 18.
+0 uint64_t dev 8 bytes
+8 uint64_t inode 8 bytes
+16 unit64_t extid 8 bytes
+24 char [] name zero terminated namelen bytes
+minimum length == 24.
*/
-#define MSG_FILE_RENAMED_MIN_SIZE 16
+#define MSG_FILE_RENAMED_MIN_SIZE 24
/*
* On the wire return values for oplock types.
diff --git a/source3/include/smb_share_modes.h b/source3/include/smb_share_modes.h
index 101bec8..4a2d832 100644
--- a/source3/include/smb_share_modes.h
+++ b/source3/include/smb_share_modes.h
@@ -46,6 +46,7 @@ struct smbdb_ctx;
struct smb_share_mode_entry {
uint64_t dev;
uint64_t ino;
+ uint64_t extid;
uint32_t share_access;
uint32_t access_mask;
struct timeval open_time;
@@ -66,11 +67,13 @@ int smb_share_mode_db_close(struct smbdb_ctx *db_ctx);
int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
- uint64_t ino);
+ uint64_t ino,
+ uint64_t extid);
int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
- uint64_t ino);
+ uint64_t ino,
+ uint64_t extid);
/*
* Share mode database accessor functions.
@@ -79,23 +82,27 @@ int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
uint64_t dev,
uint64_t ino,
+ uint64_t extid,
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,
+ uint64_t extid,
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,
+ uint64_t extid,
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,
+ uint64_t extid,
const struct smb_share_mode_entry *set_entry,
const struct smb_share_mode_entry *new_entry);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index ffa1a95..0ee7f23 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -383,7 +383,8 @@ struct vfs_ops {
struct notify_event *ev),
void *private_data, void *handle_p);
int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
- struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode);
+ struct file_id (*file_id_create)(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf);
NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 3af6123..7dacd23 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -85,7 +85,7 @@
#define SMB_VFS_REALPATH(conn, path, resolved_path) ((conn)->vfs.ops.realpath((conn)->vfs.handles.realpath, (path), (resolved_path)))
#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
#define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags)))
-#define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_FILE_ID_CREATE(conn, sbuf) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (sbuf)))
#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs.ops.streaminfo((conn)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
#define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) ((conn)->vfs.ops.get_real_filename((conn)->vfs.handles.get_real_filename, (path), (name), (mem_ctx), (found_name)))
#define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock, blr) ((conn)->vfs.ops.brl_lock_windows((conn)->vfs.handles.brl_lock_windows, (br_lck), (plock), (blocking_lock), (blr)))
@@ -217,7 +217,7 @@
#define SMB_VFS_OPAQUE_REALPATH(conn, path, resolved_path) ((conn)->vfs_opaque.ops.realpath((conn)->vfs_opaque.handles.realpath, (path), (resolved_path)))
#define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
#define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags)))
-#define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, sbuf) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (sbuf)))
#define SMB_VFS_OPAQUE_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs_opaque.ops.streaminfo((conn)->vfs_opaque.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
#define SMB_VFS_OPAQUE_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) ((conn)->vfs_opaque.ops.get_real_filename((conn)->vfs_opaque.handles.get_real_filename, (path), (name), (mem_ctx), (found_name)))
#define SMB_VFS_OPAQUE_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock, blr) ((conn)->vfs_opaque.ops.brl_lock_windows((conn)->vfs_opaque.handles.brl_lock_windows, (br_lck), (plock), (blocking_lock), (blr)))
@@ -350,7 +350,7 @@
#define SMB_VFS_NEXT_REALPATH(handle, path, resolved_path) ((handle)->vfs_next.ops.realpath((handle)->vfs_next.handles.realpath, (path), (resolved_path)))
#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
#define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags)))
-#define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode)))
+#define SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (sbuf)))
#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) ((handle)->vfs_next.ops.streaminfo((handle)->vfs_next.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams)))
#define SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, found_name) ((handle)->vfs_next.ops.get_real_filename((handle)->vfs_next.handles.get_real_filename, (path), (name), (mem_ctx), (found_name)))
#define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock, blocking_lock, blr) ((handle)->vfs_next.ops.brl_lock_windows((handle)->vfs_next.handles.brl_lock_windows, (br_lck), (plock), (blocking_lock), (blr)))
diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c
index 0633d4b..0902e3d 100644
--- a/source3/lib/file_id.c
+++ b/source3/lib/file_id.c
@@ -22,26 +22,11 @@
#include "includes.h"
/*
- return a file_id which gives a unique ID for a file given the device and
- inode numbers
- */
-struct file_id file_id_create_dev(SMB_DEV_T dev, SMB_INO_T inode)
-{
- struct file_id key;
- /* the ZERO_STRUCT ensures padding doesn't break using the key as a
- * blob */
- ZERO_STRUCT(key);
- key.devid = dev;
- key.inode = inode;
- return key;
-}
-
-/*
generate a file_id from a stat structure
*/
struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf)
{
- return SMB_VFS_FILE_ID_CREATE(conn, sbuf->st_dev, sbuf->st_ino);
+ return SMB_VFS_FILE_ID_CREATE(conn, sbuf);
}
/*
@@ -49,7 +34,8 @@ struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_S
*/
bool file_id_equal(const struct file_id *id1, const struct file_id *id2)
{
- return id1->inode == id2->inode && id1->devid == id2->devid;
+ return id1->inode == id2->inode && id1->devid == id2->devid &&
+ id1->extid == id2->extid;
}
/*
@@ -57,15 +43,17 @@ bool file_id_equal(const struct file_id *id1, const struct file_id *id2)
*/
const char *file_id_string_tos(const struct file_id *id)
{
- char *result = talloc_asprintf(talloc_tos(), "%llx:%llx",
+ char *result = talloc_asprintf(talloc_tos(), "%llx:%llx:%llx",
(unsigned long long)id->devid,
- (unsigned long long)id->inode);
+ (unsigned long long)id->inode,
+ (unsigned long long)id->extid);
SMB_ASSERT(result != NULL);
return result;
}
/*
- push a 16 byte version of a file id into a buffer
+ push a 16 byte version of a file id into a buffer. This ignores the extid
+ and is needed when dev/inodes are stored in persistent storage (tdbs).
*/
void push_file_id_16(char *buf, const struct file_id *id)
{
@@ -76,13 +64,28 @@ void push_file_id_16(char *buf, const struct file_id *id)
}
/*
- pul a 16 byte version of a file id from a buffer
+ push a 24 byte version of a file id into a buffer
+ */
+void push_file_id_24(char *buf, const struct file_id *id)
+{
+ SIVAL(buf, 0, id->devid&0xFFFFFFFF);
+ SIVAL(buf, 4, id->devid>>32);
+ SIVAL(buf, 8, id->inode&0xFFFFFFFF);
+ SIVAL(buf, 12, id->inode>>32);
+ SIVAL(buf, 16, id->extid&0xFFFFFFFF);
+ SIVAL(buf, 20, id->extid>>32);
+}
+
+/*
+ pull a 24 byte version of a file id from a buffer
*/
-void pull_file_id_16(char *buf, struct file_id *id)
+void pull_file_id_24(char *buf, struct file_id *id)
{
ZERO_STRUCTP(id);
id->devid = IVAL(buf, 0);
id->devid |= ((uint64_t)IVAL(buf,4))<<32;
id->inode = IVAL(buf, 8);
id->inode |= ((uint64_t)IVAL(buf,12))<<32;
+ id->extid = IVAL(buf, 16);
+ id->extid |= ((uint64_t)IVAL(buf,20))<<32;
}
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index af3f7b0..177e011 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -38,7 +38,8 @@ struct smbdb_ctx {
#endif
int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, uint64_t dev,
- uint64_t ino, const struct smb_share_mode_entry *new_entry,
+ uint64_t ino, uint64_t extid,
+ const struct smb_share_mode_entry *new_entry,
const char *sharepath, const char *filename);
static bool sharemodes_procid_equal(const struct server_id *p1, const struct server_id *p2)
@@ -83,6 +84,7 @@ struct smbdb_ctx *smb_share_mode_db_open(const char *db_path)
struct locking_key {
SMB_DEV_T dev;
SMB_INO_T inode;
+ uint64_t extid;
};
int smb_share_mode_db_close(struct smbdb_ctx *db_ctx)
@@ -93,13 +95,14 @@ int smb_share_mode_db_close(struct smbdb_ctx *db_ctx)
}
static TDB_DATA get_locking_key(struct locking_key *lk, uint64_t dev,
- uint64_t ino)
+ uint64_t ino, uint64_t extid)
{
TDB_DATA ld;
memset(lk, '\0', sizeof(*lk));
lk->dev = (SMB_DEV_T)dev;
lk->inode = (SMB_INO_T)ino;
+ lk->extid = extid;
ld.dptr = (uint8 *)lk;
ld.dsize = sizeof(*lk);
return ld;
@@ -111,19 +114,22 @@ static TDB_DATA get_locking_key(struct locking_key *lk, uint64_t dev,
int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
- uint64_t ino)
+ uint64_t ino,
+ uint64_t extid)
{
struct locking_key lk;
- return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino));
+ return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino,
+ extid));
}
int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
uint64_t dev,
- uint64_t ino)
+ uint64_t ino,
+ uint64_t extid)
{
struct locking_key lk;
return tdb_chainunlock(db_ctx->smb_tdb,
- get_locking_key(&lk, dev, ino));
+ get_locking_key(&lk, dev, ino, extid));
}
/*
@@ -140,7 +146,8 @@ static int share_mode_entry_equal(const struct smb_share_mode_entry *e_entry,
e_entry->share_access == (uint32_t)entry->share_access &&
e_entry->access_mask == (uint32_t)entry->access_mask &&
e_entry->dev == entry->id.devid &&
- e_entry->ino == entry->id.inode);
+ e_entry->ino == entry->id.inode &&
+ e_entry->extid == entry->id.extid);
}
/*
@@ -160,6 +167,7 @@ static void create_share_mode_entry(struct share_mode_entry *out,
out->access_mask = in->access_mask;
out->id.devid = in->dev;
out->id.inode = in->ino;
+ out->id.extid = in->extid;
out->uid = (uint32)geteuid();
out->flags = 0;
}
@@ -172,6 +180,7 @@ static void create_share_mode_entry(struct share_mode_entry *out,
int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
uint64_t dev,
uint64_t ino,
+ uint64_t extid,
struct smb_share_mode_entry **pp_list,
unsigned char *p_delete_on_close)
{
@@ -187,7 +196,8 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
*pp_list = NULL;
*p_delete_on_close = 0;
- db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino));
+ db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino,
+ extid));
if (!db_data.dptr) {
return 0;
}
@@ -229,6 +239,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
/* Copy into the external list. */
--
Samba Shared Repository
More information about the samba-cvs
mailing list