Lines Matching refs:req
380 static struct fuse* get_fuse(fuse_req_t req) { in get_fuse() argument
381 return reinterpret_cast<struct fuse*>(fuse_req_userdata(req)); in get_fuse()
452 const std::string& path, const std::string& name, fuse_req_t req, int* error_code, in validate_node_path() argument
454 struct fuse* fuse = get_fuse(req); in validate_node_path()
455 const struct fuse_ctx* ctx = fuse_req_ctx(req); in validate_node_path()
494 fuse->mp->FileLookup(path, req->ctx.uid, req->ctx.pid); in validate_node_path()
513 static node* make_node_entry(fuse_req_t req, node* parent, const string& name, const string& path, in make_node_entry() argument
515 struct fuse* fuse = get_fuse(req); in make_node_entry()
516 const struct fuse_ctx* ctx = fuse_req_ctx(req); in make_node_entry()
522 validate_node_path(path, name, req, error_code, e, op); in make_node_entry()
570 TRACE_NODE(node, req); in make_node_entry()
687 static node* do_lookup(fuse_req_t req, fuse_ino_t parent, const char* name, in do_lookup() argument
689 struct fuse* fuse = get_fuse(req); in do_lookup()
698 … if (!fuse->IsRoot(parent_node) && !is_app_accessible_path(fuse->mp, parent_path, req->ctx.uid)) { in do_lookup()
703 TRACE_NODE(parent_node, req); in do_lookup()
715 !fuse->mp->ShouldAllowLookup(req->ctx.uid, userId)) { in do_lookup()
721 return make_node_entry(req, parent_node, name, child_path, e, error_code, op); in do_lookup()
724 static void pf_lookup(fuse_req_t req, fuse_ino_t parent, const char* name) { in pf_lookup() argument
729 if (do_lookup(req, parent, name, &e, &error_code, FuseOp::lookup)) { in pf_lookup()
730 fuse_reply_entry(req, &e); in pf_lookup()
733 fuse_reply_err(req, error_code); in pf_lookup()
737 static void do_forget(fuse_req_t req, struct fuse* fuse, fuse_ino_t ino, uint64_t nlookup) { in do_forget() argument
739 TRACE_NODE(node, req); in do_forget()
748 static void pf_forget(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup) { in pf_forget() argument
752 struct fuse* fuse = get_fuse(req); in pf_forget()
754 do_forget(req, fuse, ino, nlookup); in pf_forget()
755 fuse_reply_none(req); in pf_forget()
758 static void pf_forget_multi(fuse_req_t req, in pf_forget_multi() argument
762 struct fuse* fuse = get_fuse(req); in pf_forget_multi()
765 do_forget(req, fuse, forgets[i].ino, forgets[i].nlookup); in pf_forget_multi()
767 fuse_reply_none(req); in pf_forget_multi()
770 static void pf_fallocate(fuse_req_t req, fuse_ino_t ino, int mode, off_t offset, off_t length, in pf_fallocate() argument
773 struct fuse* fuse = get_fuse(req); in pf_fallocate()
777 fuse_reply_err(req, err ? errno : 0); in pf_fallocate()
780 static void pf_getattr(fuse_req_t req, in pf_getattr() argument
784 struct fuse* fuse = get_fuse(req); in pf_getattr()
787 fuse_reply_err(req, ENOENT); in pf_getattr()
791 if (!is_app_accessible_path(fuse->mp, path, req->ctx.uid)) { in pf_getattr()
792 fuse_reply_err(req, ENOENT); in pf_getattr()
795 TRACE_NODE(node, req); in pf_getattr()
800 fuse_reply_err(req, errno); in pf_getattr()
802 fuse_reply_attr(req, &s, std::numeric_limits<double>::max()); in pf_getattr()
806 static void pf_setattr(fuse_req_t req, in pf_setattr() argument
812 struct fuse* fuse = get_fuse(req); in pf_setattr()
815 fuse_reply_err(req, ENOENT); in pf_setattr()
819 if (!is_app_accessible_path(fuse->mp, path, req->ctx.uid)) { in pf_setattr()
820 fuse_reply_err(req, ENOENT); in pf_setattr()
830 const struct fuse_ctx* ctx = fuse_req_ctx(req); in pf_setattr()
836 fuse_reply_err(req, EFAULT); in pf_setattr()
841 fuse_reply_err(req, EACCES); in pf_setattr()
846 TRACE_NODE(node, req); in pf_setattr()
860 fuse_reply_err(req, errno); in pf_setattr()
890 TRACE_NODE(node, req); in pf_setattr()
899 fuse_reply_err(req, errno); in pf_setattr()
905 fuse_reply_attr(req, attr, std::numeric_limits<double>::max()); in pf_setattr()
908 static void pf_canonical_path(fuse_req_t req, fuse_ino_t ino) in pf_canonical_path() argument
910 struct fuse* fuse = get_fuse(req); in pf_canonical_path()
914 if (node && is_app_accessible_path(fuse->mp, path, req->ctx.uid)) { in pf_canonical_path()
916 fuse_reply_canonical_path(req, path.c_str()); in pf_canonical_path()
919 fuse_reply_err(req, ENOENT); in pf_canonical_path()
922 static void pf_mknod(fuse_req_t req, in pf_mknod() argument
928 struct fuse* fuse = get_fuse(req); in pf_mknod()
931 fuse_reply_err(req, ENOENT); in pf_mknod()
935 if (!is_app_accessible_path(fuse->mp, parent_path, req->ctx.uid)) { in pf_mknod()
936 fuse_reply_err(req, ENOENT); in pf_mknod()
940 TRACE_NODE(parent_node, req); in pf_mknod()
946 fuse_reply_err(req, errno); in pf_mknod()
952 if (make_node_entry(req, parent_node, name, child_path, &e, &error_code, FuseOp::mknod)) { in pf_mknod()
953 fuse_reply_entry(req, &e); in pf_mknod()
956 fuse_reply_err(req, error_code); in pf_mknod()
960 static void pf_mkdir(fuse_req_t req, in pf_mkdir() argument
965 struct fuse* fuse = get_fuse(req); in pf_mkdir()
968 fuse_reply_err(req, ENOENT); in pf_mkdir()
971 const struct fuse_ctx* ctx = fuse_req_ctx(req); in pf_mkdir()
974 fuse_reply_err(req, ENOENT); in pf_mkdir()
978 TRACE_NODE(parent_node, req); in pf_mkdir()
984 fuse_reply_err(req, status); in pf_mkdir()
990 fuse_reply_err(req, errno); in pf_mkdir()
996 if (make_node_entry(req, parent_node, name, child_path, &e, &error_code, FuseOp::mkdir)) { in pf_mkdir()
997 fuse_reply_entry(req, &e); in pf_mkdir()
1000 fuse_reply_err(req, error_code); in pf_mkdir()
1004 static void pf_unlink(fuse_req_t req, fuse_ino_t parent, const char* name) { in pf_unlink() argument
1006 struct fuse* fuse = get_fuse(req); in pf_unlink()
1009 fuse_reply_err(req, ENOENT); in pf_unlink()
1012 const struct fuse_ctx* ctx = fuse_req_ctx(req); in pf_unlink()
1015 fuse_reply_err(req, ENOENT); in pf_unlink()
1019 TRACE_NODE(parent_node, req); in pf_unlink()
1025 fuse_reply_err(req, status); in pf_unlink()
1031 fuse_reply_err(req, 0); in pf_unlink()
1034 static void pf_rmdir(fuse_req_t req, fuse_ino_t parent, const char* name) { in pf_rmdir() argument
1036 struct fuse* fuse = get_fuse(req); in pf_rmdir()
1039 fuse_reply_err(req, ENOENT); in pf_rmdir()
1043 if (!is_app_accessible_path(fuse->mp, parent_path, req->ctx.uid)) { in pf_rmdir()
1044 fuse_reply_err(req, ENOENT); in pf_rmdir()
1051 fuse_reply_err(req, ENOENT); in pf_rmdir()
1055 TRACE_NODE(parent_node, req); in pf_rmdir()
1059 int status = fuse->mp->IsDeletingDirAllowed(child_path, req->ctx.uid); in pf_rmdir()
1061 fuse_reply_err(req, status); in pf_rmdir()
1066 fuse_reply_err(req, errno); in pf_rmdir()
1071 TRACE_NODE(child_node, req); in pf_rmdir()
1076 fuse_reply_err(req, 0); in pf_rmdir()
1085 static int do_rename(fuse_req_t req, fuse_ino_t parent, const char* name, fuse_ino_t new_parent, in do_rename() argument
1088 struct fuse* fuse = get_fuse(req); in do_rename()
1096 const struct fuse_ctx* ctx = fuse_req_ctx(req); in do_rename()
1122 TRACE_NODE(old_parent_node, req); in do_rename()
1123 TRACE_NODE(new_parent_node, req); in do_rename()
1134 const int res = fuse->mp->Rename(old_child_path, new_child_path, req->ctx.uid); in do_rename()
1144 static void pf_rename(fuse_req_t req, fuse_ino_t parent, const char* name, fuse_ino_t new_parent, in pf_rename() argument
1146 int res = do_rename(req, parent, name, new_parent, new_name, flags); in pf_rename()
1147 fuse_reply_err(req, res); in pf_rename()
1219 bool do_passthrough_enable(fuse_req_t req, struct fuse_file_info* fi, unsigned int fd) { in do_passthrough_enable() argument
1220 int passthrough_fh = fuse_passthrough_enable(req, fd); in do_passthrough_enable()
1230 static void pf_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { in pf_open() argument
1232 struct fuse* fuse = get_fuse(req); in pf_open()
1235 fuse_reply_err(req, ENOENT); in pf_open()
1238 const struct fuse_ctx* ctx = fuse_req_ctx(req); in pf_open()
1242 fuse_reply_err(req, ENOENT); in pf_open()
1249 TRACE_NODE(node, req) << "write with transforms"; in pf_open()
1251 TRACE_NODE(node, req) << (for_write ? "write" : "read"); in pf_open()
1266 fuse_reply_err(req, EFAULT); in pf_open()
1271 fuse_reply_err(req, result->status); in pf_open()
1289 fuse_reply_err(req, errno); in pf_open()
1304 if (!do_passthrough_enable(req, fi, fd)) { in pf_open()
1307 fuse_reply_err(req, EFAULT); in pf_open()
1312 fuse_reply_open(req, fi); in pf_open()
1315 static void do_read(fuse_req_t req, size_t size, off_t off, struct fuse_file_info* fi) { in do_read() argument
1324 fuse_reply_data(req, &buf, (enum fuse_buf_copy_flags) 0); in do_read()
1351 static void do_read_with_redaction(fuse_req_t req, size_t size, off_t off, fuse_file_info* fi) { in do_read_with_redaction() argument
1359 do_read(req, size, off, fi); in do_read_with_redaction()
1378 create_mem_fuse_buf(range.size, &(bufvec.buf[i]), get_fuse(req)); in do_read_with_redaction()
1384 fuse_reply_data(req, &bufvec, static_cast<fuse_buf_copy_flags>(0)); in do_read_with_redaction()
1387 static void pf_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, in pf_read() argument
1391 struct fuse* fuse = get_fuse(req); in pf_read()
1397 node->GetTransformsReason(), req->ctx.uid, h->uid, in pf_read()
1399 fuse_reply_err(req, EFAULT); in pf_read()
1408 do_read_with_redaction(req, size, off, fi); in pf_read()
1410 do_read(req, size, off, fi); in pf_read()
1422 static void pf_write_buf(fuse_req_t req, in pf_write_buf() argument
1431 struct fuse* fuse = get_fuse(req); in pf_write_buf()
1440 fuse_reply_err(req, -size); in pf_write_buf()
1445 fuse_reply_write(req, size); in pf_write_buf()
1450 static void pf_copy_file_range(fuse_req_t req, fuse_ino_t ino_in,
1472 fuse_reply_err(req, -size);
1475 fuse_reply_write(req, size);
1479 static void pf_release(fuse_req_t req, in pf_release() argument
1483 struct fuse* fuse = get_fuse(req); in pf_release()
1487 TRACE_NODE(node, req); in pf_release()
1494 fuse_reply_err(req, 0); in pf_release()
1504 static void pf_fsync(fuse_req_t req, in pf_fsync() argument
1512 fuse_reply_err(req, err); in pf_fsync()
1515 static void pf_fsyncdir(fuse_req_t req, in pf_fsyncdir() argument
1522 fuse_reply_err(req, err); in pf_fsyncdir()
1525 static void pf_opendir(fuse_req_t req, in pf_opendir() argument
1529 struct fuse* fuse = get_fuse(req); in pf_opendir()
1532 fuse_reply_err(req, ENOENT); in pf_opendir()
1535 const struct fuse_ctx* ctx = fuse_req_ctx(req); in pf_opendir()
1538 fuse_reply_err(req, ENOENT); in pf_opendir()
1542 TRACE_NODE(node, req); in pf_opendir()
1546 fuse_reply_err(req, status); in pf_opendir()
1552 fuse_reply_err(req, errno); in pf_opendir()
1560 fuse_reply_open(req, fi); in pf_opendir()
1565 static void do_readdir_common(fuse_req_t req, in do_readdir_common() argument
1571 struct fuse* fuse = get_fuse(req); in do_readdir_common()
1583 fuse_reply_err(req, ENOENT); in do_readdir_common()
1587 if (!is_app_accessible_path(fuse->mp, path, req->ctx.uid)) { in do_readdir_common()
1588 fuse_reply_err(req, ENOENT); in do_readdir_common()
1592 TRACE_NODE(node, req); in do_readdir_common()
1598 h->de = fuse->mp->GetDirectoryEntries(req->ctx.uid, path, h->d); in do_readdir_common()
1612 fuse_reply_err(req, h->de[0]->d_type); in do_readdir_common()
1622 if (do_lookup(req, ino, de->d_name.c_str(), &e, &error_code, FuseOp::readdir)) { in do_readdir_common()
1623 entry_size = fuse_add_direntry_plus(req, buf + used, len - used, de->d_name.c_str(), in do_readdir_common()
1631 fuse_reply_err(req, error_code); in do_readdir_common()
1640 entry_size = fuse_add_direntry(req, buf + used, len - used, de->d_name.c_str(), &e.attr, in do_readdir_common()
1651 do_forget(req, fuse, e.ino, 1); in do_readdir_common()
1657 fuse_reply_buf(req, buf, used); in do_readdir_common()
1660 static void pf_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, in pf_readdir() argument
1663 do_readdir_common(req, ino, size, off, fi, false); in pf_readdir()
1666 static void pf_readdirplus(fuse_req_t req, in pf_readdirplus() argument
1672 do_readdir_common(req, ino, size, off, fi, true); in pf_readdirplus()
1675 static void pf_releasedir(fuse_req_t req, in pf_releasedir() argument
1679 struct fuse* fuse = get_fuse(req); in pf_releasedir()
1684 TRACE_NODE(node, req); in pf_releasedir()
1689 fuse_reply_err(req, 0); in pf_releasedir()
1692 static void pf_statfs(fuse_req_t req, fuse_ino_t ino) { in pf_statfs() argument
1695 struct fuse* fuse = get_fuse(req); in pf_statfs()
1698 fuse_reply_err(req, errno); in pf_statfs()
1700 fuse_reply_statfs(req, &st); in pf_statfs()
1725 static void pf_access(fuse_req_t req, fuse_ino_t ino, int mask) { in pf_access() argument
1727 struct fuse* fuse = get_fuse(req); in pf_access()
1731 fuse_reply_err(req, ENOENT); in pf_access()
1735 if (path != "/storage/emulated" && !is_app_accessible_path(fuse->mp, path, req->ctx.uid)) { in pf_access()
1736 fuse_reply_err(req, ENOENT); in pf_access()
1739 TRACE_NODE(node, req); in pf_access()
1744 fuse_reply_err(req, res ? errno : 0); in pf_access()
1750 fuse_reply_err(req, ENOENT); in pf_access()
1763 fuse_reply_err(req, res ? errno : 0); in pf_access()
1766 status = fuse->mp->IsOpendirAllowed(path, req->ctx.uid, for_write); in pf_access()
1770 fuse_reply_err(req, EACCES); in pf_access()
1775 path, path, req->ctx.uid, req->ctx.pid, node->GetTransformsReason(), for_write, in pf_access()
1784 fuse_reply_err(req, status); in pf_access()
1787 static void pf_create(fuse_req_t req, in pf_create() argument
1793 struct fuse* fuse = get_fuse(req); in pf_create()
1796 fuse_reply_err(req, ENOENT); in pf_create()
1800 if (!is_app_accessible_path(fuse->mp, parent_path, req->ctx.uid)) { in pf_create()
1801 fuse_reply_err(req, ENOENT); in pf_create()
1805 TRACE_NODE(parent_node, req); in pf_create()
1809 int mp_return_code = fuse->mp->InsertFile(child_path.c_str(), req->ctx.uid); in pf_create()
1811 fuse_reply_err(req, mp_return_code); in pf_create()
1833 fuse->mp->DeleteFile(child_path.c_str(), req->ctx.uid); in pf_create()
1834 fuse_reply_err(req, error_code); in pf_create()
1841 make_node_entry(req, parent_node, name, child_path, &e, &error_code, FuseOp::create); in pf_create()
1842 TRACE_NODE(node, req); in pf_create()
1845 fuse_reply_err(req, error_code); in pf_create()
1857 handle* h = create_handle_for_node(fuse, child_path, fd, req->ctx.uid, 0 /* transforms_uid */, in pf_create()
1867 if (!do_passthrough_enable(req, fi, fd)) { in pf_create()
1869 fuse_reply_err(req, EFAULT); in pf_create()
1874 fuse_reply_create(req, &e, fi); in pf_create()