1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s3: Pass smb_filename through the set_offline vfs op

This commit is contained in:
Volker Lendecke 2011-02-25 06:43:52 -07:00 committed by Volker Lendecke
parent c9d1e16c2c
commit cf7dac6fbc
8 changed files with 36 additions and 12 deletions

View File

@ -404,7 +404,8 @@ struct vfs_fn_pointers {
bool (*is_offline)(struct vfs_handle_struct *handle,
const struct smb_filename *fname,
SMB_STRUCT_STAT *sbuf);
int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
int (*set_offline)(struct vfs_handle_struct *handle,
const struct smb_filename *fname);
};
/*
@ -820,6 +821,6 @@ bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
const struct smb_filename *fname,
SMB_STRUCT_STAT *sbuf);
int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
const char *path);
const struct smb_filename *fname);
#endif /* _VFS_H */

View File

@ -607,9 +607,9 @@
#define SMB_VFS_NEXT_IS_OFFLINE(handle,fname,sbuf) \
smb_vfs_call_is_offline((handle)->next,(fname),(sbuf))
#define SMB_VFS_SET_OFFLINE(conn,path) \
smb_vfs_call_set_offline((conn)->vfs_handles,(path))
#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) \
smb_vfs_call_set_offline((handle)->next, (path))
#define SMB_VFS_SET_OFFLINE(conn,fname) \
smb_vfs_call_set_offline((conn)->vfs_handles,(fname))
#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
smb_vfs_call_set_offline((handle)->next, (fname))
#endif /* _VFS_MACROS_H */

View File

@ -1634,7 +1634,8 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
}
static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path)
static int vfswrap_set_offline(struct vfs_handle_struct *handle,
const struct smb_filename *fname)
{
/* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
#if defined(ENOTSUP)

View File

@ -2215,6 +2215,17 @@ static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
return result;
}
static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
const struct smb_filename *fname)
{
int result;
result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
smb_fname_str_do_log(fname));
return result;
}
static struct vfs_fn_pointers vfs_full_audit_fns = {
/* Disk operations */
@ -2333,6 +2344,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
.aio_suspend = smb_full_audit_aio_suspend,
.aio_force = smb_full_audit_aio_force,
.is_offline = smb_full_audit_is_offline,
.set_offline = smb_full_audit_set_offline,
};
NTSTATUS vfs_full_audit_init(void)

View File

@ -645,8 +645,9 @@ onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle,
static int
onefs_shadow_copy_set_offline(struct vfs_handle_struct *handle,
const char *path)
const struct smb_filename *fname)
{
#error Isilon, please convert "char *path" to "struct smb_fname *fname"
SHADOW_NEXT(SET_OFFLINE,
(handle, cpath ?: path),
int);

View File

@ -349,10 +349,13 @@ static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struc
}
static int tsmsm_set_offline(struct vfs_handle_struct *handle,
const char *path) {
const struct smb_filename *fname)
{
struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
int result = 0;
char *command;
NTSTATUS status;
char *path;
if (tsmd->hsmscript == NULL) {
/* no script enabled */
@ -360,6 +363,12 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle,
return 0;
}
status = get_full_smb_filename(talloc_tos(), fname, &path);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return false;
}
/* Now, call the script */
command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, path);
if(!command) {

View File

@ -719,7 +719,7 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
if (dosmode & FILE_ATTRIBUTE_OFFLINE) {
if (!(old_mode & FILE_ATTRIBUTE_OFFLINE)) {
lret = SMB_VFS_SET_OFFLINE(conn, smb_fname->base_name);
lret = SMB_VFS_SET_OFFLINE(conn, smb_fname);
if (lret == -1) {
DEBUG(0, ("set_dos_mode: client has asked to "
"set FILE_ATTRIBUTE_OFFLINE to "

View File

@ -2014,8 +2014,8 @@ bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
}
int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
const char *path)
const struct smb_filename *fname)
{
VFS_FIND(set_offline);
return handle->fns->set_offline(handle, path);
return handle->fns->set_offline(handle, fname);
}