All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tapdisk cleanup
@ 2006-09-01 10:42 Jun Koi
  2006-09-01 20:23 ` Andrew Warfield
  2007-01-02 23:37 ` grel
  0 siblings, 2 replies; 6+ messages in thread
From: Jun Koi @ 2006-09-01 10:42 UTC (permalink / raw)
  To: Xen Developers, jac90, andrew.warfield

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Hi Julian and Andrew,

This patch cleans tapdisk, please apply.

Sign-off-by: Jun Koi <junkoi2004@gmail.com>

[-- Attachment #2: tapdisk.diff --]
[-- Type: text/plain, Size: 1595 bytes --]

diff -r 765b7e23d979 tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c	Fri Sep  1 01:25:15 2006 +0100
+++ b/tools/blktap/drivers/tapdisk.c	Fri Sep  1 19:32:37 2006 +0900
@@ -127,18 +127,15 @@ static inline int LOCAL_FD_SET(fd_set *r
 static inline int LOCAL_FD_SET(fd_set *readfds)
 {
 	fd_list_entry_t *ptr;
-	int i;
 
 	ptr = fd_start;
 	while (ptr != NULL) {
 		if (ptr->tap_fd) {
 			FD_SET(ptr->tap_fd, readfds);
-			for (i = 0; i < MAX_IOFD; i++) {
-				if (ptr->io_fd[i]) 
-					FD_SET(ptr->io_fd[i], readfds);
-				maxfds = (ptr->io_fd[i] > maxfds ? 
-					  ptr->io_fd[i]: maxfds);
-			}
+			if (ptr->io_fd[READ]) 
+				FD_SET(ptr->io_fd[READ], readfds);
+			maxfds = (ptr->io_fd[READ] > maxfds ? 
+					ptr->io_fd[READ]: maxfds);
 			maxfds = (ptr->tap_fd > maxfds ? ptr->tap_fd: maxfds);
 		}
 		ptr = ptr->next;
@@ -580,7 +577,7 @@ static void get_io_request(struct td_sta
 
 int main(int argc, char *argv[])
 {
-	int len, msglen, ret, i;
+	int len, msglen, ret;
 	char *p, *buf;
 	fd_set readfds, writefds;
 	struct timeval timeout;
@@ -633,16 +630,14 @@ int main(int argc, char *argv[])
 			     (fd_set *) 0, &timeout);
 
 		if (ret > 0) 
-                {
+		{
 			ptr = fd_start;
 			while (ptr != NULL) {
 				if (FD_ISSET(ptr->tap_fd, &readfds)) 
 					get_io_request(ptr->s);
-				for (i = 0; i < MAX_IOFD; i++) {
-					if (ptr->io_fd[i] && 
-					   FD_ISSET(ptr->io_fd[i], &readfds)) 
-						io_done(ptr->s, i);
-				}
+				if (ptr->io_fd[READ] && 
+						FD_ISSET(ptr->io_fd[READ], &readfds)) 
+					io_done(ptr->s, READ);
 
 				ptr = ptr->next;
 			}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tapdisk cleanup
@ 2006-09-01 13:42 Andrés Lagar Cavilla
  2006-09-01 20:30 ` Andrew Warfield
  0 siblings, 1 reply; 6+ messages in thread
From: Andrés Lagar Cavilla @ 2006-09-01 13:42 UTC (permalink / raw)
  To: xen-devel, jac90, andrew.warfield

Regarding blocktap, has there been any advance on the issue of xm 
block-detach failing for tap devices? I submitted a band-aid patch on 
this post
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg01086.html
but I was hoping somebody could come up with a more tasteful solution :)

Thanks,
Andres

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tapdisk cleanup
  2006-09-01 10:42 [PATCH] tapdisk cleanup Jun Koi
@ 2006-09-01 20:23 ` Andrew Warfield
  2006-09-02  1:11   ` NAHieu
  2007-01-02 23:37 ` grel
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Warfield @ 2006-09-01 20:23 UTC (permalink / raw)
  To: Jun Koi; +Cc: Xen Developers, jac90

Applied.  Thanks Jun.  If you wanted to go through and clean up the
rest of the io_fd uses, i.e. to address them all as READ/WRITE rather
than in loops to 2, that would be appreciated.  The current structure
of thos io_fds may be a little over-extensible at the moment ;)

a.

On 9/1/06, Jun Koi <junkoi2004@gmail.com> wrote:
> Hi Julian and Andrew,
>
> This patch cleans tapdisk, please apply.
>
> Sign-off-by: Jun Koi <junkoi2004@gmail.com>
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tapdisk cleanup
  2006-09-01 13:42 Andrés Lagar Cavilla
@ 2006-09-01 20:30 ` Andrew Warfield
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Warfield @ 2006-09-01 20:30 UTC (permalink / raw)
  To: Andrés Lagar Cavilla; +Cc: xen-devel, jac90

> Regarding blocktap, has there been any advance on the issue of xm
> block-detach failing for tap devices? I submitted a band-aid patch on
> this post
> http://lists.xensource.com/archives/html/xen-devel/2006-08/msg01086.html
> but I was hoping somebody could come up with a more tasteful solution :)

Nope, this one seems to have slipped between the cracks.  I was hoping
that a more tasteful solution would emerge as well. ;)  I'd love to
see a more comprehensive patch, but if you're implying that you aren't
likely to get around to it, I'll add it to my todo list.

a.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [PATCH] tapdisk cleanup
  2006-09-01 20:23 ` Andrew Warfield
@ 2006-09-02  1:11   ` NAHieu
  0 siblings, 0 replies; 6+ messages in thread
From: NAHieu @ 2006-09-02  1:11 UTC (permalink / raw)
  To: Andrew Warfield; +Cc: jac90, Xen Developers, Jun Koi

Andrew, could you explain a little bit why drivers (block_*.c in
drivers/) create pipe files? I read he code, and still cannot figure
it out.


Many thanks,
H

On 9/2/06, Andrew Warfield <andrew.warfield@cl.cam.ac.uk> wrote:
> Applied.  Thanks Jun.  If you wanted to go through and clean up the
> rest of the io_fd uses, i.e. to address them all as READ/WRITE rather
> than in loops to 2, that would be appreciated.  The current structure
> of thos io_fds may be a little over-extensible at the moment ;)
>
> a.
>
> On 9/1/06, Jun Koi <junkoi2004@gmail.com> wrote:
> > Hi Julian and Andrew,
> >
> > This patch cleans tapdisk, please apply.
> >
> > Sign-off-by: Jun Koi <junkoi2004@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tapdisk cleanup
  2006-09-01 10:42 [PATCH] tapdisk cleanup Jun Koi
  2006-09-01 20:23 ` Andrew Warfield
@ 2007-01-02 23:37 ` grel
  1 sibling, 0 replies; 6+ messages in thread
From: grel @ 2007-01-02 23:37 UTC (permalink / raw)
  To: xen-devel



I am a newbie. Can you tell me what sequence I need to go through to apply
your patch below. I tried to encapsulate it in a shell script but I got the
following errors when I ran it(I called the script taps.sh):
diff: 765b7e23d979: No such file or director
taps.sh: line 3: ---: command not found
taps.sh: line 4: +++: command not found

... and some other error. I just dont know how to apply the patch in the
first place - please tell me how.



Jun Koi wrote:
> 
> Hi Julian and Andrew,
> 
> This patch cleans tapdisk, please apply.
> 
> Sign-off-by: Jun Koi <junkoi2004@gmail.com>
> 
> diff -r 765b7e23d979 tools/blktap/drivers/tapdisk.c
> --- a/tools/blktap/drivers/tapdisk.c	Fri Sep  1 01:25:15 2006 +0100
> +++ b/tools/blktap/drivers/tapdisk.c	Fri Sep  1 19:32:37 2006 +0900
> @@ -127,18 +127,15 @@ static inline int LOCAL_FD_SET(fd_set *r
>  static inline int LOCAL_FD_SET(fd_set *readfds)
>  {
>  	fd_list_entry_t *ptr;
> -	int i;
>  
>  	ptr = fd_start;
>  	while (ptr != NULL) {
>  		if (ptr->tap_fd) {
>  			FD_SET(ptr->tap_fd, readfds);
> -			for (i = 0; i < MAX_IOFD; i++) {
> -				if (ptr->io_fd[i]) 
> -					FD_SET(ptr->io_fd[i], readfds);
> -				maxfds = (ptr->io_fd[i] > maxfds ? 
> -					  ptr->io_fd[i]: maxfds);
> -			}
> +			if (ptr->io_fd[READ]) 
> +				FD_SET(ptr->io_fd[READ], readfds);
> +			maxfds = (ptr->io_fd[READ] > maxfds ? 
> +					ptr->io_fd[READ]: maxfds);
>  			maxfds = (ptr->tap_fd > maxfds ? ptr->tap_fd: maxfds);
>  		}
>  		ptr = ptr->next;
> @@ -580,7 +577,7 @@ static void get_io_request(struct td_sta
>  
>  int main(int argc, char *argv[])
>  {
> -	int len, msglen, ret, i;
> +	int len, msglen, ret;
>  	char *p, *buf;
>  	fd_set readfds, writefds;
>  	struct timeval timeout;
> @@ -633,16 +630,14 @@ int main(int argc, char *argv[])
>  			     (fd_set *) 0, &timeout);
>  
>  		if (ret > 0) 
> -                {
> +		{
>  			ptr = fd_start;
>  			while (ptr != NULL) {
>  				if (FD_ISSET(ptr->tap_fd, &readfds)) 
>  					get_io_request(ptr->s);
> -				for (i = 0; i < MAX_IOFD; i++) {
> -					if (ptr->io_fd[i] && 
> -					   FD_ISSET(ptr->io_fd[i], &readfds)) 
> -						io_done(ptr->s, i);
> -				}
> +				if (ptr->io_fd[READ] && 
> +						FD_ISSET(ptr->io_fd[READ], &readfds)) 
> +					io_done(ptr->s, READ);
>  
>  				ptr = ptr->next;
>  			}
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/-PATCH--tapdisk-cleanup-tf2201859.html#a8132956
Sent from the Xen - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-02 23:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-01 10:42 [PATCH] tapdisk cleanup Jun Koi
2006-09-01 20:23 ` Andrew Warfield
2006-09-02  1:11   ` NAHieu
2007-01-02 23:37 ` grel
  -- strict thread matches above, loose matches on Subject: below --
2006-09-01 13:42 Andrés Lagar Cavilla
2006-09-01 20:30 ` Andrew Warfield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.