Browse Source
Merge pull request #593 from trapexit/outbuf
ioctl: don't set outbufsz when not needed
pull/599/head
trapexit
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
22 additions and
16 deletions
-
libfuse/include/fuse_lowlevel.h
-
libfuse/lib/fuse.c
-
libfuse/lib/fuse_lowlevel.c
-
src/fuse_ioctl.cpp
|
|
@ -888,7 +888,7 @@ struct fuse_lowlevel_ops { |
|
|
|
*/ |
|
|
|
void (*ioctl) (fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, |
|
|
|
struct fuse_file_info *fi, unsigned flags, |
|
|
|
const void *in_buf, size_t in_bufsz, size_t out_bufsz); |
|
|
|
const void *in_buf, uint32_t in_bufsz, uint32_t out_bufsz); |
|
|
|
|
|
|
|
/** |
|
|
|
* Poll for IO readiness |
|
|
@ -1286,7 +1286,7 @@ int fuse_reply_ioctl_retry(fuse_req_t req, |
|
|
|
* @param buf buffer containing output data |
|
|
|
* @param size length of output data |
|
|
|
*/ |
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, size_t size); |
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size); |
|
|
|
|
|
|
|
/** |
|
|
|
* Reply to finish ioctl with iov buffer |
|
|
|
|
|
@ -3896,8 +3896,8 @@ static void fuse_lib_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize, |
|
|
|
|
|
|
|
static void fuse_lib_ioctl(fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, |
|
|
|
struct fuse_file_info *llfi, unsigned int flags, |
|
|
|
const void *in_buf, size_t in_bufsz, |
|
|
|
size_t out_bufsz_) |
|
|
|
const void *in_buf, uint32_t in_bufsz, |
|
|
|
uint32_t out_bufsz_) |
|
|
|
{ |
|
|
|
struct fuse *f = req_fuse_prepare(req); |
|
|
|
struct fuse_intr_data d; |
|
|
|
|
|
@ -916,23 +916,28 @@ enomem: |
|
|
|
goto out; |
|
|
|
} |
|
|
|
|
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, size_t size) |
|
|
|
int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, uint32_t size) |
|
|
|
{ |
|
|
|
struct fuse_ioctl_out arg; |
|
|
|
int count; |
|
|
|
struct iovec iov[3]; |
|
|
|
size_t count = 1; |
|
|
|
struct fuse_ioctl_out arg; |
|
|
|
|
|
|
|
memset(&arg, 0, sizeof(arg)); |
|
|
|
arg.result = result; |
|
|
|
arg.result = result; |
|
|
|
arg.flags = 0; |
|
|
|
arg.in_iovs = 0; |
|
|
|
arg.out_iovs = 0; |
|
|
|
|
|
|
|
count = 1; |
|
|
|
iov[count].iov_base = &arg; |
|
|
|
iov[count].iov_len = sizeof(arg); |
|
|
|
iov[count].iov_len = sizeof(arg); |
|
|
|
count++; |
|
|
|
|
|
|
|
if (size) { |
|
|
|
iov[count].iov_base = (char *) buf; |
|
|
|
iov[count].iov_len = size; |
|
|
|
count++; |
|
|
|
} |
|
|
|
if(size) |
|
|
|
{ |
|
|
|
iov[count].iov_base = (char*)buf; |
|
|
|
iov[count].iov_len = size; |
|
|
|
count++; |
|
|
|
} |
|
|
|
|
|
|
|
return send_reply_iov(req, 0, iov, count); |
|
|
|
} |
|
|
|
|
|
@ -90,7 +90,8 @@ namespace l |
|
|
|
case FS_IOC_SETVERSION: |
|
|
|
if(endian::is_big() && (sizeof(long) != sizeof(int))) |
|
|
|
return -ENOTTY; |
|
|
|
*out_bufsz_ = 4; |
|
|
|
if((data_ != NULL) && (*out_bufsz_ > 4)) |
|
|
|
*out_bufsz_ = 4; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|