mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Add SMB_VFS_FS_CAPABILITIES
It turns out that this is a necessary operation, separate from statvfs. statvfs
can fail during tcon, so conn->fs_capabilities would never see that we support
streams on a particular share.
James, can you check that I got the darwin variant right? Thanks!
(This used to be commit 3ad798d803
)
This commit is contained in:
parent
d221d53f3a
commit
9a22653222
@ -149,6 +149,7 @@ typedef enum _vfs_op_type {
|
||||
SMB_VFS_OP_SET_QUOTA,
|
||||
SMB_VFS_OP_GET_SHADOW_COPY_DATA,
|
||||
SMB_VFS_OP_STATVFS,
|
||||
SMB_VFS_OP_FS_CAPABILITIES,
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
@ -284,6 +285,7 @@ struct vfs_ops {
|
||||
int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
|
||||
int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels);
|
||||
int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
|
||||
uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle);
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
@ -435,6 +437,7 @@ struct vfs_ops {
|
||||
struct vfs_handle_struct *set_quota;
|
||||
struct vfs_handle_struct *get_shadow_copy_data;
|
||||
struct vfs_handle_struct *statvfs;
|
||||
struct vfs_handle_struct *fs_capabilities;
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (qtype), (id), (qt)))
|
||||
#define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
|
||||
#define SMB_VFS_STATVFS(conn, path, statbuf) ((conn)->vfs.ops.statvfs((conn)->vfs.handles.statvfs, (path), (statbuf)))
|
||||
#define SMB_VFS_FS_CAPABILITIES(conn) ((conn)->vfs.ops.fs_capabilities((conn)->vfs.handles.fs_capabilities))
|
||||
|
||||
/* Directory operations */
|
||||
#define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (fname), (mask), (attr)))
|
||||
@ -159,6 +160,7 @@
|
||||
#define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (qtype), (id), (qt)))
|
||||
#define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
|
||||
#define SMB_VFS_OPAQUE_STATVFS(conn, path, statbuf) ((conn)->vfs_opaque.ops.statvfs((conn)->vfs_opaque.handles.statvfs, (path), (statbuf)))
|
||||
#define SMB_VFS_OPAQUE_FS_CAPABILITIES(conn) ((conn)->vfs_opaque.ops.fs_capabilities((conn)->vfs_opaque.handles.fs_capabilities))
|
||||
|
||||
/* Directory operations */
|
||||
#define SMB_VFS_OPAQUE_OPENDIR(conn, fname, mask, attr) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (fname), (mask), (attr)))
|
||||
@ -284,6 +286,7 @@
|
||||
#define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (qtype), (id), (qt)))
|
||||
#define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
|
||||
#define SMB_VFS_NEXT_STATVFS(handle, path, statbuf) ((handle)->vfs_next.ops.statvfs((handle)->vfs_next.handles.statvfs, (path), (statbuf)))
|
||||
#define SMB_VFS_NEXT_FS_CAPABILITIES(handle) ((handle)->vfs_next.ops.fs_capabilities((handle)->vfs_next.handles.fs_capabilities))
|
||||
|
||||
/* Directory operations */
|
||||
#define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (fname), (mask), (attr)))
|
||||
|
@ -90,6 +90,17 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle, const char *path,
|
||||
return sys_statvfs(path, statbuf);
|
||||
}
|
||||
|
||||
static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle)
|
||||
{
|
||||
#if defined(DARWINOS)
|
||||
struct statfs sbuf;
|
||||
ZERO_STRUCT(sbuf);
|
||||
sys_statvfs(handle->conn->connectpath, &sbuf);
|
||||
return sbuf.FsCapabilities;
|
||||
#endif
|
||||
return FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
|
||||
}
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
|
||||
@ -1330,6 +1341,8 @@ static vfs_op_tuple vfs_default_ops[] = {
|
||||
SMB_VFS_LAYER_OPAQUE},
|
||||
{SMB_VFS_OP(vfswrap_statvfs), SMB_VFS_OP_STATVFS,
|
||||
SMB_VFS_LAYER_OPAQUE},
|
||||
{SMB_VFS_OP(vfswrap_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
|
||||
SMB_VFS_LAYER_OPAQUE},
|
||||
|
||||
/* Directory operations */
|
||||
|
||||
|
@ -610,22 +610,15 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static int streams_depot_statvfs(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
struct vfs_statvfs_struct *statbuf)
|
||||
static uint32_t streams_depot_fs_capabilities(struct vfs_handle_struct *handle)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
|
||||
statbuf->FsCapabilities |= FILE_NAMED_STREAMS;
|
||||
return ret;
|
||||
|
||||
return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS;
|
||||
}
|
||||
|
||||
/* VFS operations structure */
|
||||
|
||||
static vfs_op_tuple streams_depot_ops[] = {
|
||||
{SMB_VFS_OP(streams_depot_statvfs), SMB_VFS_OP_STATVFS,
|
||||
{SMB_VFS_OP(streams_depot_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
|
||||
SMB_VFS_LAYER_TRANSPARENT},
|
||||
{SMB_VFS_OP(streams_depot_open), SMB_VFS_OP_OPEN,
|
||||
SMB_VFS_LAYER_TRANSPARENT},
|
||||
|
@ -560,16 +560,9 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static int streams_xattr_statvfs(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
struct vfs_statvfs_struct *statbuf)
|
||||
static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
|
||||
statbuf->FsCapabilities |= FILE_NAMED_STREAMS;
|
||||
return ret;
|
||||
|
||||
return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS;
|
||||
}
|
||||
|
||||
static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
|
||||
@ -663,7 +656,7 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle,
|
||||
/* VFS operations structure */
|
||||
|
||||
static vfs_op_tuple streams_xattr_ops[] = {
|
||||
{SMB_VFS_OP(streams_xattr_statvfs), SMB_VFS_OP_STATVFS,
|
||||
{SMB_VFS_OP(streams_xattr_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
|
||||
SMB_VFS_LAYER_TRANSPARENT},
|
||||
{SMB_VFS_OP(streams_xattr_open), SMB_VFS_OP_OPEN,
|
||||
SMB_VFS_LAYER_TRANSPARENT},
|
||||
|
@ -1171,16 +1171,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
|
||||
* assumes that all the filesystem mounted withing a share path have
|
||||
* the same characteristics, which is likely but not guaranteed.
|
||||
*/
|
||||
{
|
||||
vfs_statvfs_struct svfs;
|
||||
|
||||
conn->fs_capabilities =
|
||||
FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
|
||||
|
||||
if (SMB_VFS_STATVFS(conn, conn->connectpath, &svfs) == 0) {
|
||||
conn->fs_capabilities = svfs.FsCapabilities;
|
||||
}
|
||||
}
|
||||
conn->fs_capabilities = SMB_VFS_FS_CAPABILITIES(conn);
|
||||
|
||||
/*
|
||||
* Print out the 'connected as' stuff here as we need
|
||||
|
Loading…
Reference in New Issue
Block a user