1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

tevent: use TEVENT_FD_* instead of EVENT_FD_*

metze
This commit is contained in:
Stefan Metzmacher 2009-01-02 16:25:29 +01:00
parent 4f04b06ac2
commit 784b2dc8d0
4 changed files with 43 additions and 43 deletions

View File

@ -80,8 +80,8 @@ struct tevent_aio {
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@ -148,7 +148,7 @@ static void epoll_add_event(struct aio_event_context *aio_ev, struct tevent_fd *
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -193,7 +193,7 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd *
epoll_ctl(aio_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event);
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -201,8 +201,8 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd *
static void epoll_change_event(struct aio_event_context *aio_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
bool want_write= (fde->flags & EVENT_FD_WRITE);
bool want_read = (fde->flags & TEVENT_FD_READ);
bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (aio_ev->epoll_fd == -1) return;
@ -328,10 +328,10 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval
epoll_del_event(aio_ev, fde);
continue;
}
flags |= EVENT_FD_READ;
flags |= TEVENT_FD_READ;
}
if (ep->events & EPOLLIN) flags |= EVENT_FD_READ;
if (ep->events & EPOLLOUT) flags |= EVENT_FD_WRITE;
if (ep->events & EPOLLIN) flags |= TEVENT_FD_READ;
if (ep->events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(aio_ev->ev, fde, flags, fde->private_data);
}
@ -400,7 +400,7 @@ static int aio_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(aio_ev, fde);
if (fde->flags & EVENT_FD_AUTOCLOSE) {
if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}

View File

@ -64,13 +64,13 @@ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason
}
/*
map from EVENT_FD_* to EPOLLIN/EPOLLOUT
map from TEVENT_FD_* to EPOLLIN/EPOLLOUT
*/
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@ -153,7 +153,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -201,7 +201,7 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_
}
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -209,8 +209,8 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_
static void epoll_change_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
bool want_write= (fde->flags & EVENT_FD_WRITE);
bool want_read = (fde->flags & TEVENT_FD_READ);
bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (epoll_ev->epoll_fd == -1) return;
@ -293,7 +293,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
if (events[i].events & (EPOLLHUP|EPOLLERR)) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR;
/*
* if we only wait for EVENT_FD_WRITE, we should not tell the
* if we only wait for TEVENT_FD_WRITE, we should not tell the
* event handler about it, and remove the epoll_event,
* as we only report errors when waiting for read events,
* to match the select() behavior
@ -302,10 +302,10 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
epoll_del_event(epoll_ev, fde);
continue;
}
flags |= EVENT_FD_READ;
flags |= TEVENT_FD_READ;
}
if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ;
if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE;
if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ;
if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(epoll_ev->ev, fde, flags, fde->private_data);
if (destruction_count != epoll_ev->destruction_count) {
@ -358,7 +358,7 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(epoll_ev, fde);
if (fde->flags & EVENT_FD_AUTOCLOSE) {
if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}

View File

@ -103,7 +103,7 @@ static int select_event_fd_destructor(struct tevent_fd *fde)
DLIST_REMOVE(select_ev->fd_events, fde);
select_ev->destruction_count++;
if (fde->flags & EVENT_FD_AUTOCLOSE) {
if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@ -193,10 +193,10 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
/* setup any fd events */
for (fde = select_ev->fd_events; fde; fde = fde->next) {
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
FD_SET(fde->fd, &r_fds);
}
if (fde->flags & EVENT_FD_WRITE) {
if (fde->flags & TEVENT_FD_WRITE) {
FD_SET(fde->fd, &w_fds);
}
}
@ -239,8 +239,8 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
for (fde = select_ev->fd_events; fde; fde = fde->next) {
uint16_t flags = 0;
if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ;
if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE;
if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ;
if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(select_ev->ev, fde, flags, fde->private_data);
if (destruction_count != select_ev->destruction_count) {

View File

@ -80,13 +80,13 @@ static void epoll_fallback_to_select(struct std_event_context *std_ev, const cha
}
/*
map from EVENT_FD_* to EPOLLIN/EPOLLOUT
map from TEVENT_FD_* to EPOLLIN/EPOLLOUT
*/
static uint32_t epoll_map_flags(uint16_t flags)
{
uint32_t ret = 0;
if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP);
if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP);
return ret;
}
@ -166,7 +166,7 @@ static void epoll_add_event(struct std_event_context *std_ev, struct tevent_fd *
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -209,7 +209,7 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd *
}
/* only if we want to read we want to tell the event handler about errors */
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR;
}
}
@ -217,8 +217,8 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd *
static void epoll_change_event(struct std_event_context *std_ev, struct tevent_fd *fde)
{
bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR);
bool want_read = (fde->flags & EVENT_FD_READ);
bool want_write= (fde->flags & EVENT_FD_WRITE);
bool want_read = (fde->flags & TEVENT_FD_READ);
bool want_write= (fde->flags & TEVENT_FD_WRITE);
if (std_ev->epoll_fd == -1) return;
@ -301,7 +301,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
if (events[i].events & (EPOLLHUP|EPOLLERR)) {
fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR;
/*
* if we only wait for EVENT_FD_WRITE, we should not tell the
* if we only wait for TEVENT_FD_WRITE, we should not tell the
* event handler about it, and remove the epoll_event,
* as we only report errors when waiting for read events,
* to match the select() behavior
@ -310,10 +310,10 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
epoll_del_event(std_ev, fde);
continue;
}
flags |= EVENT_FD_READ;
flags |= TEVENT_FD_READ;
}
if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ;
if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE;
if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ;
if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
if (destruction_count != std_ev->destruction_count) {
@ -392,7 +392,7 @@ static int std_event_fd_destructor(struct tevent_fd *fde)
epoll_del_event(std_ev, fde);
if (fde->flags & EVENT_FD_AUTOCLOSE) {
if (fde->flags & TEVENT_FD_AUTOCLOSE) {
close(fde->fd);
fde->fd = -1;
}
@ -489,10 +489,10 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
/* setup any fd events */
for (fde = std_ev->fd_events; fde; fde = fde->next) {
if (fde->flags & EVENT_FD_READ) {
if (fde->flags & TEVENT_FD_READ) {
FD_SET(fde->fd, &r_fds);
}
if (fde->flags & EVENT_FD_WRITE) {
if (fde->flags & TEVENT_FD_WRITE) {
FD_SET(fde->fd, &w_fds);
}
}
@ -535,8 +535,8 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
for (fde = std_ev->fd_events; fde; fde = fde->next) {
uint16_t flags = 0;
if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ;
if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE;
if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ;
if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
if (destruction_count != std_ev->destruction_count) {