mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3: VFS: Add SMB_VFS_MKNODAT().
Currently identical to SMB_VFS_MKNOD(). Next, add to all VFS modules that implement mknod and eventually remove mknod. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
This commit is contained in:
parent
e4c4af64fa
commit
e2246876d1
@ -493,6 +493,16 @@ static int skel_mknod(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int skel_mknodat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname)
|
||||
@ -1091,6 +1101,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
|
||||
.readlink_fn = skel_vfs_readlink,
|
||||
.linkat_fn = skel_linkat,
|
||||
.mknod_fn = skel_mknod,
|
||||
.mknodat_fn = skel_mknodat,
|
||||
.realpath_fn = skel_realpath,
|
||||
.chflags_fn = skel_chflags,
|
||||
.file_id_create_fn = skel_file_id_create,
|
||||
|
@ -594,6 +594,19 @@ static int skel_mknod(vfs_handle_struct *handle,
|
||||
return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
|
||||
}
|
||||
|
||||
static int skel_mknodat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev)
|
||||
{
|
||||
return SMB_VFS_NEXT_MKNODAT(handle,
|
||||
dirfsp,
|
||||
smb_fname,
|
||||
mode,
|
||||
dev);
|
||||
}
|
||||
|
||||
static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname)
|
||||
@ -1362,6 +1375,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
|
||||
.readlink_fn = skel_vfs_readlink,
|
||||
.linkat_fn = skel_linkat,
|
||||
.mknod_fn = skel_mknod,
|
||||
.mknodat_fn = skel_mknodat,
|
||||
.realpath_fn = skel_realpath,
|
||||
.chflags_fn = skel_chflags,
|
||||
.file_id_create_fn = skel_file_id_create,
|
||||
|
@ -86,6 +86,7 @@ struct tevent_context;
|
||||
SMBPROFILE_STATS_BASIC(syscall_symlink) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_linkat) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_mknod) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_mknodat) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_realpath) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_get_quota) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_set_quota) \
|
||||
|
@ -274,6 +274,7 @@
|
||||
/* Version 42 - Make "lease" a const* in create_file_fn */
|
||||
/* Version 42 - Move SMB_VFS_RENAME -> SMB_VFS_RENAMEAT */
|
||||
/* Version 42 - Move SMB_VFS_LINK -> SMB_VFS_LINKAT. */
|
||||
/* Version 42 - Add SMB_VFS_MKDNODAT. */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 42
|
||||
|
||||
@ -810,6 +811,11 @@ struct vfs_fn_pointers {
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
int (*mknodat_fn)(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
struct smb_filename *(*realpath_fn)(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname);
|
||||
@ -1342,6 +1348,11 @@ int smb_vfs_call_mknod(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
int smb_vfs_call_mknodat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
struct smb_filename *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname);
|
||||
@ -1771,6 +1782,11 @@ int vfs_not_implemented_mknod(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev);
|
||||
struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname);
|
||||
|
@ -316,6 +316,11 @@
|
||||
#define SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev) \
|
||||
smb_vfs_call_mknod((handle)->next, (smb_fname), (mode), (dev))
|
||||
|
||||
#define SMB_VFS_MKNODAT(conn, dirfsp, smb_fname, mode, dev) \
|
||||
smb_vfs_call_mknodat((conn)->vfs_handles, (dirfsp), (smb_fname), (mode), (dev))
|
||||
#define SMB_VFS_NEXT_MKNODAT(handle, dirfsp, smb_fname, mode, dev) \
|
||||
smb_vfs_call_mknodat((handle)->next, (dirfsp), (smb_fname), (mode), (dev))
|
||||
|
||||
#define SMB_VFS_REALPATH(conn, ctx, smb_fname) \
|
||||
smb_vfs_call_realpath((conn)->vfs_handles, (ctx), (smb_fname))
|
||||
#define SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname) \
|
||||
|
@ -2700,6 +2700,27 @@ static int vfswrap_mknod(vfs_handle_struct *handle,
|
||||
return result;
|
||||
}
|
||||
|
||||
static int vfswrap_mknodat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev)
|
||||
{
|
||||
int result;
|
||||
|
||||
START_PROFILE(syscall_mknodat);
|
||||
|
||||
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
|
||||
|
||||
result = sys_mknodat(dirfsp->fh->fd,
|
||||
smb_fname->base_name,
|
||||
mode,
|
||||
dev);
|
||||
|
||||
END_PROFILE(syscall_mknodat);
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct smb_filename *vfswrap_realpath(vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname)
|
||||
@ -3481,6 +3502,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
|
||||
.readlink_fn = vfswrap_readlink,
|
||||
.linkat_fn = vfswrap_linkat,
|
||||
.mknod_fn = vfswrap_mknod,
|
||||
.mknodat_fn = vfswrap_mknodat,
|
||||
.realpath_fn = vfswrap_realpath,
|
||||
.chflags_fn = vfswrap_chflags,
|
||||
.file_id_create_fn = vfswrap_file_id_create,
|
||||
|
@ -491,6 +491,16 @@ int vfs_not_implemented_mknod(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vfs_not_implemented_mknodat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct smb_filename *vfs_not_implemented_realpath(vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname)
|
||||
@ -1095,6 +1105,7 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
|
||||
.readlink_fn = vfs_not_implemented_vfs_readlink,
|
||||
.linkat_fn = vfs_not_implemented_linkat,
|
||||
.mknod_fn = vfs_not_implemented_mknod,
|
||||
.mknodat_fn = vfs_not_implemented_mknodat,
|
||||
.realpath_fn = vfs_not_implemented_realpath,
|
||||
.chflags_fn = vfs_not_implemented_chflags,
|
||||
.file_id_create_fn = vfs_not_implemented_file_id_create,
|
||||
|
@ -2235,6 +2235,20 @@ int smb_vfs_call_mknod(struct vfs_handle_struct *handle,
|
||||
return handle->fns->mknod_fn(handle, smb_fname, mode, dev);
|
||||
}
|
||||
|
||||
int smb_vfs_call_mknodat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
mode_t mode,
|
||||
SMB_DEV_T dev)
|
||||
{
|
||||
VFS_FIND(mknodat);
|
||||
return handle->fns->mknodat_fn(handle,
|
||||
dirfsp,
|
||||
smb_fname,
|
||||
mode,
|
||||
dev);
|
||||
}
|
||||
|
||||
struct smb_filename *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
|
||||
TALLOC_CTX *ctx,
|
||||
const struct smb_filename *smb_fname)
|
||||
|
Loading…
x
Reference in New Issue
Block a user