Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/fuse/fuse_ipc.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
SDT_PROBE_DEFINE2(fusefs, , ipc, trace, "int", "char*"); | SDT_PROBE_DEFINE2(fusefs, , ipc, trace, "int", "char*"); | ||||
static void fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op, | static void fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse_opcode op, | ||||
struct fuse_data *data, uint64_t nid, pid_t pid, struct ucred *cred); | struct fuse_data *data, uint64_t nid, pid_t pid, struct ucred *cred); | ||||
static void fuse_interrupt_send(struct fuse_ticket *otick, int err); | static void fuse_interrupt_send(struct fuse_ticket *otick, int err); | ||||
static struct fuse_ticket *fticket_alloc(struct fuse_data *data); | static struct fuse_ticket *fticket_alloc(struct fuse_data *data); | ||||
static void fticket_refresh(struct fuse_ticket *ftick); | static void fticket_refresh(struct fuse_ticket *ftick); | ||||
static inline void fticket_reset(struct fuse_ticket *ftick); | |||||
static void fticket_destroy(struct fuse_ticket *ftick); | static void fticket_destroy(struct fuse_ticket *ftick); | ||||
static int fticket_wait_answer(struct fuse_ticket *ftick); | static int fticket_wait_answer(struct fuse_ticket *ftick); | ||||
static inline int | static inline int | ||||
fticket_aw_pull_uio(struct fuse_ticket *ftick, | fticket_aw_pull_uio(struct fuse_ticket *ftick, | ||||
struct uio *uio); | struct uio *uio); | ||||
static int fuse_body_audit(struct fuse_ticket *ftick, size_t blen); | static int fuse_body_audit(struct fuse_ticket *ftick, size_t blen); | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct fuse_ticket *ftick = mem; | struct fuse_ticket *ftick = mem; | ||||
struct fuse_data *data = arg; | struct fuse_data *data = arg; | ||||
FUSE_ASSERT_MS_DONE(ftick); | FUSE_ASSERT_MS_DONE(ftick); | ||||
FUSE_ASSERT_AW_DONE(ftick); | FUSE_ASSERT_AW_DONE(ftick); | ||||
ftick->tk_data = data; | ftick->tk_data = data; | ||||
if (ftick->tk_unique != 0) | |||||
fticket_refresh(ftick); | |||||
/* May be truncated to 32 bits */ | |||||
ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); | |||||
if (ftick->tk_unique == 0) | |||||
ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); | |||||
ftick->irq_unique = 0; | ftick->irq_unique = 0; | ||||
refcount_init(&ftick->tk_refcount, 1); | refcount_init(&ftick->tk_refcount, 1); | ||||
counter_u64_add(fuse_ticket_count, 1); | counter_u64_add(fuse_ticket_count, 1); | ||||
fticket_refresh(ftick); | |||||
return 0; | return 0; | ||||
} | } | ||||
static void | static void | ||||
fticket_dtor(void *mem, int size, void *arg) | fticket_dtor(void *mem, int size, void *arg) | ||||
{ | { | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
struct fuse_ticket *ftick = mem; | struct fuse_ticket *ftick = mem; | ||||
Show All 37 Lines | |||||
} | } | ||||
static inline void | static inline void | ||||
fticket_destroy(struct fuse_ticket *ftick) | fticket_destroy(struct fuse_ticket *ftick) | ||||
{ | { | ||||
return uma_zfree(ticket_zone, ftick); | return uma_zfree(ticket_zone, ftick); | ||||
} | } | ||||
static inline | /* Prepare the ticket to be reused and clear its data buffers */ | ||||
void | static inline void | ||||
fticket_refresh(struct fuse_ticket *ftick) | fticket_refresh(struct fuse_ticket *ftick) | ||||
{ | { | ||||
FUSE_ASSERT_MS_DONE(ftick); | fticket_reset(ftick); | ||||
FUSE_ASSERT_AW_DONE(ftick); | |||||
fiov_refresh(&ftick->tk_ms_fiov); | fiov_refresh(&ftick->tk_ms_fiov); | ||||
bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); | |||||
fiov_refresh(&ftick->tk_aw_fiov); | fiov_refresh(&ftick->tk_aw_fiov); | ||||
ftick->tk_aw_errno = 0; | |||||
ftick->tk_flag = 0; | |||||
} | } | ||||
/* Prepar the ticket to be reused, but don't clear its data buffers */ | /* Prepare the ticket to be reused, but don't clear its data buffers */ | ||||
static inline void | static inline void | ||||
fticket_reset(struct fuse_ticket *ftick) | fticket_reset(struct fuse_ticket *ftick) | ||||
{ | { | ||||
struct fuse_data *data = ftick->tk_data; | |||||
FUSE_ASSERT_MS_DONE(ftick); | FUSE_ASSERT_MS_DONE(ftick); | ||||
FUSE_ASSERT_AW_DONE(ftick); | FUSE_ASSERT_AW_DONE(ftick); | ||||
bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); | bzero(&ftick->tk_aw_ohead, sizeof(struct fuse_out_header)); | ||||
ftick->tk_aw_errno = 0; | ftick->tk_aw_errno = 0; | ||||
ftick->tk_flag = 0; | ftick->tk_flag = 0; | ||||
/* May be truncated to 32 bits on LP32 arches */ | |||||
ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); | |||||
if (ftick->tk_unique == 0) | |||||
ftick->tk_unique = atomic_fetchadd_long(&data->ticketer, 1); | |||||
} | } | ||||
static int | static int | ||||
fticket_wait_answer(struct fuse_ticket *ftick) | fticket_wait_answer(struct fuse_ticket *ftick) | ||||
{ | { | ||||
struct thread *td = curthread; | struct thread *td = curthread; | ||||
sigset_t blockedset, oldset; | sigset_t blockedset, oldset; | ||||
int err = 0, stops_deferred; | int err = 0, stops_deferred; | ||||
▲ Show 20 Lines • Show All 661 Lines • Show Last 20 Lines |