• Home
  • Raw
  • Download

Lines Matching full:se

49 	struct fuse_session *se;  member
135 struct fuse_session *se = req->se; in fuse_free_req() local
137 pthread_mutex_lock(&se->lock); in fuse_free_req()
144 pthread_mutex_unlock(&se->lock); in fuse_free_req()
149 static struct fuse_req *fuse_ll_alloc_req(struct fuse_session *se) in fuse_ll_alloc_req() argument
157 req->se = se; in fuse_ll_alloc_req()
167 static int fuse_send_msg(struct fuse_session *se, struct fuse_chan *ch, in fuse_send_msg() argument
172 assert(se != NULL); in fuse_send_msg()
174 if (se->debug) { in fuse_send_msg()
191 if (se->io != NULL) in fuse_send_msg()
192 /* se->io->writev is never NULL if se->io is not NULL as in fuse_send_msg()
194 res = se->io->writev(ch ? ch->fd : se->fd, iov, count, in fuse_send_msg()
195 se->userdata); in fuse_send_msg()
197 res = writev(ch ? ch->fd : se->fd, iov, count); in fuse_send_msg()
203 if (!fuse_session_exited(se) && err != ENOENT) in fuse_send_msg()
233 return fuse_send_msg(req->se, req->ch, iov, count);
440 size = req->se->conn.proto_minor < 9 ? FUSE_COMPAT_ENTRY_OUT_SIZE : sizeof(arg_ext);
442 size = req->se->conn.proto_minor < 9 ? FUSE_COMPAT_ENTRY_OUT_SIZE : sizeof(arg);
447 if (!e->ino && req->se->conn.proto_minor < 4) return fuse_reply_err(req, ENOENT);
473 size_t entrysize = req->se->conn.proto_minor < 9 ?
480 fill_open(oarg, f, req->se->conn.capable & FUSE_CAP_PASSTHROUGH_UPSTREAM);
489 size_t size = req->se->conn.proto_minor < 9 ?
534 if (!(req->se->conn.capable & FUSE_CAP_PASSTHROUGH))
548 ret = ioctl(req->se->fd, FUSE_DEV_IOC_PASSTHROUGH_OPEN_V2, &fd);
558 ret = ioctl(req->se->fd, FUSE_DEV_IOC_PASSTHROUGH_OPEN_V1, &out);
568 ret = ioctl(req->se->fd, FUSE_DEV_IOC_PASSTHROUGH_OPEN_V0, &out);
589 ret = ioctl(req->se->fd, FUSE_DEV_IOC_BACKING_OPEN, &map);
602 ret = ioctl(req->se->fd, FUSE_DEV_IOC_BACKING_CLOSE, &backing_id);
614 fill_open(&arg, f, req->se->conn.capable & FUSE_CAP_PASSTHROUGH_UPSTREAM);
633 static int fuse_send_data_iov_fallback(struct fuse_session *se, argument
652 return fuse_send_msg(se, ch, iov, iov_count);
670 res = fuse_send_msg(se, ch, iov, iov_count);
715 static struct fuse_ll_pipe *fuse_ll_get_pipe(struct fuse_session *se) argument
717 struct fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);
737 pthread_setspecific(se->pipe_key, llp);
744 static void fuse_ll_clear_pipe(struct fuse_session *se) argument
746 struct fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);
748 pthread_setspecific(se->pipe_key, NULL);
799 static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch, argument
814 if (se->broken_splice_nonblock)
829 if (se->conn.proto_minor < 14 ||
830 !(se->conn.want & FUSE_CAP_SPLICE_WRITE))
833 llp = fuse_ll_get_pipe(se);
894 se->broken_splice_nonblock = 1;
896 pthread_setspecific(se->pipe_key, NULL);
953 res = fuse_send_msg(se, ch, iov, iov_count);
963 if (se->debug) {
971 (se->conn.want & FUSE_CAP_SPLICE_MOVE))
974 if (se->io != NULL && se->io->splice_send != NULL) {
975 res = se->io->splice_send(llp->pipe[0], NULL,
976 ch ? ch->fd : se->fd, NULL, out->len,
977 splice_flags, se->userdata);
979 res = splice(llp->pipe[0], NULL, ch ? ch->fd : se->fd, NULL,
996 fuse_ll_clear_pipe(se);
1000 return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1003 static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch, argument
1010 return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1027 res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);
1039 size_t size = req->se->conn.proto_minor < 4 ?
1122 if (req->se->conn.proto_minor < 16) {
1242 if (req->se->op.lookup)
1243 req->se->op.lookup(req, nodeid, name);
1251 if (req->se->op.lookup_postfilter) {
1263 req->se->op.lookup_postfilter(req, nodeid, error_in, name, feo,
1274 if (req->se->op.forget)
1275 req->se->op.forget(req, nodeid, arg->nlookup);
1289 if (req->se->op.forget_multi) {
1290 req->se->op.forget_multi(req, arg->count,
1292 } else if (req->se->op.forget) {
1297 dummy_req = fuse_ll_alloc_req(req->se);
1305 req->se->op.forget(dummy_req, forget->nodeid,
1319 if (req->se->conn.proto_minor >= 9) {
1329 if (req->se->op.getattr)
1330 req->se->op.getattr(req, nodeid, fip);
1339 if (req->se->op.setattr) {
1364 req->se->op.setattr(req, nodeid, &stbuf, arg->valid, fi);
1373 if (req->se->op.access)
1374 req->se->op.access(req, nodeid, arg->mask);
1383 if (req->se->op.readlink)
1384 req->se->op.readlink(req, nodeid);
1393 if (req->se->op.canonical_path)
1394 req->se->op.canonical_path(req, nodeid);
1404 if (req->se->conn.proto_minor >= 12)
1409 if (req->se->op.mknod)
1410 req->se->op.mknod(req, nodeid, name, arg->mode, arg->rdev);
1419 if (req->se->conn.proto_minor >= 12)
1422 if (req->se->op.mkdir)
1423 req->se->op.mkdir(req, nodeid, PARAM(arg), arg->mode);
1432 if (req->se->op.unlink)
1433 req->se->op.unlink(req, nodeid, name);
1442 if (req->se->op.rmdir)
1443 req->se->op.rmdir(req, nodeid, name);
1453 if (req->se->op.symlink)
1454 req->se->op.symlink(req, linkname, nodeid, name);
1465 if (req->se->op.rename)
1466 req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,
1478 if (req->se->op.rename)
1479 req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,
1489 if (req->se->op.link)
1490 req->se->op.link(req, arg->oldnodeid, nodeid, PARAM(arg));
1499 if (req->se->op.create) {
1506 if (req->se->conn.proto_minor >= 12)
1511 req->se->op.create(req, nodeid, name, arg->mode, &fi);
1524 if (req->se->op.open)
1525 req->se->op.open(req, nodeid, &fi);
1526 else if (req->se->conn.want & FUSE_CAP_NO_OPEN_SUPPORT)
1536 if (req->se->op.read) {
1541 if (req->se->conn.proto_minor >= 9) {
1545 req->se->op.read(req, nodeid, arg->size, arg->offset, &fi);
1560 if (req->se->conn.proto_minor < 9) {
1568 if (req->se->op.write)
1569 req->se->op.write(req, nodeid, param, arg->size,
1578 struct fuse_session *se = req->se; local
1590 if (se->conn.proto_minor < 9) {
1611 se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);
1616 fuse_ll_clear_pipe(se);
1627 if (req->se->conn.proto_minor >= 7)
1630 if (req->se->op.flush)
1631 req->se->op.flush(req, nodeid, &fi);
1644 if (req->se->conn.proto_minor >= 8) {
1653 if (req->se->op.release)
1654 req->se->op.release(req, nodeid, &fi);
1668 if (req->se->op.fsync)
1669 req->se->op.fsync(req, nodeid, datasync, &fi);
1682 if (req->se->op.opendir)
1683 req->se->op.opendir(req, nodeid, &fi);
1684 else if (req->se->conn.want & FUSE_CAP_NO_OPENDIR_SUPPORT)
1698 if (req->se->op.readdir)
1699 req->se->op.readdir(req, nodeid, arg->size, arg->offset, &fi);
1712 if (req->se->op.readdirplus)
1713 req->se->op.readdirplus(req, nodeid, arg->size, arg->offset, &fi);
1729 if (req->se->op.readdirpostfilter)
1730 req->se->op.readdirpostfilter(req, nodeid, error_in, fri->offset,
1747 if (req->se->op.releasedir)
1748 req->se->op.releasedir(req, nodeid, &fi);
1762 if (req->se->op.fsyncdir)
1763 req->se->op.fsyncdir(req, nodeid, datasync, &fi);
1773 if (req->se->op.statfs)
1774 req->se->op.statfs(req, nodeid);
1786 struct fuse_session *se = req->se; local
1787 unsigned int xattr_ext = !!(se->conn.want & FUSE_CAP_SETXATTR_EXT);
1794 if (req->se->op.setxattr)
1795 req->se->op.setxattr(req, nodeid, name, value, arg->size,
1805 if (req->se->op.getxattr)
1806 req->se->op.getxattr(req, nodeid, PARAM(arg), arg->size);
1815 if (req->se->op.listxattr)
1816 req->se->op.listxattr(req, nodeid, arg->size);
1825 if (req->se->op.removexattr)
1826 req->se->op.removexattr(req, nodeid, name);
1856 if (req->se->op.getlk)
1857 req->se->op.getlk(req, nodeid, &fi, &flock);
1890 if (req->se->op.flock)
1891 req->se->op.flock(req, nodeid, &fi, op);
1896 if (req->se->op.setlk)
1897 req->se->op.setlk(req, nodeid, &fi, &flock, sleep);
1913 static int find_interrupted(struct fuse_session *se, struct fuse_req *req) argument
1917 for (curr = se->list.next; curr != &se->list; curr = curr->next) {
1923 pthread_mutex_unlock(&se->lock);
1927 pthread_mutex_lock(&se->lock);
1931 pthread_mutex_unlock(&se->lock);
1936 pthread_mutex_lock(&se->lock);
1945 for (curr = se->interrupts.next; curr != &se->interrupts;
1956 struct fuse_session *se = req->se; local
1959 if (se->debug)
1965 pthread_mutex_lock(&se->lock);
1966 if (find_interrupted(se, req)) {
1971 list_add_req(req, &se->interrupts);
1972 pthread_mutex_unlock(&se->lock);
1975 static struct fuse_req *check_interrupt(struct fuse_session *se, argument
1980 for (curr = se->interrupts.next; curr != &se->interrupts;
1991 curr = se->interrupts.next;
1992 if (curr != &se->interrupts) {
2004 if (req->se->op.bmap)
2005 req->se->op.bmap(req, nodeid, arg->blocksize, arg->block);
2018 !(req->se->conn.want & FUSE_CAP_IOCTL_DIR)) {
2026 if (sizeof(void *) == 4 && req->se->conn.proto_minor >= 16 &&
2031 if (req->se->op.ioctl)
2032 req->se->op.ioctl(req, nodeid, arg->cmd,
2053 if (req->se->op.poll) {
2063 ph->se = req->se;
2066 req->se->op.poll(req, nodeid, &fi, ph);
2080 if (req->se->op.fallocate)
2081 req->se->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi);
2098 if (req->se->op.copy_file_range)
2099 req->se->op.copy_file_range(req, nodeid_in, arg->off_in,
2115 if (req->se->op.lseek)
2116 req->se->op.lseek(req, nodeid, arg->offset, arg->whence, &fi);
2128 struct fuse_session *se = req->se; local
2129 size_t bufsize = se->bufsize;
2134 if (se->debug) {
2142 se->conn.proto_major = arg->major;
2143 se->conn.proto_minor = arg->minor;
2144 se->conn.capable = 0;
2145 se->conn.want = 0;
2165 if (arg->max_readahead < se->conn.max_readahead)
2166 se->conn.max_readahead = arg->max_readahead;
2178 se->conn.capable |= FUSE_CAP_ASYNC_READ;
2180 se->conn.capable |= FUSE_CAP_POSIX_LOCKS;
2182 se->conn.capable |= FUSE_CAP_ATOMIC_O_TRUNC;
2184 se->conn.capable |= FUSE_CAP_EXPORT_SUPPORT;
2186 se->conn.capable |= FUSE_CAP_DONT_MASK;
2188 se->conn.capable |= FUSE_CAP_FLOCK_LOCKS;
2190 se->conn.capable |= FUSE_CAP_AUTO_INVAL_DATA;
2192 se->conn.capable |= FUSE_CAP_READDIRPLUS;
2194 se->conn.capable |= FUSE_CAP_READDIRPLUS_AUTO;
2196 se->conn.capable |= FUSE_CAP_ASYNC_DIO;
2198 se->conn.capable |= FUSE_CAP_WRITEBACK_CACHE;
2200 se->conn.capable |= FUSE_CAP_NO_OPEN_SUPPORT;
2202 se->conn.capable |= FUSE_CAP_PARALLEL_DIROPS;
2204 se->conn.capable |= FUSE_CAP_POSIX_ACL;
2206 se->conn.capable |= FUSE_CAP_HANDLE_KILLPRIV;
2208 se->conn.capable |= FUSE_CAP_HANDLE_KILLPRIV_V2;
2210 se->conn.capable |= FUSE_CAP_CACHE_SYMLINKS;
2212 se->conn.capable |= FUSE_CAP_NO_OPENDIR_SUPPORT;
2214 se->conn.capable |= FUSE_CAP_EXPLICIT_INVAL_DATA;
2216 se->conn.capable |= FUSE_CAP_SETXATTR_EXT;
2226 se->conn.capable |= FUSE_CAP_DIRECT_IO_ALLOW_MMAP;
2228 se->conn.capable |= FUSE_CAP_EXPIRE_ONLY;
2230 se->conn.capable |= FUSE_CAP_PASSTHROUGH_UPSTREAM;
2233 se->conn.capable |= FUSE_CAP_PASSTHROUGH;
2236 se->conn.capable |= FUSE_CAP_PASSTHROUGH;
2239 se->conn.max_readahead = 0;
2242 if (se->conn.proto_minor >= 14) {
2245 if ((se->io == NULL) || (se->io->splice_send != NULL)) {
2246 se->conn.capable |= FUSE_CAP_SPLICE_WRITE | FUSE_CAP_SPLICE_MOVE;
2249 if ((se->io == NULL) || (se->io->splice_receive != NULL)) {
2250 se->conn.capable |= FUSE_CAP_SPLICE_READ;
2254 if (se->conn.proto_minor >= 18)
2255 se->conn.capable |= FUSE_CAP_IOCTL_DIR;
2265 if ((cond) && (se->conn.capable & (cap))) \
2266 se->conn.want |= (cap)
2272 LL_SET_DEFAULT(se->op.write_buf, FUSE_CAP_SPLICE_READ);
2273 LL_SET_DEFAULT(se->op.getlk && se->op.setlk,
2275 LL_SET_DEFAULT(se->op.flock, FUSE_CAP_FLOCK_LOCKS);
2276 LL_SET_DEFAULT(se->op.readdirplus, FUSE_CAP_READDIRPLUS);
2277 LL_SET_DEFAULT(se->op.readdirplus && se->op.readdir,
2285 se->conn.time_gran = 1;
2292 se->bufsize = bufsize;
2294 se->got_init = 1;
2295 if (se->op.init)
2296 se->op.init(se->userdata, &se->conn);
2298 if (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE)
2299 se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE;
2301 if (se->conn.want & (~se->conn.capable)) {
2304 se->conn.want & (~se->conn.capable));
2306 se->error = -EPROTO;
2307 fuse_session_exit(se);
2311 unsigned max_read_mo = get_max_read(se->mo);
2312 if (se->conn.max_read != max_read_mo) {
2315 se->conn.max_read, max_read_mo);
2317 se->error = -EPROTO;
2318 fuse_session_exit(se);
2322 if (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) {
2323 se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE;
2327 outarg.max_pages = (se->conn.max_write - 1) / getpagesize() + 1;
2334 if (se->conn.want & FUSE_CAP_ASYNC_READ)
2336 if (se->conn.want & FUSE_CAP_POSIX_LOCKS)
2338 if (se->conn.want & FUSE_CAP_ATOMIC_O_TRUNC)
2340 if (se->conn.want & FUSE_CAP_EXPORT_SUPPORT)
2342 if (se->conn.want & FUSE_CAP_DONT_MASK)
2344 if (se->conn.want & FUSE_CAP_FLOCK_LOCKS)
2346 if (se->conn.want & FUSE_CAP_AUTO_INVAL_DATA)
2348 if (se->conn.want & FUSE_CAP_READDIRPLUS)
2350 if (se->conn.want & FUSE_CAP_READDIRPLUS_AUTO)
2352 if (se->conn.want & FUSE_CAP_ASYNC_DIO)
2354 if (se->conn.want & FUSE_CAP_WRITEBACK_CACHE)
2356 if (se->conn.want & FUSE_CAP_PARALLEL_DIROPS)
2358 if (se->conn.want & FUSE_CAP_POSIX_ACL)
2360 if (se->conn.want & FUSE_CAP_HANDLE_KILLPRIV)
2362 if (se->conn.want & FUSE_CAP_HANDLE_KILLPRIV_V2)
2364 if (se->conn.want & FUSE_CAP_CACHE_SYMLINKS)
2366 if (se->conn.want & FUSE_CAP_EXPLICIT_INVAL_DATA)
2368 if (se->conn.want & FUSE_CAP_SETXATTR_EXT)
2370 if (se->conn.want & FUSE_CAP_DIRECT_IO_ALLOW_MMAP)
2372 if (se->conn.want & FUSE_CAP_PASSTHROUGH_UPSTREAM) {
2378 outarg.max_stack_depth = se->conn.max_backing_stack_depth + 1;
2380 if (se->conn.want & FUSE_CAP_PASSTHROUGH) {
2393 outarg.max_readahead = se->conn.max_readahead;
2394 outarg.max_write = se->conn.max_write;
2395 if (se->conn.proto_minor >= 13) {
2396 if (se->conn.max_background >= (1 << 16))
2397 se->conn.max_background = (1 << 16) - 1;
2398 if (se->conn.congestion_threshold > se->conn.max_background)
2399 se->conn.congestion_threshold = se->conn.max_background;
2400 if (!se->conn.congestion_threshold) {
2401 se->conn.congestion_threshold =
2402 se->conn.max_background * 3 / 4;
2405 outarg.max_background = se->conn.max_background;
2406 outarg.congestion_threshold = se->conn.congestion_threshold;
2408 if (se->conn.proto_minor >= 23)
2409 outarg.time_gran = se->conn.time_gran;
2411 if (se->debug) {
2423 if (se->conn.want & FUSE_CAP_PASSTHROUGH)
2437 struct fuse_session *se = req->se; local
2442 se->got_destroy = 1;
2443 se->got_init = 0;
2444 if (se->op.destroy)
2445 se->op.destroy(se->userdata);
2477 struct fuse_session *se = req->se; local
2481 pthread_mutex_lock(&se->lock);
2482 head = &se->notify_list;
2489 pthread_mutex_unlock(&se->lock);
2495 static int send_notify_iov(struct fuse_session *se, int notify_code, argument
2500 if (!se->got_init)
2508 return fuse_send_msg(se, NULL, iov, count);
2522 return send_notify_iov(ph->se, FUSE_NOTIFY_POLL, iov, 2);
2528 int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino, argument
2534 if (!se)
2537 if (se->conn.proto_minor < 12)
2547 return send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2);
2562 * @param se the session object
2569 static int fuse_lowlevel_notify_entry(struct fuse_session *se, fuse_ino_t parent, argument
2576 if (!se)
2579 if (se->conn.proto_minor < 12)
2593 return send_notify_iov(se, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);
2596 int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, argument
2599 return fuse_lowlevel_notify_entry(se, parent, name, namelen, FUSE_LL_INVALIDATE);
2602 int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, argument
2605 if (!se)
2608 if (!(se->conn.capable & FUSE_CAP_EXPIRE_ONLY))
2611 return fuse_lowlevel_notify_entry(se, parent, name, namelen, FUSE_LL_EXPIRE_ONLY);
2615 int fuse_lowlevel_notify_delete(struct fuse_session *se, argument
2622 if (!se)
2625 if (se->conn.proto_minor < 18)
2638 return send_notify_iov(se, FUSE_NOTIFY_DELETE, iov, 3);
2641 int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino, argument
2651 if (!se)
2654 if (se->conn.proto_minor < 15)
2670 res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);
2687 struct fuse_session *se = req->se; local
2709 if (se->op.retrieve_reply) {
2710 se->op.retrieve_reply(req, rreq->cookie, ino,
2718 fuse_ll_clear_pipe(se);
2721 int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino, argument
2729 if (!se)
2732 if (se->conn.proto_minor < 15)
2739 pthread_mutex_lock(&se->lock);
2741 rreq->nreq.unique = se->notify_ctr++;
2743 list_add_nreq(&rreq->nreq, &se->notify_list);
2744 pthread_mutex_unlock(&se->lock);
2755 err = send_notify_iov(se, FUSE_NOTIFY_RETRIEVE, iov, 2);
2757 pthread_mutex_lock(&se->lock);
2759 pthread_mutex_unlock(&se->lock);
2768 return req->se->userdata;
2780 pthread_mutex_lock(&req->se->lock);
2783 pthread_mutex_unlock(&req->se->lock);
2793 pthread_mutex_lock(&req->se->lock);
2795 pthread_mutex_unlock(&req->se->lock);
2906 void fuse_session_process_buf(struct fuse_session *se, argument
2909 fuse_session_process_buf_int(se, buf, NULL);
2912 void fuse_session_process_buf_int(struct fuse_session *se, argument
2951 if (se->debug) {
2960 req = fuse_ll_alloc_req(se);
2971 fuse_send_msg(se, ch, &iov, 1);
2982 if (!se->got_init) {
2985 expected = se->cuse_data ? CUSE_INIT : FUSE_INIT;
2993 if (se->deny_others && in->uid != se->owner && in->uid != 0 &&
3007 pthread_mutex_lock(&se->lock);
3008 intr = check_interrupt(se, req);
3009 list_add_req(req, &se->list);
3010 pthread_mutex_unlock(&se->lock);
3016 (in->opcode != FUSE_WRITE || !se->op.write_buf) &&
3038 if (in->opcode == FUSE_WRITE && se->op.write_buf)
3065 fuse_ll_clear_pipe(se);
3097 void fuse_session_destroy(struct fuse_session *se) argument
3101 if (se->got_init && !se->got_destroy) {
3102 if (se->op.destroy)
3103 se->op.destroy(se->userdata);
3105 llp = pthread_getspecific(se->pipe_key);
3108 pthread_key_delete(se->pipe_key);
3109 pthread_mutex_destroy(&se->lock);
3110 free(se->cuse_data);
3111 if (se->fd != -1)
3112 close(se->fd);
3113 if (se->io != NULL)
3114 free(se->io);
3115 destroy_mount_opts(se->mo);
3116 free(se);
3126 int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf) argument
3128 return fuse_session_receive_buf_int(se, buf, NULL);
3131 int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf, argument
3137 size_t bufsize = se->bufsize;
3141 if (se->conn.proto_minor < 14 || !(se->conn.want & FUSE_CAP_SPLICE_READ))
3144 llp = fuse_ll_get_pipe(se);
3164 if (se->io != NULL && se->io->splice_receive != NULL) {
3165 res = se->io->splice_receive(ch ? ch->fd : se->fd, NULL,
3167 se->userdata);
3169 res = splice(ch ? ch->fd : se->fd, NULL, llp->pipe[1], NULL,
3174 if (fuse_session_exited(se))
3181 fuse_session_exit(se);
3211 buf->mem = malloc(se->bufsize);
3218 buf->size = se->bufsize;
3226 fuse_ll_clear_pipe(se);
3231 fuse_ll_clear_pipe(se);
3248 buf->mem = malloc(se->bufsize);
3257 if (se->io != NULL) {
3258 /* se->io->read is never NULL if se->io is not NULL as
3260 res = se->io->read(ch ? ch->fd : se->fd, buf->mem, se->bufsize,
3261 se->userdata);
3263 res = read(ch ? ch->fd : se->fd, buf->mem, se->bufsize);
3267 if (fuse_session_exited(se))
3278 fuse_session_exit(se);
3306 struct fuse_session *se; local
3319 se = (struct fuse_session *) calloc(1, sizeof(struct fuse_session));
3320 if (se == NULL) {
3324 se->fd = -1;
3325 se->conn.max_write = UINT_MAX;
3326 se->conn.max_readahead = UINT_MAX;
3329 if(fuse_opt_parse(args, se, fuse_ll_opts, NULL) == -1)
3331 if(se->deny_others) {
3358 if (se->debug)
3361 se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() +
3364 list_init_req(&se->list);
3365 list_init_req(&se->interrupts);
3366 list_init_nreq(&se->notify_list);
3367 se->notify_ctr = 1;
3368 pthread_mutex_init(&se->lock, NULL);
3370 err = pthread_key_create(&se->pipe_key, fuse_ll_pipe_destructor);
3377 memcpy(&se->op, op, op_size);
3378 se->owner = getuid();
3379 se->userdata = userdata;
3381 se->mo = mo;
3388 se->version = *version;
3390 return se;
3393 pthread_mutex_destroy(&se->lock);
3400 free(se);
3421 int fuse_session_custom_io(struct fuse_session *se, const struct fuse_custom_io *io, argument
3443 se->io = malloc(sizeof(struct fuse_custom_io));
3444 if (se->io == NULL) {
3450 se->fd = fd;
3451 *se->io = *io;
3455 int fuse_session_mount(struct fuse_session *se, const char *mountpoint) argument
3483 se->fd = fd;
3488 fd = fuse_kern_mount(mountpoint, se->mo);
3491 se->fd = fd;
3494 se->mountpoint = strdup(mountpoint);
3495 if (se->mountpoint == NULL)
3505 int fuse_session_fd(struct fuse_session *se) argument
3507 return se->fd;
3510 void fuse_session_unmount(struct fuse_session *se) argument
3512 if (se->mountpoint != NULL) {
3513 fuse_kern_unmount(se->mountpoint, se->fd);
3514 se->fd = -1;
3515 free(se->mountpoint);
3516 se->mountpoint = NULL;
3593 void fuse_session_exit(struct fuse_session *se) argument
3595 se->exited = 1;
3599 void fuse_session_reset(struct fuse_session *se) argument
3601 se->exited = 0;
3602 se->error = 0;
3606 int fuse_session_exited(struct fuse_session *se) argument
3608 return se->exited;