mirror of
https://github.com/samba-team/samba.git
synced 2025-09-02 01:49:29 +03:00
s3:vfs: add durable VFS operations
This allows a VFS module to implement durable handles in different ways. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
committed by
Stefan Metzmacher
parent
eb1a05f783
commit
35260ae89e
@ -142,6 +142,7 @@
|
|||||||
/* Leave at 29 - not yet released. move to plain off_t - abartlet */
|
/* Leave at 29 - not yet released. move to plain off_t - abartlet */
|
||||||
/* Leave at 29 - not yet released. Remove sys_acl functions other than set and get - abartlet */
|
/* Leave at 29 - not yet released. Remove sys_acl functions other than set and get - abartlet */
|
||||||
/* Leave at 29 - not yet released. Added backup_intent bool to files_struct - JRA */
|
/* Leave at 29 - not yet released. Added backup_intent bool to files_struct - JRA */
|
||||||
|
/* Leave at 29 - not yet released. Add durable handle functions - metze/obnox */
|
||||||
#define SMB_VFS_INTERFACE_VERSION 29
|
#define SMB_VFS_INTERFACE_VERSION 29
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -712,6 +713,24 @@ struct vfs_fn_pointers {
|
|||||||
SMB_STRUCT_STAT *sbuf);
|
SMB_STRUCT_STAT *sbuf);
|
||||||
int (*set_offline_fn)(struct vfs_handle_struct *handle,
|
int (*set_offline_fn)(struct vfs_handle_struct *handle,
|
||||||
const struct smb_filename *fname);
|
const struct smb_filename *fname);
|
||||||
|
|
||||||
|
/* durable handle operations */
|
||||||
|
NTSTATUS (*durable_cookie_fn)(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *cookie);
|
||||||
|
NTSTATUS (*durable_disconnect_fn)(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *new_cookie);
|
||||||
|
NTSTATUS (*durable_reconnect_fn)(struct vfs_handle_struct *handle,
|
||||||
|
struct smb_request *smb1req,
|
||||||
|
struct smbXsrv_open *op,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
struct files_struct **fsp,
|
||||||
|
DATA_BLOB *new_cookie);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1108,6 +1127,22 @@ bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
|
|||||||
SMB_STRUCT_STAT *sbuf);
|
SMB_STRUCT_STAT *sbuf);
|
||||||
int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
|
int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
|
||||||
const struct smb_filename *fname);
|
const struct smb_filename *fname);
|
||||||
|
NTSTATUS smb_vfs_call_durable_cookie(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *cookie);
|
||||||
|
NTSTATUS smb_vfs_call_durable_disconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *new_cookie);
|
||||||
|
NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct smb_request *smb1req,
|
||||||
|
struct smbXsrv_open *op,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
struct files_struct **fsp,
|
||||||
|
DATA_BLOB *new_cookie);
|
||||||
|
|
||||||
NTSTATUS smb_register_vfs(int version, const char *name,
|
NTSTATUS smb_register_vfs(int version, const char *name,
|
||||||
const struct vfs_fn_pointers *fns);
|
const struct vfs_fn_pointers *fns);
|
||||||
|
@ -509,4 +509,29 @@
|
|||||||
#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
|
#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
|
||||||
smb_vfs_call_set_offline((handle)->next, (fname))
|
smb_vfs_call_set_offline((handle)->next, (fname))
|
||||||
|
|
||||||
|
/* durable handle operations */
|
||||||
|
|
||||||
|
#define SMB_VFS_DURABLE_COOKIE(fsp, mem_ctx, cookie) \
|
||||||
|
smb_vfs_call_durable_cookie((fsp)->conn->vfs_handles, \
|
||||||
|
(fsp), (mem_ctx), (cookie))
|
||||||
|
#define SMB_VFS_NEXT_DURABLE_COOKIE(handle, fsp, mem_ctx, cookie) \
|
||||||
|
smb_vfs_call_durable_cookie(((handle)->next, \
|
||||||
|
(fsp), (mem_ctx), (cookie))
|
||||||
|
|
||||||
|
#define SMB_VFS_DURABLE_DISCONNECT(fsp, old_cookie, mem_ctx, new_cookie) \
|
||||||
|
smb_vfs_call_durable_disconnect((fsp)->conn->vfs_handles, \
|
||||||
|
(fsp), (old_cookie), (mem_ctx), (new_cookie))
|
||||||
|
#define SMB_VFS_NEXT_DURABLE_DISCONNECT(handle, fsp, old_cookie, mem_ctx, new_cookie) \
|
||||||
|
smb_vfs_call_durable_disconnect((handle)->next, \
|
||||||
|
(fsp), (old_cookie), (mem_ctx), (new_cookie))
|
||||||
|
|
||||||
|
#define SMB_VFS_DURABLE_RECONNECT(conn, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
|
||||||
|
smb_vfs_call_durable_reconnect((conn)->vfs_handles, \
|
||||||
|
(smb1req), (op), (old_cookie), \
|
||||||
|
(mem_ctx), (fsp), (new_cookie))
|
||||||
|
#define SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
|
||||||
|
smb_vfs_call_durable_reconnect((handle)->next, \
|
||||||
|
(smb1req), (op), (old_cookie), \
|
||||||
|
(mem_ctx), (fsp), (new_cookie))
|
||||||
|
|
||||||
#endif /* _VFS_MACROS_H */
|
#endif /* _VFS_MACROS_H */
|
||||||
|
@ -2227,6 +2227,34 @@ static int vfswrap_set_offline(struct vfs_handle_struct *handle,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS vfswrap_durable_cookie(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *cookie)
|
||||||
|
{
|
||||||
|
return NT_STATUS_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NTSTATUS vfswrap_durable_disconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *new_cookie)
|
||||||
|
{
|
||||||
|
return NT_STATUS_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NTSTATUS vfswrap_durable_reconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct smb_request *smb1req,
|
||||||
|
struct smbXsrv_open *op,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
struct files_struct **fsp,
|
||||||
|
DATA_BLOB *new_cookie)
|
||||||
|
{
|
||||||
|
return NT_STATUS_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
static struct vfs_fn_pointers vfs_default_fns = {
|
static struct vfs_fn_pointers vfs_default_fns = {
|
||||||
/* Disk operations */
|
/* Disk operations */
|
||||||
|
|
||||||
@ -2344,7 +2372,12 @@ static struct vfs_fn_pointers vfs_default_fns = {
|
|||||||
|
|
||||||
/* offline operations */
|
/* offline operations */
|
||||||
.is_offline_fn = vfswrap_is_offline,
|
.is_offline_fn = vfswrap_is_offline,
|
||||||
.set_offline_fn = vfswrap_set_offline
|
.set_offline_fn = vfswrap_set_offline,
|
||||||
|
|
||||||
|
/* durable handle operations */
|
||||||
|
.durable_cookie_fn = vfswrap_durable_cookie,
|
||||||
|
.durable_disconnect_fn = vfswrap_durable_disconnect,
|
||||||
|
.durable_reconnect_fn = vfswrap_durable_reconnect,
|
||||||
};
|
};
|
||||||
|
|
||||||
NTSTATUS vfs_default_init(void);
|
NTSTATUS vfs_default_init(void);
|
||||||
|
@ -2330,3 +2330,37 @@ int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
|
|||||||
VFS_FIND(set_offline);
|
VFS_FIND(set_offline);
|
||||||
return handle->fns->set_offline_fn(handle, fname);
|
return handle->fns->set_offline_fn(handle, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS smb_vfs_call_durable_cookie(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *cookie)
|
||||||
|
{
|
||||||
|
VFS_FIND(durable_cookie);
|
||||||
|
return handle->fns->durable_cookie_fn(handle, fsp, mem_ctx, cookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS smb_vfs_call_durable_disconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct files_struct *fsp,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
DATA_BLOB *new_cookie)
|
||||||
|
{
|
||||||
|
VFS_FIND(durable_disconnect);
|
||||||
|
return handle->fns->durable_disconnect_fn(handle, fsp, old_cookie,
|
||||||
|
mem_ctx, new_cookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
|
||||||
|
struct smb_request *smb1req,
|
||||||
|
struct smbXsrv_open *op,
|
||||||
|
const DATA_BLOB old_cookie,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
|
struct files_struct **fsp,
|
||||||
|
DATA_BLOB *new_cookie)
|
||||||
|
{
|
||||||
|
VFS_FIND(durable_reconnect);
|
||||||
|
return handle->fns->durable_reconnect_fn(handle, smb1req, op,
|
||||||
|
old_cookie, mem_ctx, fsp,
|
||||||
|
new_cookie);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user