![]() |
00001 #if CONFIG_BUS_MODE == BUS_ARBITRATOR 00002 00003 void post_office(struct socket *so); 00004 void hll_arbdev_init(void); 00005 00006 struct nodeinfo{ 00007 struct request_bind personality; 00008 }; 00009 00010 #ifdef CONFIG_USE_MALLOC 00011 # include "trie.h" 00012 extern struct trienode nodeinfo_byId; 00013 typedef struct trie_iterator nodeinfo_iterator; 00014 #else 00015 extern struct nodeinfo nodeinfo_byId[254]; 00016 typedef struct{u8 index;} nodeinfo_iterator; 00017 #endif 00018 00019 #ifdef CONFIG_USE_MALLOC 00020 00021 inline struct nodeinfo * 00022 nodeinfo_lookup(u8 index){ 00023 return trie_lookup(&nodeinfo_byId, index); 00024 } 00025 00026 inline struct nodeinfo * 00027 nodeinfo_iterate(nodeinfo_iterator *it){ 00028 return trie_iterate(it); 00029 } 00030 00031 inline struct nodeinfo * 00032 nodeinfo_iterator_begin(nodeinfo_iterator *it, index_t index){ 00033 return trie_iterator_begin(it, &nodeinfo_byId, index); 00034 } 00035 00036 #else 00037 00038 inline struct nodeinfo * 00039 nodeinfo_lookup(u8 index){ 00040 struct nodeinfo *node = &nodeinfo_byId[index-1]; 00041 return ( 00042 node->personality.vendor_id == ~0 && 00043 node->personality.product_id == ~0 && 00044 node->personality.serial_number == ~0 00045 ) ? NULL : node; 00046 } 00047 00048 inline struct nodeinfo * 00049 nodeinfo_iterate(nodeinfo_iterator *it){ 00050 while(it->index--){ 00051 struct nodeinfo *ret = nodeinfo_lookup(it->index); 00052 if(ret) return ret; 00053 } 00054 return NULL; 00055 } 00056 00057 inline struct nodeinfo * 00058 nodeinfo_iterator_begin(nodeinfo_iterator *it, u8 index){ 00059 it->index = index+1; 00060 return nodeinfo_iterate(it); 00061 } 00062 00063 inline void 00064 nodeinfo_setUnused(struct nodeinfo *node){ 00065 node->personality.vendor_id = ~0; 00066 node->personality.product_id = ~0; 00067 node->personality.serial_number = ~0; 00068 } 00069 00070 #endif 00071 00072 00073 #endif