return -1;
}
+static int skel_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,
/* File operations */
.open_fn = skel_open,
+ .openat_fn = skel_openat,
.create_file_fn = skel_create_file,
.close_fn = skel_close_fn,
.pread_fn = skel_pread,
return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
+static int skel_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode)
+{
+ return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+}
+
static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,
/* File operations */
.open_fn = skel_open,
+ .openat_fn = skel_openat,
.create_file_fn = skel_create_file,
.close_fn = skel_close_fn,
.pread_fn = skel_pread,
SMBPROFILE_STATS_BASIC(syscall_mkdirat) \
SMBPROFILE_STATS_BASIC(syscall_closedir) \
SMBPROFILE_STATS_BASIC(syscall_open) \
+ SMBPROFILE_STATS_BASIC(syscall_openat) \
SMBPROFILE_STATS_BASIC(syscall_createfile) \
SMBPROFILE_STATS_BASIC(syscall_close) \
SMBPROFILE_STATS_BYTES(syscall_pread) \
* Version 43 - Remove root_dir_fid from SMB_VFS_CREATE_FILE().
* Version 43 - Add dirfsp to struct files_struct
* Version 43 - Add dirfsp args to SMB_VFS_CREATE_FILE()
+ * Version 43 - Add SMB_VFS_OPENAT()
*/
#define SMB_VFS_INTERFACE_VERSION 43
int (*open_fn)(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname, files_struct *fsp,
int flags, mode_t mode);
+ int (*openat_fn)(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode);
NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,
int smb_vfs_call_open(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname, struct files_struct *fsp,
int flags, mode_t mode);
+int smb_vfs_call_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode);
NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,
int vfs_not_implemented_open(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode);
+int vfs_not_implemented_openat(vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode);
NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,
#define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \
smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode))
+#define SMB_VFS_OPENAT(conn, dirfsp, smb_fname, fsp, flags, mode) \
+ smb_vfs_call_openat((conn)->vfs_handles, (dirfsp), (smb_fname), (fsp), (flags), (mode))
+#define SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode) \
+ smb_vfs_call_openat((handle)->next, (dirfsp), (smb_fname), (fsp), (flags), (mode))
+
#define SMB_VFS_CREATE_FILE(conn, req, dirfsp, smb_fname, access_mask, share_access, create_disposition, \
create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
smb_vfs_call_create_file((conn)->vfs_handles, (req), (dirfsp), (smb_fname), (access_mask), (share_access), (create_disposition), \
return -1;
}
+int vfs_not_implemented_openat(vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirsp,
/* File operations */
.open_fn = vfs_not_implemented_open,
+ .openat_fn = vfs_not_implemented_openat,
.create_file_fn = vfs_not_implemented_create_file,
.close_fn = vfs_not_implemented_close_fn,
.pread_fn = vfs_not_implemented_pread,
return handle->fns->open_fn(handle, smb_fname, fsp, flags, mode);
}
+int smb_vfs_call_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode)
+{
+ VFS_FIND(openat);
+ return handle->fns->openat_fn(handle,
+ dirfsp,
+ smb_fname,
+ fsp,
+ flags,
+ mode);
+}
+
NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
struct smb_request *req,
struct files_struct **dirfsp,