19 #ifndef _ALCHEMY_INTERNAL_H 20 #define _ALCHEMY_INTERNAL_H 22 #include "boilerplate/ancillaries.h" 25 #define DEFINE_SYNC_LOOKUP(__name, __dsctype) \ 26 static inline struct alchemy_ ## __name * \ 27 get_alchemy_ ## __name(__dsctype *desc, \ 28 struct syncstate *syns, int *err_r) \ 30 struct alchemy_ ## __name *cb; \ 32 if (bad_pointer(desc)) { \ 37 cb = mainheap_deref(desc->handle, struct alchemy_ ## __name); \ 38 if (bad_pointer(cb)) { \ 43 if (syncobj_lock(&cb->sobj, syns) || \ 44 cb->magic != __name ## _magic) { \ 53 void put_alchemy_ ## __name(struct alchemy_ ## __name *cb, \ 54 struct syncstate *syns) \ 56 syncobj_unlock(&cb->sobj, syns); \ 59 #define __DEFINE_LOOKUP(__scope, __name, __dsctype) \ 60 __scope struct alchemy_ ## __name * \ 61 find_alchemy_ ## __name(__dsctype *desc, int *err_r) \ 63 struct alchemy_ ## __name *cb; \ 65 if (bad_pointer(desc)) { \ 70 cb = mainheap_deref(desc->handle, struct alchemy_ ## __name); \ 71 if (bad_pointer(cb) || cb->magic != __name ## _magic) { \ 79 #define DEFINE_LOOKUP_PRIVATE(__name, __dsctype) \ 80 __DEFINE_LOOKUP(static inline, __name, __dsctype) 82 #define DEFINE_LOOKUP(__name, __dsctype) \ 83 __DEFINE_LOOKUP(, __name, __dsctype) 87 int alchemy_bind_object(
const char *name,
struct syncluster *sc,