19 #ifndef _ALCHEMY_INTERNAL_H 20 #define _ALCHEMY_INTERNAL_H 22 #include "boilerplate/ancillaries.h" 23 #include "boilerplate/namegen.h" 26 #define DEFINE_SYNC_LOOKUP(__name, __dsctype) \ 27 static inline struct alchemy_ ## __name * \ 28 get_alchemy_ ## __name(__dsctype *desc, \ 29 struct syncstate *syns, int *err_r) \ 31 struct alchemy_ ## __name *cb; \ 33 if (bad_pointer(desc)) { \ 38 cb = mainheap_deref(desc->handle, struct alchemy_ ## __name); \ 39 if (bad_pointer(cb)) { \ 44 if (syncobj_lock(&cb->sobj, syns) || \ 45 cb->magic != __name ## _magic) { \ 54 void put_alchemy_ ## __name(struct alchemy_ ## __name *cb, \ 55 struct syncstate *syns) \ 57 syncobj_unlock(&cb->sobj, syns); \ 60 #define __DEFINE_LOOKUP(__scope, __name, __dsctype) \ 61 __scope struct alchemy_ ## __name * \ 62 find_alchemy_ ## __name(__dsctype *desc, int *err_r) \ 64 struct alchemy_ ## __name *cb; \ 66 if (bad_pointer(desc)) { \ 71 cb = mainheap_deref(desc->handle, struct alchemy_ ## __name); \ 72 if (bad_pointer(cb) || cb->magic != __name ## _magic) { \ 80 #define DEFINE_LOOKUP_PRIVATE(__name, __dsctype) \ 81 __DEFINE_LOOKUP(static inline, __name, __dsctype) 83 #define DEFINE_LOOKUP(__name, __dsctype) \ 84 __DEFINE_LOOKUP(, __name, __dsctype) 88 int alchemy_bind_object(
const char *name,
struct syncluster *sc,