… | |
… | |
366 | #define ETP_PRI_MAX EIO_PRI_MAX |
366 | #define ETP_PRI_MAX EIO_PRI_MAX |
367 | |
367 | |
368 | #define ETP_TYPE_QUIT -1 |
368 | #define ETP_TYPE_QUIT -1 |
369 | #define ETP_TYPE_GROUP EIO_GROUP |
369 | #define ETP_TYPE_GROUP EIO_GROUP |
370 | |
370 | |
|
|
371 | static void eio_nop_callback (void) { } |
|
|
372 | static void (*eio_want_poll_cb)(void) = eio_nop_callback; |
|
|
373 | static void (*eio_done_poll_cb)(void) = eio_nop_callback; |
|
|
374 | |
|
|
375 | #define ETP_WANT_POLL(pool) eio_want_poll_cb () |
|
|
376 | #define ETP_DONE_POLL(pool) eio_done_poll_cb () |
|
|
377 | |
371 | struct etp_worker; |
378 | struct etp_worker; |
372 | |
|
|
373 | #define ETP_REQ eio_req |
379 | #define ETP_REQ eio_req |
374 | #define ETP_DESTROY(req) eio_destroy (req) |
380 | #define ETP_DESTROY(req) eio_destroy (req) |
375 | static int eio_finish (eio_req *req); |
381 | static int eio_finish (eio_req *req); |
376 | #define ETP_FINISH(req) eio_finish (req) |
382 | #define ETP_FINISH(req) eio_finish (req) |
377 | static void eio_execute (struct etp_worker *self, eio_req *req); |
383 | static void eio_execute (struct etp_worker *self, eio_req *req); |
… | |
… | |
1706 | /*****************************************************************************/ |
1712 | /*****************************************************************************/ |
1707 | |
1713 | |
1708 | #define ALLOC(len) \ |
1714 | #define ALLOC(len) \ |
1709 | if (!req->ptr2) \ |
1715 | if (!req->ptr2) \ |
1710 | { \ |
1716 | { \ |
1711 | X_LOCK (wrklock); \ |
1717 | X_LOCK (EIO_POOL->wrklock); \ |
1712 | req->flags |= EIO_FLAG_PTR2_FREE; \ |
1718 | req->flags |= EIO_FLAG_PTR2_FREE; \ |
1713 | X_UNLOCK (wrklock); \ |
1719 | X_UNLOCK (EIO_POOL->wrklock); \ |
1714 | req->ptr2 = malloc (len); \ |
1720 | req->ptr2 = malloc (len); \ |
1715 | if (!req->ptr2) \ |
1721 | if (!req->ptr2) \ |
1716 | { \ |
1722 | { \ |
1717 | errno = ENOMEM; \ |
1723 | errno = ENOMEM; \ |
1718 | req->result = -1; \ |
1724 | req->result = -1; \ |
… | |
… | |
1723 | /*****************************************************************************/ |
1729 | /*****************************************************************************/ |
1724 | |
1730 | |
1725 | int ecb_cold |
1731 | int ecb_cold |
1726 | eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1732 | eio_init (void (*want_poll)(void), void (*done_poll)(void)) |
1727 | { |
1733 | { |
|
|
1734 | eio_want_poll_cb = want_poll; |
|
|
1735 | eio_done_poll_cb = done_poll; |
|
|
1736 | |
1728 | return etp_init (EIO_POOL, want_poll, done_poll); |
1737 | return etp_init (EIO_POOL, 0, 0); |
1729 | } |
1738 | } |
1730 | |
1739 | |
1731 | ecb_inline void |
1740 | ecb_inline void |
1732 | eio_api_destroy (eio_req *req) |
1741 | eio_api_destroy (eio_req *req) |
1733 | { |
1742 | { |