summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-02-15 23:38:53 -0800
committerTim Prouty <tprouty@samba.org>2009-02-19 20:58:01 -0800
commit6fbebb5369211b72545a1dd588bc6b9fa04210a1 (patch)
treeb095dd3cc88369ec8f1e6e3af6b033990998b17f /source3
parent669f2a02e29195aaba8cb2f3e50cb2ce66b904a6 (diff)
downloadsamba-6fbebb5369211b72545a1dd588bc6b9fa04210a1.tar.gz
samba-6fbebb5369211b72545a1dd588bc6b9fa04210a1.tar.bz2
samba-6fbebb5369211b72545a1dd588bc6b9fa04210a1.zip
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.
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/include/vfs.h3
-rw-r--r--source3/include/vfs_macros.h6
-rw-r--r--source3/lib/file_id.c17
-rw-r--r--source3/modules/vfs_default.c14
-rw-r--r--source3/modules/vfs_fileid.c6
-rw-r--r--source3/modules/vfs_full_audit.c6
-rw-r--r--source3/modules/vfs_streams_depot.c3
-rw-r--r--source3/modules/vfs_xattr_tdb.c20
-rw-r--r--source3/smbd/oplock_irix.c18
10 files changed, 53 insertions, 41 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3806c9657e..bd44e9fdf4 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -508,7 +508,6 @@ 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);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index ffa1a95ed0..0ee7f236b0 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 3af612375b..7dacd2319a 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 0633d4b88d..355aafa344 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);
}
/*
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index f52ca09c08..c18ec268d3 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1042,9 +1042,19 @@ static int vfswrap_chflags(vfs_handle_struct *handle, const char *path, int flag
#endif
}
-static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode)
+static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle,
+ SMB_STRUCT_STAT *sbuf)
{
- return file_id_create_dev(dev, inode);
+ struct file_id key;
+
+ /* the ZERO_STRUCT ensures padding doesn't break using the key as a
+ * blob */
+ ZERO_STRUCT(key);
+
+ key.devid = sbuf->st_dev;
+ key.inode = sbuf->st_ino;
+
+ return key;
}
static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index 787a49f36b..8152c5477e 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -226,7 +226,7 @@ static void fileid_disconnect(struct vfs_handle_struct *handle)
}
static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
- SMB_DEV_T dev, SMB_INO_T inode)
+ const SMB_STRUCT_STAT *sbuf)
{
struct fileid_handle_data *data;
struct file_id id;
@@ -237,8 +237,8 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
struct fileid_handle_data,
return id);
- id.devid = data->device_mapping_fn(data, dev);
- id.inode = inode;
+ id.devid = data->device_mapping_fn(data, sbuf->st_dev);
+ id.inode = sbuf->st_ino;
return id;
}
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 15eafc1b56..3c159f10eb 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -209,7 +209,7 @@ static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
static int smb_full_audit_chflags(vfs_handle_struct *handle,
const char *path, unsigned int flags);
static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
- SMB_DEV_T dev, SMB_INO_T inode);
+ const SMB_STRUCT_STAT *sbuf);
static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
const char *fname,
@@ -1664,14 +1664,14 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
}
static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
- SMB_DEV_T dev, SMB_INO_T inode)
+ const SMB_STRUCT_STAT *sbuf)
{
struct file_id id_zero;
struct file_id result;
ZERO_STRUCT(id_zero);
- result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode);
+ result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
do_log(SMB_VFS_OP_FILE_ID_CREATE,
!file_id_equal(&id_zero, &result),
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 1c2c0e5f77..9329be7a9c 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -153,8 +153,7 @@ static char *stream_dir(vfs_handle_struct *handle, const char *base_path,
base_sbuf = &sbuf;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, base_sbuf->st_dev,
- base_sbuf->st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, base_sbuf);
push_file_id_16((char *)id_buf, &id);
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 44bfffb94e..908a2a3872 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -216,7 +216,7 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_getattr(db, &id, name, value, size);
}
@@ -235,7 +235,7 @@ static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_getattr(db, &id, name, value, size);
}
@@ -338,7 +338,7 @@ static int xattr_tdb_setxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_setattr(db, &id, name, value, size, flags);
}
@@ -358,7 +358,7 @@ static int xattr_tdb_fsetxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_setattr(db, &id, name, value, size, flags);
}
@@ -443,7 +443,7 @@ static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_listattr(db, &id, list, size);
}
@@ -462,7 +462,7 @@ static ssize_t xattr_tdb_flistxattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_listattr(db, &id, list, size);
}
@@ -543,7 +543,7 @@ static int xattr_tdb_removexattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_removeattr(db, &id, name);
}
@@ -561,7 +561,7 @@ static int xattr_tdb_fremovexattr(struct vfs_handle_struct *handle,
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
return xattr_tdb_removeattr(db, &id, name);
}
@@ -628,7 +628,7 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle, const char *path)
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
@@ -667,7 +667,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
return -1;
}
- id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
+ id = SMB_VFS_FILE_ID_CREATE(handle->conn, &sbuf);
rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c
index bbc9132a08..89b8e0f7b5 100644
--- a/source3/smbd/oplock_irix.c
+++ b/source3/smbd/oplock_irix.c
@@ -103,6 +103,24 @@ static bool irix_oplocks_available(void)
return True;
}
+/*
+ * This is bad because the file_id should always be created through the vfs
+ * layer! Unfortunately, a conn struct isn't available here.
+ */
+static 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;
+}
+
/****************************************************************************
* Deal with the IRIX kernel <--> smbd
* oplock break protocol.