summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_default.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2008-01-24 14:06:22 +0300
committerAlexander Bokovoy <ab@samba.org>2008-01-24 14:06:22 +0300
commiteba5fbff749b84a3e1bcd1f849c3454417532454 (patch)
tree42b9da9b96fb26706f4c8486cd01821f83e318f3 /source3/modules/vfs_default.c
parentc17c64530ec479334f88679ef780691e06ccd65a (diff)
parent9344628bef74ac759197601dc5dd44514b836e3e (diff)
downloadsamba-eba5fbff749b84a3e1bcd1f849c3454417532454.tar.gz
samba-eba5fbff749b84a3e1bcd1f849c3454417532454.tar.bz2
samba-eba5fbff749b84a3e1bcd1f849c3454417532454.zip
Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into ctdb-merge
(This used to be commit 42d06d41bf2e9fb094f6064dc04f549d880b5f8d)
Diffstat (limited to 'source3/modules/vfs_default.c')
-rw-r--r--source3/modules/vfs_default.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 31234f23ec..cf135dfd03 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -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 vfs_statvfs_struct statbuf;
+ ZERO_STRUCT(statbuf);
+ sys_statvfs(handle->conn->connectpath, &statbuf);
+ return statbuf.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)
@@ -942,6 +953,62 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, S
return file_id_create_dev(dev, inode);
}
+static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ const char *fname,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *pnum_streams,
+ struct stream_struct **pstreams)
+{
+ SMB_STRUCT_STAT sbuf;
+ unsigned int num_streams = 0;
+ struct stream_struct *streams = NULL;
+ int ret;
+
+ if ((fsp != NULL) && (fsp->is_directory)) {
+ /*
+ * No default streams on directories
+ */
+ goto done;
+ }
+
+ if ((fsp != NULL) && (fsp->fh->fd != -1)) {
+ ret = SMB_VFS_FSTAT(fsp, &sbuf);
+ }
+ else {
+ ret = SMB_VFS_STAT(handle->conn, fname, &sbuf);
+ }
+
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ if (S_ISDIR(sbuf.st_mode)) {
+ goto done;
+ }
+
+ streams = talloc(mem_ctx, struct stream_struct);
+
+ if (streams == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ streams->size = sbuf.st_size;
+ streams->alloc_size = get_allocation_size(handle->conn, fsp, &sbuf);
+
+ streams->name = talloc_strdup(streams, "::$DATA");
+ if (streams->name == NULL) {
+ TALLOC_FREE(streams);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ num_streams = 1;
+ done:
+ *pnum_streams = num_streams;
+ *pstreams = streams;
+ return NT_STATUS_OK;
+}
+
static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32 security_info, SEC_DESC **ppdesc)
@@ -1273,6 +1340,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 */
@@ -1367,6 +1436,8 @@ static vfs_op_tuple vfs_default_ops[] = {
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_file_id_create), SMB_VFS_OP_FILE_ID_CREATE,
SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(vfswrap_streaminfo), SMB_VFS_OP_STREAMINFO,
+ SMB_VFS_LAYER_OPAQUE},
/* NT ACL operations. */