/* * Returns vhost_device_ctx from given fuse_req_t. The index is populated later * when the device is added to the device linked list. */ static struct vhost_device_ctx fuse_req_to_vhost_ctx(fuse_req_t req, struct fuse_file_info *fi) { struct vhost_device_ctx ctx; struct fuse_ctx const *const req_ctx = fuse_req_ctx(req); ctx.pid = req_ctx->pid; ctx.fh = fi->fh; return ctx; }
static int blockstore_check_access(fuse_req_t req, fuse_ino_t ino, mode_t mode, struct stat *stbuf){ if (blockstore_stat(ino, stbuf) < 0) { fuse_reply_err(req, ENOENT); return -1; } const struct fuse_ctx *fc = fuse_req_ctx(req); mode_t mode2; if (fc->uid == stbuf->st_uid) { mode2 = (stbuf->st_mode >> 6) & 0x7; }
void rozofs_ll_create_nb(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi) { ientry_t *ie = 0; const struct fuse_ctx *ctx; ctx = fuse_req_ctx(req); epgw_mknod_arg_t arg; int ret; void *buffer_p = NULL; int trc_idx = rozofs_trc_req_name(srv_rozofs_ll_create,parent,(char*)name); /* ** allocate a context for saving the fuse parameters */ buffer_p = rozofs_fuse_alloc_saved_context(); if (buffer_p == NULL) { severe("out of fuse saved context"); errno = ENOMEM; goto error; } SAVE_FUSE_PARAM(buffer_p,req); SAVE_FUSE_PARAM(buffer_p,parent); SAVE_FUSE_STRING(buffer_p,name); SAVE_FUSE_PARAM(buffer_p,mode); SAVE_FUSE_PARAM(buffer_p,trc_idx); SAVE_FUSE_STRUCT(buffer_p,fi,sizeof( struct fuse_file_info)); START_PROFILING_NB(buffer_p,rozofs_ll_create); DEBUG("create (%lu,%s,%04o)\n", (unsigned long int) parent, name, (unsigned int) mode); if (strlen(name) > ROZOFS_FILENAME_MAX) { errno = ENAMETOOLONG; goto error; } if (!(ie = get_ientry_by_inode(parent))) { errno = ENOENT; goto error; } /* ** fill up the structure that will be used for creating the xdr message */ arg.arg_gw.eid = exportclt.eid; memcpy(arg.arg_gw.parent,ie->fid, sizeof (uuid_t)); arg.arg_gw.name = (char*)name; arg.arg_gw.uid = ctx->uid; arg.arg_gw.gid = ctx->gid; arg.arg_gw.mode = mode; /* ** now initiates the transaction towards the remote end */ #if 1 ret = rozofs_expgateway_send_routing_common(arg.arg_gw.eid,ie->fid,EXPORT_PROGRAM, EXPORT_VERSION, EP_MKNOD,(xdrproc_t) xdr_epgw_mknod_arg_t,(void *)&arg, rozofs_ll_create_cbk,buffer_p); #else ret = rozofs_export_send_common(&exportclt,EXPORT_PROGRAM, EXPORT_VERSION, EP_MKNOD,(xdrproc_t) xdr_epgw_mknod_arg_t,(void *)&arg, rozofs_ll_create_cbk,buffer_p); #endif if (ret < 0) goto error; /* ** no error just waiting for the answer */ return; error: fuse_reply_err(req, errno); rozofs_trc_rsp(srv_rozofs_ll_create,parent,NULL,1,trc_idx); STOP_PROFILING_NB(buffer_p,rozofs_ll_create); if (buffer_p != NULL) rozofs_fuse_release_saved_context(buffer_p); return; }
/* DANGER: depends on internals of PVFS struct * FIXME should this use PVFS_util_gen_credentials()? */ static void gen_credentials(PVFS_credentials *credentials, fuse_req_t req) { credentials->uid = fuse_req_ctx(req)->uid; credentials->gid = fuse_req_ctx(req)->gid; }
const struct fuse_ctx *fuse_req_ctx_compat24(fuse_req_t req) { return fuse_req_ctx(req); }