Lines Matching defs:buf
277 /* `buf` is allowed to be empty so that the proper size may be
279 size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
292 if ((buf == NULL) || (entlen_padded > bufsize))
295 dirent = (struct fuse_dirent*) buf;
367 /* `buf` is allowed to be empty so that the proper size may be
369 size_t fuse_add_direntry_plus(fuse_req_t req, char *buf, size_t bufsize,
381 if ((buf == NULL) || (entlen_padded > bufsize))
384 struct fuse_direntplus *dp = (struct fuse_direntplus *) buf;
436 char buf[sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out)];
439 struct fuse_entry_out *earg = (struct fuse_entry_out *) buf;
440 struct fuse_open_out *oarg = (struct fuse_open_out *) (buf + entrysize);
442 memset(buf, 0, sizeof(buf));
445 return send_reply_ok(req, buf,
488 int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size)
490 return send_reply_ok(req, buf, size);
496 struct fuse_bufvec *buf,
504 if (buf->count == 1 && buf->idx == 0 && buf->off == 0 &&
505 !(buf->buf[0].flags & FUSE_BUF_IS_FD)) {
509 iov[iov_count].iov_base = buf->buf[0].mem;
519 mem_buf.buf[0].mem = mbuf;
520 res = fuse_buf_copy(&mem_buf, buf, 0);
614 static int read_back(int fd, char *buf, size_t len)
618 res = read(fd, buf, len);
635 char buf[32];
641 res = read(maxfd, buf, sizeof(buf) - 1);
650 buf[res] = '\0';
652 max = atoi(buf);
661 struct fuse_bufvec *buf, unsigned int flags)
664 size_t len = fuse_buf_size(buf);
681 for (idx = buf->idx; idx < buf->count; idx++) {
682 total_buf_size += buf->buf[idx].size;
683 if (idx == buf->idx)
684 total_buf_size -= buf->off;
706 pipesize = pagesize * (iov_count + buf->count + 1) + out->len;
736 pipe_buf.buf[0].flags = FUSE_BUF_IS_FD;
737 pipe_buf.buf[0].fd = llp->pipe[1];
739 res = fuse_buf_copy(&pipe_buf, buf,
781 mem_buf.buf[0].mem = mbuf;
783 res = fuse_buf_copy(&mem_buf, buf, 0);
860 return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
865 struct fuse_bufvec *buf, unsigned int flags)
867 size_t len = fuse_buf_size(buf);
870 return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1033 int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, size_t size)
1046 iov[count].iov_base = (char *) buf;
1406 .buf[0] = *ibuf,
1417 bufv.buf[0].mem = ((char *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;
1418 bufv.buf[0].size -= sizeof(struct fuse_in_header) +
1420 assert(!(bufv.buf[0].flags & FUSE_BUF_IS_FD));
1424 if (!(bufv.buf[0].flags & FUSE_BUF_IS_FD))
1425 bufv.buf[0].mem = PARAM(arg);
1427 bufv.buf[0].size -= sizeof(struct fuse_in_header) +
1430 if (bufv.buf[0].size < arg->size) {
1435 bufv.buf[0].size = arg->size;
1580 struct statvfs buf = {
1584 fuse_reply_statfs(req, &buf);
2238 const void *inarg, const struct fuse_buf *buf)
2255 nreq->reply(nreq, req, nodeid, inarg, buf);
2455 .buf[0] = *ibuf,
2459 if (!(bufv.buf[0].flags & FUSE_BUF_IS_FD))
2460 bufv.buf[0].mem = PARAM(arg);
2462 bufv.buf[0].size -= sizeof(struct fuse_in_header) +
2465 if (bufv.buf[0].size < arg->size) {
2470 bufv.buf[0].size = arg->size;
2641 const struct fuse_buf *buf)
2643 fuse_session_process_buf_int(se, buf, NULL);
2647 const struct fuse_buf *buf, struct fuse_chan *ch)
2651 struct fuse_bufvec bufv = { .buf[0] = *buf, .count = 1 };
2660 if (buf->flags & FUSE_BUF_IS_FD) {
2661 if (buf->size < tmpbuf.buf[0].size)
2662 tmpbuf.buf[0].size = buf->size;
2664 mbuf = malloc(tmpbuf.buf[0].size);
2669 tmpbuf.buf[0].mem = mbuf;
2677 in = buf->mem;
2685 (unsigned long long) in->nodeid, buf->size, in->pid);
2743 if ((buf->flags & FUSE_BUF_IS_FD) && write_header_size < buf->size &&
2749 newmbuf = realloc(mbuf, buf->size);
2754 tmpbuf = FUSE_BUFVEC_INIT(buf->size - write_header_size);
2755 tmpbuf.buf[0].mem = (char *)mbuf + write_header_size;
2767 do_write_buf(req, in->nodeid, inarg, buf);
2769 do_notify_reply(req, in->nodeid, inarg, buf);
2780 if (buf->flags & FUSE_BUF_IS_FD)
2842 int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf)
2844 return fuse_session_receive_buf_int(se, buf, NULL);
2847 int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
2923 struct fuse_bufvec src = { .buf[0] = tmpbuf, .count = 1 };
2926 if (!buf->mem) {
2927 buf->mem = malloc(se->bufsize);
2928 if (!buf->mem) {
2934 buf->size = se->bufsize;
2935 buf->flags = 0;
2936 dst.buf[0] = *buf;
2953 /* Don't overwrite buf->mem, as that would cause a leak */
2954 buf->fd = tmpbuf.fd;
2955 buf->flags = tmpbuf.flags;
2957 buf->size = tmpbuf.size;
2963 if (!buf->mem) {
2964 buf->mem = malloc(se->bufsize);
2965 if (!buf->mem) {
2976 res = se->io->read(ch ? ch->fd : se->fd, buf->mem, se->bufsize,
2979 res = read(ch ? ch->fd : se->fd, buf->mem, se->bufsize);
3009 buf->size = res;
3212 char *buf;
3223 buf = malloc(bufsize);
3224 if (buf == NULL)
3232 ret = read(fd, buf, bufsize);
3240 free(buf);
3246 s = strstr(buf, "\nGroups:");
3265 free(buf);