8 /* main peer structs */
11 struct xseg_request *req;
25 uint32_t defer_portno;
26 struct peer_req *peer_reqs;
31 struct thread *thread;
33 void (*interactive_func)(void);
37 enum dispatch_reason {
43 void fail(struct peerd *peer, struct peer_req *pr);
44 void complete(struct peerd *peer, struct peer_req *pr);
45 void defer_request(struct peerd *peer, struct peer_req *pr);
46 void pending(struct peerd *peer, struct peer_req *req);
47 void log_pr(char *msg, struct peer_req *pr);
48 int canDefer(struct peerd *peer);
49 int submit_peer_req(struct peerd *peer, struct peer_req *pr);
50 struct peer_req *alloc_peer_req(struct peerd *peer);
51 void free_peer_req(struct peerd *peer, struct peer_req *pr);
52 void get_submits_stats();
53 void get_responds_stats();
56 int thread_execute(struct peerd *peer, void (*func)(void *arg), void *arg);
59 static inline struct peerd * __get_peerd(void * custom_peerd)
61 return (struct peerd *) ((unsigned long) custom_peerd - offsetof(struct peerd, priv));
64 /********************************
65 * mandatory peer functions *
66 ********************************/
68 /* peer main function */
69 int custom_peer_init(struct peerd *peer, int argc, char *argv[]);
71 /* dispatch function */
72 int dispatch(struct peerd *peer, struct peer_req *pr, struct xseg_request *xseg,
73 enum dispatch_reason reason);