mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3: VFS: Add SMB_VFS_READLINKAT().
Currently identical to SMB_VFS_READLINK(). Next, add to all VFS modules that implement readlink and eventually remove readlink. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
This commit is contained in:
parent
d8863dd8cb
commit
515c062b9e
@ -473,6 +473,16 @@ static int skel_vfs_readlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int skel_vfs_readlinkat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int skel_linkat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -1090,6 +1100,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
|
||||
.getlock_fn = skel_getlock,
|
||||
.symlink_fn = skel_symlink,
|
||||
.readlink_fn = skel_vfs_readlink,
|
||||
.readlinkat_fn = skel_vfs_readlinkat,
|
||||
.linkat_fn = skel_linkat,
|
||||
.mknodat_fn = skel_mknodat,
|
||||
.realpath_fn = skel_realpath,
|
||||
|
@ -571,6 +571,19 @@ static int skel_vfs_readlink(vfs_handle_struct *handle,
|
||||
return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
|
||||
}
|
||||
|
||||
static int skel_vfs_readlinkat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz)
|
||||
{
|
||||
return SMB_VFS_NEXT_READLINKAT(handle,
|
||||
dirfsp,
|
||||
smb_fname,
|
||||
buf,
|
||||
bufsiz);
|
||||
}
|
||||
|
||||
static int skel_linkat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -1365,6 +1378,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
|
||||
.getlock_fn = skel_getlock,
|
||||
.symlink_fn = skel_symlink,
|
||||
.readlink_fn = skel_vfs_readlink,
|
||||
.readlinkat_fn = skel_vfs_readlinkat,
|
||||
.linkat_fn = skel_linkat,
|
||||
.mknodat_fn = skel_mknodat,
|
||||
.realpath_fn = skel_realpath,
|
||||
|
@ -83,6 +83,7 @@ struct tevent_context;
|
||||
SMBPROFILE_STATS_BASIC(syscall_linux_setlease) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_fcntl_getlock) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_readlink) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_readlinkat) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_symlink) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_linkat) \
|
||||
SMBPROFILE_STATS_BASIC(syscall_mknodat) \
|
||||
|
@ -275,6 +275,7 @@
|
||||
/* Version 42 - Move SMB_VFS_RENAME -> SMB_VFS_RENAMEAT */
|
||||
/* Version 42 - Move SMB_VFS_LINK -> SMB_VFS_LINKAT. */
|
||||
/* Version 42 - Move SMB_VFS_MKNOD -> SMB_VFS_MKDNODAT. */
|
||||
/* Version 42 - Add SMB_VFS_READLINKAT. */
|
||||
|
||||
#define SMB_VFS_INTERFACE_VERSION 42
|
||||
|
||||
@ -801,6 +802,11 @@ struct vfs_fn_pointers {
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int (*readlinkat_fn)(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int (*linkat_fn)(struct vfs_handle_struct *handle,
|
||||
struct files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -1334,6 +1340,11 @@ int smb_vfs_call_readlink(struct vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int smb_vfs_call_readlinkat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int smb_vfs_call_linkat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -1764,6 +1775,11 @@ int vfs_not_implemented_vfs_readlink(vfs_handle_struct *handle,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz);
|
||||
int vfs_not_implemented_linkat(vfs_handle_struct *handle,
|
||||
struct files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
|
@ -306,6 +306,11 @@
|
||||
#define SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz) \
|
||||
smb_vfs_call_readlink((handle)->next, (smb_fname), (buf), (bufsiz))
|
||||
|
||||
#define SMB_VFS_READLINKAT(conn, dirfsp, smb_fname, buf, bufsiz) \
|
||||
smb_vfs_call_readlinkat((conn)->vfs_handles, (dirfsp), (smb_fname), (buf), (bufsiz))
|
||||
#define SMB_VFS_NEXT_READLINKAT(handle, dirfsp, smb_fname, buf, bufsiz) \
|
||||
smb_vfs_call_readlinkat((handle)->next, (dirfsp), (smb_fname), (buf), (bufsiz))
|
||||
|
||||
#define SMB_VFS_LINKAT(conn, srcfsp, oldpath, dstfsp, newpath, flags) \
|
||||
smb_vfs_call_linkat((conn)->vfs_handles, (srcfsp), (oldpath), (dstfsp), (newpath), (flags))
|
||||
#define SMB_VFS_NEXT_LINKAT(handle, srcfsp, oldpath, dstfsp, newpath, flags) \
|
||||
|
@ -2663,6 +2663,27 @@ static int vfswrap_readlink(vfs_handle_struct *handle,
|
||||
return result;
|
||||
}
|
||||
|
||||
static int vfswrap_readlinkat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz)
|
||||
{
|
||||
int result;
|
||||
|
||||
START_PROFILE(syscall_readlinkat);
|
||||
|
||||
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
|
||||
|
||||
result = readlinkat(dirfsp->fh->fd,
|
||||
smb_fname->base_name,
|
||||
buf,
|
||||
bufsiz);
|
||||
|
||||
END_PROFILE(syscall_readlinkat);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int vfswrap_linkat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -3487,6 +3508,7 @@ static struct vfs_fn_pointers vfs_default_fns = {
|
||||
.getlock_fn = vfswrap_getlock,
|
||||
.symlink_fn = vfswrap_symlink,
|
||||
.readlink_fn = vfswrap_readlink,
|
||||
.readlinkat_fn = vfswrap_readlinkat,
|
||||
.linkat_fn = vfswrap_linkat,
|
||||
.mknodat_fn = vfswrap_mknodat,
|
||||
.realpath_fn = vfswrap_realpath,
|
||||
|
@ -471,6 +471,16 @@ int vfs_not_implemented_vfs_readlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
|
||||
files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vfs_not_implemented_linkat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
@ -1094,6 +1104,7 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
|
||||
.getlock_fn = vfs_not_implemented_getlock,
|
||||
.symlink_fn = vfs_not_implemented_symlink,
|
||||
.readlink_fn = vfs_not_implemented_vfs_readlink,
|
||||
.readlinkat_fn = vfs_not_implemented_vfs_readlinkat,
|
||||
.linkat_fn = vfs_not_implemented_linkat,
|
||||
.mknodat_fn = vfs_not_implemented_mknodat,
|
||||
.realpath_fn = vfs_not_implemented_realpath,
|
||||
|
@ -2210,6 +2210,20 @@ int smb_vfs_call_readlink(struct vfs_handle_struct *handle,
|
||||
return handle->fns->readlink_fn(handle, smb_fname, buf, bufsiz);
|
||||
}
|
||||
|
||||
int smb_vfs_call_readlinkat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname,
|
||||
char *buf,
|
||||
size_t bufsiz)
|
||||
{
|
||||
VFS_FIND(readlinkat);
|
||||
return handle->fns->readlinkat_fn(handle,
|
||||
dirfsp,
|
||||
smb_fname,
|
||||
buf,
|
||||
bufsiz);
|
||||
}
|
||||
|
||||
int smb_vfs_call_linkat(struct vfs_handle_struct *handle,
|
||||
struct files_struct *srcfsp,
|
||||
const struct smb_filename *old_smb_fname,
|
||||
|
Loading…
x
Reference in New Issue
Block a user