From 8942a29ac1c6b575e0eb93d903097be60c2276e2 Mon Sep 17 00:00:00 2001 From: aeb Date: Sun, 28 May 2000 21:00:56 +0000 Subject: [PATCH] Added support for environments with 64 bit kernel and 32 bit userland. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@26 53a565d1-3bb7-0310-b661-cf11e63c67ab --- acconfig.h | 13 +++++++++++++ configure.in | 14 ++++++++++++++ src/eventloop.c | 1 + src/fcp.c | 3 ++- src/iso.c | 3 ++- src/kernel-raw1394.h | 6 ++++++ src/main.c | 3 ++- src/readwrite.c | 9 +++++---- 8 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 acconfig.h diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..30f96b6 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,13 @@ + +/* Define if kernel is 64 bit and userland is 32 bit */ +#undef KERNEL64_USER32 + +@BOTTOM@ + +#include + +#ifdef KERNEL64_USER32 +typedef u_int64_t kptr_t; +#else +typedef void *kptr_t; +#endif diff --git a/configure.in b/configure.in index f071944..a579257 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,22 @@ AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(libraw1394, 0.6) +AM_CONFIG_HEADER(config.h) + +# AC_CANONICAL_HOST AC_PROG_CC AM_PROG_LIBTOOL + +AC_ARG_ENABLE(32-64, + [ --enable-32-64 support systems with 64 bit kernel and 32 bit userland], + [ +case $enableval in +yes) AC_DEFINE(KERNEL64_USER32) ;; +no) ;; +*) AC_MSG_ERROR([ Invalid arg for --enable-32-64 ]) +esac + ]) + AC_OUTPUT([ Makefile src/Makefile debian/Makefile ]) diff --git a/src/eventloop.c b/src/eventloop.c index e898ba7..85c68b5 100644 --- a/src/eventloop.c +++ b/src/eventloop.c @@ -1,4 +1,5 @@ +#include #include #include "raw1394.h" diff --git a/src/fcp.c b/src/fcp.c index 2c56027..cf501c0 100644 --- a/src/fcp.c +++ b/src/fcp.c @@ -1,4 +1,5 @@ +#include #include #include @@ -18,7 +19,7 @@ static int do_fcp_listen(struct raw1394_handle *handle, int startstop) req->generation = handle->generation; req->misc = startstop; req->tag = (unsigned long)&rh; - req->recvb = handle->buffer; + req->recvb = (kptr_t)handle->buffer; req->length = 512; err = write(handle->fd, req, sizeof(*req)); diff --git a/src/iso.c b/src/iso.c index 21abeae..96ecd3c 100644 --- a/src/iso.c +++ b/src/iso.c @@ -1,4 +1,5 @@ +#include #include #include @@ -19,7 +20,7 @@ static int do_iso_listen(struct raw1394_handle *handle, int channel) req->generation = handle->generation; req->misc = channel; req->tag = (unsigned long)&rh; - req->recvb = handle->buffer; + req->recvb = (kptr_t)handle->buffer; req->length = HBUF_SIZE; err = write(handle->fd, req, sizeof(*req)); diff --git a/src/kernel-raw1394.h b/src/kernel-raw1394.h index f23bfc0..b17a033 100644 --- a/src/kernel-raw1394.h +++ b/src/kernel-raw1394.h @@ -56,8 +56,14 @@ struct raw1394_request { unsigned long tag; size_t length; + +#ifdef __KERNEL__ quadlet_t *sendb; quadlet_t *recvb; +#else + kptr_t sendb; + kptr_t recvb; +#endif }; struct raw1394_khost_list { diff --git a/src/main.c b/src/main.c index 16e08f1..3484d81 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ +#include #include #include #include @@ -134,7 +135,7 @@ int raw1394_get_port_info(struct raw1394_handle *handle, CLEAR_REQ(req); req->type = RAW1394_REQ_LIST_CARDS; req->generation = handle->generation; - req->recvb = handle->buffer; + req->recvb = (kptr_t)handle->buffer; req->length = HBUF_SIZE; while (1) { diff --git a/src/readwrite.c b/src/readwrite.c index aa1db0e..d928e61 100644 --- a/src/readwrite.c +++ b/src/readwrite.c @@ -1,4 +1,5 @@ +#include #include #include @@ -21,7 +22,7 @@ int raw1394_start_read(struct raw1394_handle *handle, nodeid_t node, req->address = ((u_int64_t)node << 48) | addr; req->length = length; - req->recvb = buffer; + req->recvb = (kptr_t)buffer; return (int)write(handle->fd, req, sizeof(*req)); } @@ -40,7 +41,7 @@ int raw1394_start_write(struct raw1394_handle *handle, nodeid_t node, req->address = ((u_int64_t)node << 48) | addr; req->length = length; - req->sendb = data; + req->sendb = (kptr_t)data; return (int)write(handle->fd, req, sizeof(*req)); } @@ -64,8 +65,8 @@ int raw1394_start_lock(struct raw1394_handle *handle, nodeid_t node, req->tag = tag; req->address = ((u_int64_t)node << 48) | addr; - req->sendb = sendbuf; - req->recvb = result; + req->sendb = (kptr_t)sendbuf; + req->recvb = (kptr_t)result; req->misc = extcode; switch (extcode) {