direct-io.hg
changeset 11411:470666ea973d
Tapdisk cleanup.
Sign-off-by: Jun Koi <junkoi2004@gmail.com>
Sign-off-by: Jun Koi <junkoi2004@gmail.com>
author | Andrew Warfield <andy@xensource.com> |
---|---|
date | Fri Sep 01 13:24:51 2006 -0700 (2006-09-01) |
parents | 3e6325b73474 |
children | 5fa9b746d24f |
files | tools/blktap/drivers/tapdisk.c |
line diff
1.1 --- a/tools/blktap/drivers/tapdisk.c Fri Sep 01 16:11:51 2006 +0100 1.2 +++ b/tools/blktap/drivers/tapdisk.c Fri Sep 01 13:24:51 2006 -0700 1.3 @@ -127,18 +127,15 @@ void sig_handler(int sig) 1.4 static inline int LOCAL_FD_SET(fd_set *readfds) 1.5 { 1.6 fd_list_entry_t *ptr; 1.7 - int i; 1.8 1.9 ptr = fd_start; 1.10 while (ptr != NULL) { 1.11 if (ptr->tap_fd) { 1.12 FD_SET(ptr->tap_fd, readfds); 1.13 - for (i = 0; i < MAX_IOFD; i++) { 1.14 - if (ptr->io_fd[i]) 1.15 - FD_SET(ptr->io_fd[i], readfds); 1.16 - maxfds = (ptr->io_fd[i] > maxfds ? 1.17 - ptr->io_fd[i]: maxfds); 1.18 - } 1.19 + if (ptr->io_fd[READ]) 1.20 + FD_SET(ptr->io_fd[READ], readfds); 1.21 + maxfds = (ptr->io_fd[READ] > maxfds ? 1.22 + ptr->io_fd[READ]: maxfds); 1.23 maxfds = (ptr->tap_fd > maxfds ? ptr->tap_fd: maxfds); 1.24 } 1.25 ptr = ptr->next; 1.26 @@ -580,7 +577,7 @@ static void get_io_request(struct td_sta 1.27 1.28 int main(int argc, char *argv[]) 1.29 { 1.30 - int len, msglen, ret, i; 1.31 + int len, msglen, ret; 1.32 char *p, *buf; 1.33 fd_set readfds, writefds; 1.34 struct timeval timeout; 1.35 @@ -633,16 +630,14 @@ int main(int argc, char *argv[]) 1.36 (fd_set *) 0, &timeout); 1.37 1.38 if (ret > 0) 1.39 - { 1.40 + { 1.41 ptr = fd_start; 1.42 while (ptr != NULL) { 1.43 if (FD_ISSET(ptr->tap_fd, &readfds)) 1.44 get_io_request(ptr->s); 1.45 - for (i = 0; i < MAX_IOFD; i++) { 1.46 - if (ptr->io_fd[i] && 1.47 - FD_ISSET(ptr->io_fd[i], &readfds)) 1.48 - io_done(ptr->s, i); 1.49 - } 1.50 + if (ptr->io_fd[READ] && 1.51 + FD_ISSET(ptr->io_fd[READ], &readfds)) 1.52 + io_done(ptr->s, READ); 1.53 1.54 ptr = ptr->next; 1.55 }