* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#include "includes.h"
+#include "system/filesys.h"
#include <linux/ioctl.h>
#include <linux/fs.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <dirent.h>
#include <libgen.h>
-#include "system/filesys.h"
-#include "includes.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "librpc/gen_ndr/smbXsrv.h"
struct btrfs_offload_read_state {
struct vfs_handle_struct *handle;
files_struct *fsp;
+ uint32_t flags;
+ uint64_t xferlen;
DATA_BLOB token;
};
status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
state->handle,
state,
+ &state->flags,
+ &state->xferlen,
&state->token);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
static NTSTATUS btrfs_offload_read_recv(struct tevent_req *req,
struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
+ uint32_t *flags,
+ uint64_t *xferlen,
DATA_BLOB *token)
{
struct btrfs_offload_read_state *state = tevent_req_data(
return status;
}
+ *flags = state->flags;
+ *xferlen = state->xferlen;
token->length = state->token.length;
token->data = talloc_move(mem_ctx, &state->token.data);
src_off,
num,
READ_LOCK,
+ lp_posix_cifsu_locktype(src_fsp),
&src_lck);
if (!SMB_VFS_STRICT_LOCK_CHECK(src_fsp->conn, src_fsp, &src_lck)) {
tevent_req_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
dest_off,
num,
WRITE_LOCK,
+ lp_posix_cifsu_locktype(dest_fsp),
&dest_lck);
if (!SMB_VFS_STRICT_LOCK_CHECK(dest_fsp->conn, dest_fsp, &dest_lck)) {
struct files_struct *fsp,
uint16_t *_compression_fmt)
{
- char buf[PATH_MAX];
- const char *p = NULL;
+ struct sys_proc_fd_path_buf buf;
int ret;
long flags = 0;
+ int fsp_fd = fsp_get_pathref_fd(fsp);
int fd = -1;
NTSTATUS status;
if (!fsp->fsp_flags.is_pathref) {
- ret = ioctl(fd, FS_IOC_GETFLAGS, &flags);
+ ret = ioctl(fsp_fd, FS_IOC_GETFLAGS, &flags);
if (ret < 0) {
DBG_WARNING("FS_IOC_GETFLAGS failed: %s, fd %lld\n",
strerror(errno), (long long)fd);
return NT_STATUS_NOT_IMPLEMENTED;
}
- fd = fsp_get_pathref_fd(fsp);
-
- p = sys_proc_fd_path(fd, buf, sizeof(buf));
- if (p == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- fd = open(p, O_RDONLY);
+ fd = open(sys_proc_fd_path(fsp_fd, &buf), O_RDONLY);
if (fd == -1) {
- DBG_ERR("/proc open of %s failed: %s\n", p, strerror(errno));
+ DBG_DEBUG("/proc open of %s failed: %s\n",
+ buf.buf,
+ strerror(errno));
return map_nt_error_from_unix(errno);
}
char *snap_path)
{
char *tstr;
- struct tm t_gmt;
+ struct tm t_gmt = {};
DIR *dest_dir;
int dest_fd;
struct btrfs_ioctl_vol_args ioctl_arg;