#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
-#define XATTR_DOSSTREAM_PREFIX "user.DosStream."
-
struct stream_io {
char *base;
char *xattr_name;
SMB_STRUCT_STAT *sbuf)
{
NTSTATUS status;
- char *base, *sname;
+ char *base = NULL, *sname = NULL;
int result = -1;
char *xattr_name;
status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
if (!NT_STATUS_IS_OK(status)) {
errno = EINVAL;
- goto fail;
+ return -1;
}
if (SMB_VFS_STAT(handle->conn, base, sbuf) == -1) {
}
xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
- XATTR_DOSSTREAM_PREFIX, sname);
+ SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
if (xattr_name == NULL) {
errno = ENOMEM;
goto fail;
}
xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
- XATTR_DOSSTREAM_PREFIX, sname);
+ SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
if (xattr_name == NULL) {
errno = ENOMEM;
goto fail;
}
xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
- XATTR_DOSSTREAM_PREFIX, sname);
+ SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
if (xattr_name == NULL) {
errno = ENOMEM;
goto fail;
goto fail;
}
- status = get_ea_value(talloc_tos(), handle->conn, fsp, base,
+ status = get_ea_value(talloc_tos(), handle->conn, NULL, base,
xattr_name, &ea);
DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
* BUGBUGBUG -- we would need to call fd_close_posix here, but
* we don't have a full fsp yet
*/
- SMB_VFS_CLOSE(fsp, hostfd);
+ SMB_VFS_CLOSE(fsp);
}
TALLOC_FREE(frame);
}
xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
- XATTR_DOSSTREAM_PREFIX, sname);
+ SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
if (xattr_name == NULL) {
errno = ENOMEM;
goto fail;
NTSTATUS status;
char **names;
size_t i, num_names;
- size_t prefix_len = strlen(XATTR_DOSSTREAM_PREFIX);
+ size_t prefix_len = strlen(SAMBA_XATTR_DOSSTREAM_PREFIX);
status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname,
&names, &num_names);
for (i=0; i<num_names; i++) {
struct ea_struct ea;
- if (strncmp(names[i], XATTR_DOSSTREAM_PREFIX,
+ if (strncmp(names[i], SAMBA_XATTR_DOSSTREAM_PREFIX,
prefix_len) != 0) {
continue;
}
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,
memcpy(ea.value.data + offset, data, n);
- ret = SMB_VFS_FSETXATTR(fsp->base_fsp, sio->xattr_name,
+ ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
+ sio->xattr_name,
ea.value.data, ea.value.length, 0);
TALLOC_FREE(ea.value.data);
+ if (ret == -1) {
+ return -1;
+ }
+
return n;
}
/* 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},