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>
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)
.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,
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)
.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,
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) \
/* 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
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);
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);
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);
#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) \
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)
.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,
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)
.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,
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)