tag 394214 + patch
thanks

Hi,

What about the following patch? It gets page_size during open and stores
it in a global so that sysconf is not called in the fast path. I did not
find any better place than pusb_open (is there something like a
pusb_init routine defined in pusb-linux.c ?).

It builds fine on i386. I didn't have a chance to try building on
another arch so far. I also don't have the hardware to test .

Brice




Index: eciadsl-usermode-0.11/pusb-linux.c
===================================================================
--- eciadsl-usermode-0.11/pusb-linux.c  2006-12-29 15:25:26.000000000 +0100
+++ eciadsl-usermode-0.11/pusb-linux.c  2006-12-29 15:33:20.000000000 +0100
@@ -29,7 +29,6 @@
 #include <string.h>
 
 #include "pusb-linux.h"
-#include <asm/page.h>
 
 struct pusb_endpoint_t
 {
@@ -217,10 +216,15 @@
        return(make_device(fd));
 }
 
+/* save page_size at open */
+static unsigned long page_size;
+
 pusb_device_t pusb_open(const char* path)
 {
        int fd; 
 
+       page_size = sysconf(_SC_PAGESIZE);
+
        fd = open(path, O_RDWR);
        if (fd < 0)
        {
@@ -352,8 +356,8 @@
     {
                bulk.ep      = ep;
                bulk.len     = size;
-               if (bulk.len > PAGE_SIZE)
-                       bulk.len = PAGE_SIZE;
+               if (bulk.len > page_size)
+                       bulk.len = page_size;
                bulk.timeout = timeout;
                bulk.data    = buf;
 




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to