1 /* 2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net> 3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> 4 */ 5 mog_fd_of(void * as_obj)6static inline struct mog_fd * mog_fd_of(void *as_obj) 7 { 8 uintptr_t as_addr = (uintptr_t)as_obj; 9 10 return (struct mog_fd *)(as_addr - offsetof(struct mog_fd, as)); 11 } 12 13 14 /* used to validate a mog_fd is never in two queues at once */ mog_fd_check_in(struct mog_fd * mfd)15static inline void mog_fd_check_in(struct mog_fd *mfd) 16 { 17 /* currently unused */ 18 } 19 20 /* used to validate a mog_fd is never in two queues at once */ mog_fd_check_out(struct mog_fd * mfd)21static inline void mog_fd_check_out(struct mog_fd *mfd) 22 { 23 /* currently unused */ 24 } 25 26 struct mog_fd * mog_fd_init(int fd, enum mog_fd_type fd_type); 27