fuse_ipc.h (18b18078f267ba10cf14348bc333f2f81818f472) | fuse_ipc.h (7e4844f7d9546ba65202fbe834d1c06aa72a37b8) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2007-2009 Google Inc. and Amit Singh 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are --- 122 unchanged lines hidden (view full) --- 131fticket_resp(struct fuse_ticket *ftick) 132{ 133 return (&ftick->tk_aw_fiov); 134} 135 136static inline bool 137fticket_answered(struct fuse_ticket *ftick) 138{ | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2007-2009 Google Inc. and Amit Singh 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are --- 122 unchanged lines hidden (view full) --- 131fticket_resp(struct fuse_ticket *ftick) 132{ 133 return (&ftick->tk_aw_fiov); 134} 135 136static inline bool 137fticket_answered(struct fuse_ticket *ftick) 138{ |
139 DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick); | |
140 mtx_assert(&ftick->tk_aw_mtx, MA_OWNED); 141 return (ftick->tk_flag & FT_ANSW); 142} 143 144static inline void 145fticket_set_answered(struct fuse_ticket *ftick) 146{ | 139 mtx_assert(&ftick->tk_aw_mtx, MA_OWNED); 140 return (ftick->tk_flag & FT_ANSW); 141} 142 143static inline void 144fticket_set_answered(struct fuse_ticket *ftick) 145{ |
147 DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick); | |
148 mtx_assert(&ftick->tk_aw_mtx, MA_OWNED); 149 ftick->tk_flag |= FT_ANSW; 150} 151 152static inline enum fuse_opcode 153fticket_opcode(struct fuse_ticket *ftick) 154{ | 146 mtx_assert(&ftick->tk_aw_mtx, MA_OWNED); 147 ftick->tk_flag |= FT_ANSW; 148} 149 150static inline enum fuse_opcode 151fticket_opcode(struct fuse_ticket *ftick) 152{ |
155 DEBUGX(FUSE_DEBUG_IPC, "-> ftick=%p\n", ftick); | |
156 return (((struct fuse_in_header *)(ftick->tk_ms_fiov.base))->opcode); 157} 158 159int fticket_pull(struct fuse_ticket *ftick, struct uio *uio); 160 161enum mountpri { FM_NOMOUNTED, FM_PRIMARY, FM_SECONDARY }; 162 163/* --- 104 unchanged lines hidden (view full) --- 268 struct fuse_data *data = fuse_get_mpdata(mp); 269 270 return (fuse_fix_broken_io || (data->dataflags & FSESS_BROKENIO)); 271} 272 273static inline void 274fuse_ms_push(struct fuse_ticket *ftick) 275{ | 153 return (((struct fuse_in_header *)(ftick->tk_ms_fiov.base))->opcode); 154} 155 156int fticket_pull(struct fuse_ticket *ftick, struct uio *uio); 157 158enum mountpri { FM_NOMOUNTED, FM_PRIMARY, FM_SECONDARY }; 159 160/* --- 104 unchanged lines hidden (view full) --- 265 struct fuse_data *data = fuse_get_mpdata(mp); 266 267 return (fuse_fix_broken_io || (data->dataflags & FSESS_BROKENIO)); 268} 269 270static inline void 271fuse_ms_push(struct fuse_ticket *ftick) 272{ |
276 DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick, 277 ftick->tk_refcount + 1); | |
278 mtx_assert(&ftick->tk_data->ms_mtx, MA_OWNED); 279 refcount_acquire(&ftick->tk_refcount); 280 STAILQ_INSERT_TAIL(&ftick->tk_data->ms_head, ftick, tk_ms_link); 281} 282 283static inline struct fuse_ticket * 284fuse_ms_pop(struct fuse_data *data) 285{ 286 struct fuse_ticket *ftick = NULL; 287 288 mtx_assert(&data->ms_mtx, MA_OWNED); 289 290 if ((ftick = STAILQ_FIRST(&data->ms_head))) { 291 STAILQ_REMOVE_HEAD(&data->ms_head, tk_ms_link); 292#ifdef INVARIANTS 293 ftick->tk_ms_link.stqe_next = NULL; 294#endif 295 } | 273 mtx_assert(&ftick->tk_data->ms_mtx, MA_OWNED); 274 refcount_acquire(&ftick->tk_refcount); 275 STAILQ_INSERT_TAIL(&ftick->tk_data->ms_head, ftick, tk_ms_link); 276} 277 278static inline struct fuse_ticket * 279fuse_ms_pop(struct fuse_data *data) 280{ 281 struct fuse_ticket *ftick = NULL; 282 283 mtx_assert(&data->ms_mtx, MA_OWNED); 284 285 if ((ftick = STAILQ_FIRST(&data->ms_head))) { 286 STAILQ_REMOVE_HEAD(&data->ms_head, tk_ms_link); 287#ifdef INVARIANTS 288 ftick->tk_ms_link.stqe_next = NULL; 289#endif 290 } |
296 DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick, 297 ftick ? ftick->tk_refcount : -1); | |
298 299 return (ftick); 300} 301 302static inline void 303fuse_aw_push(struct fuse_ticket *ftick) 304{ | 291 292 return (ftick); 293} 294 295static inline void 296fuse_aw_push(struct fuse_ticket *ftick) 297{ |
305 DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick, 306 ftick->tk_refcount + 1); | |
307 mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED); 308 refcount_acquire(&ftick->tk_refcount); 309 TAILQ_INSERT_TAIL(&ftick->tk_data->aw_head, ftick, tk_aw_link); 310} 311 312static inline void 313fuse_aw_remove(struct fuse_ticket *ftick) 314{ | 298 mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED); 299 refcount_acquire(&ftick->tk_refcount); 300 TAILQ_INSERT_TAIL(&ftick->tk_data->aw_head, ftick, tk_aw_link); 301} 302 303static inline void 304fuse_aw_remove(struct fuse_ticket *ftick) 305{ |
315 DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", 316 ftick, ftick->tk_refcount); | |
317 mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED); 318 TAILQ_REMOVE(&ftick->tk_data->aw_head, ftick, tk_aw_link); 319#ifdef INVARIANTS 320 ftick->tk_aw_link.tqe_next = NULL; 321 ftick->tk_aw_link.tqe_prev = NULL; 322#endif 323} 324 325static inline struct fuse_ticket * 326fuse_aw_pop(struct fuse_data *data) 327{ 328 struct fuse_ticket *ftick; 329 330 mtx_assert(&data->aw_mtx, MA_OWNED); 331 332 if ((ftick = TAILQ_FIRST(&data->aw_head)) != NULL) 333 fuse_aw_remove(ftick); | 306 mtx_assert(&ftick->tk_data->aw_mtx, MA_OWNED); 307 TAILQ_REMOVE(&ftick->tk_data->aw_head, ftick, tk_aw_link); 308#ifdef INVARIANTS 309 ftick->tk_aw_link.tqe_next = NULL; 310 ftick->tk_aw_link.tqe_prev = NULL; 311#endif 312} 313 314static inline struct fuse_ticket * 315fuse_aw_pop(struct fuse_data *data) 316{ 317 struct fuse_ticket *ftick; 318 319 mtx_assert(&data->aw_mtx, MA_OWNED); 320 321 if ((ftick = TAILQ_FIRST(&data->aw_head)) != NULL) 322 fuse_aw_remove(ftick); |
334 DEBUGX(FUSE_DEBUG_IPC, "ftick=%p refcount=%d\n", ftick, 335 ftick ? ftick->tk_refcount : -1); | |
336 337 return (ftick); 338} 339 340struct fuse_ticket *fuse_ticket_fetch(struct fuse_data *data); 341int fuse_ticket_drop(struct fuse_ticket *ftick); 342void fuse_insert_callback(struct fuse_ticket *ftick, fuse_handler_t *handler); 343void fuse_insert_message(struct fuse_ticket *ftick); --- 25 unchanged lines hidden (view full) --- 369 uint64_t nodeid; 370 int answ_stat; 371 void *answ; 372}; 373 374static inline void 375fdisp_init(struct fuse_dispatcher *fdisp, size_t iosize) 376{ | 323 324 return (ftick); 325} 326 327struct fuse_ticket *fuse_ticket_fetch(struct fuse_data *data); 328int fuse_ticket_drop(struct fuse_ticket *ftick); 329void fuse_insert_callback(struct fuse_ticket *ftick, fuse_handler_t *handler); 330void fuse_insert_message(struct fuse_ticket *ftick); --- 25 unchanged lines hidden (view full) --- 356 uint64_t nodeid; 357 int answ_stat; 358 void *answ; 359}; 360 361static inline void 362fdisp_init(struct fuse_dispatcher *fdisp, size_t iosize) 363{ |
377 DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, iosize=%zx\n", fdisp, iosize); | |
378 fdisp->iosize = iosize; 379 fdisp->tick = NULL; 380} 381 382static inline void 383fdisp_destroy(struct fuse_dispatcher *fdisp) 384{ | 364 fdisp->iosize = iosize; 365 fdisp->tick = NULL; 366} 367 368static inline void 369fdisp_destroy(struct fuse_dispatcher *fdisp) 370{ |
385 DEBUGX(FUSE_DEBUG_IPC, "-> fdisp=%p, ftick=%p\n", fdisp, fdisp->tick); | |
386 fuse_ticket_drop(fdisp->tick); 387#ifdef INVARIANTS 388 fdisp->tick = NULL; 389#endif 390} 391 392void fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op, 393 struct mount *mp, uint64_t nid, struct thread *td, struct ucred *cred); --- 5 unchanged lines hidden (view full) --- 399 struct vnode *vp, struct thread *td, struct ucred *cred); 400 401int fdisp_wait_answ(struct fuse_dispatcher *fdip); 402 403static inline int 404fdisp_simple_putget_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op, 405 struct vnode *vp, struct thread *td, struct ucred *cred) 406{ | 371 fuse_ticket_drop(fdisp->tick); 372#ifdef INVARIANTS 373 fdisp->tick = NULL; 374#endif 375} 376 377void fdisp_make(struct fuse_dispatcher *fdip, enum fuse_opcode op, 378 struct mount *mp, uint64_t nid, struct thread *td, struct ucred *cred); --- 5 unchanged lines hidden (view full) --- 384 struct vnode *vp, struct thread *td, struct ucred *cred); 385 386int fdisp_wait_answ(struct fuse_dispatcher *fdip); 387 388static inline int 389fdisp_simple_putget_vp(struct fuse_dispatcher *fdip, enum fuse_opcode op, 390 struct vnode *vp, struct thread *td, struct ucred *cred) 391{ |
407 DEBUGX(FUSE_DEBUG_IPC, "-> fdip=%p, opcode=%d, vp=%p\n", fdip, op, vp); | |
408 fdisp_make_vp(fdip, op, vp, td, cred); 409 return (fdisp_wait_answ(fdip)); 410} 411 412#endif /* _FUSE_IPC_H_ */ | 392 fdisp_make_vp(fdip, op, vp, td, cred); 393 return (fdisp_wait_answ(fdip)); 394} 395 396#endif /* _FUSE_IPC_H_ */ |