From 3b8b4c0ae94ef59182304990c38c20076a01f6a8 Mon Sep 17 00:00:00 2001 From: aeb Date: Fri, 2 Jun 2000 17:03:00 +0000 Subject: [PATCH] Modified support for 32/64 bit environments, control struct fields have fixed size now. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@27 53a565d1-3bb7-0310-b661-cf11e63c67ab --- NEWS | 2 ++ configure.in | 13 ------------- src/fcp.c | 4 ++-- src/iso.c | 4 ++-- src/kernel-raw1394.h | 32 ++++++++++++++------------------ src/main.c | 2 +- src/readwrite.c | 14 +++++++------- 7 files changed, 28 insertions(+), 43 deletions(-) diff --git a/NEWS b/NEWS index 8a10f4f..eccf5d4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ Version 0.7: +- added support for environments where the kernel runs in 64 bit mode whereas + user space runs in 32 bit mode - fixed lock transaction to actually return the required response; these functions are actually useful now, prototypes for raw1394_start_lock and raw1394_lock changed diff --git a/configure.in b/configure.in index a579257..6ae0bec 100644 --- a/configure.in +++ b/configure.in @@ -4,20 +4,7 @@ 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/fcp.c b/src/fcp.c index cf501c0..732af58 100644 --- a/src/fcp.c +++ b/src/fcp.c @@ -18,8 +18,8 @@ static int do_fcp_listen(struct raw1394_handle *handle, int startstop) req->type = RAW1394_REQ_FCP_LISTEN; req->generation = handle->generation; req->misc = startstop; - req->tag = (unsigned long)&rh; - req->recvb = (kptr_t)handle->buffer; + req->tag = (__u64)&rh; + req->recvb = (__u64)handle->buffer; req->length = 512; err = write(handle->fd, req, sizeof(*req)); diff --git a/src/iso.c b/src/iso.c index 96ecd3c..f538f9a 100644 --- a/src/iso.c +++ b/src/iso.c @@ -19,8 +19,8 @@ static int do_iso_listen(struct raw1394_handle *handle, int channel) req->type = RAW1394_REQ_ISO_LISTEN; req->generation = handle->generation; req->misc = channel; - req->tag = (unsigned long)&rh; - req->recvb = (kptr_t)handle->buffer; + req->tag = (__u64)&rh; + req->recvb = (__u64)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 b17a033..ef324d6 100644 --- a/src/kernel-raw1394.h +++ b/src/kernel-raw1394.h @@ -1,11 +1,10 @@ - #ifndef IEEE1394_RAW1394_H #define IEEE1394_RAW1394_H #define RAW1394_DEVICE_MAJOR 171 #define RAW1394_DEVICE_NAME "raw1394" -#define RAW1394_KERNELAPI_VERSION 2 +#define RAW1394_KERNELAPI_VERSION 3 /* state: opened */ #define RAW1394_REQ_INITIALIZE 1 @@ -45,30 +44,27 @@ #define RAW1394_ERROR_TIMEOUT (-1102) +#include + struct raw1394_request { - int type; - int error; - int misc; + __s16 type; + __s16 error; + __u32 misc; - unsigned int generation; - octlet_t address; + __u32 generation; + __u32 length; - unsigned long tag; + __u64 address; - size_t length; + __u64 tag; -#ifdef __KERNEL__ - quadlet_t *sendb; - quadlet_t *recvb; -#else - kptr_t sendb; - kptr_t recvb; -#endif + __u64 sendb; + __u64 recvb; }; struct raw1394_khost_list { - int nodes; - char name[32]; + __u32 nodes; + __u8 name[32]; }; #ifdef __KERNEL__ diff --git a/src/main.c b/src/main.c index 3484d81..a55a661 100644 --- a/src/main.c +++ b/src/main.c @@ -135,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 = (kptr_t)handle->buffer; + req->recvb = (__u64)handle->buffer; req->length = HBUF_SIZE; while (1) { diff --git a/src/readwrite.c b/src/readwrite.c index d928e61..f72aabe 100644 --- a/src/readwrite.c +++ b/src/readwrite.c @@ -20,9 +20,9 @@ int raw1394_start_read(struct raw1394_handle *handle, nodeid_t node, req->generation = handle->generation; req->tag = tag; - req->address = ((u_int64_t)node << 48) | addr; + req->address = ((__u64)node << 48) | addr; req->length = length; - req->recvb = (kptr_t)buffer; + req->recvb = (__u64)buffer; return (int)write(handle->fd, req, sizeof(*req)); } @@ -39,9 +39,9 @@ int raw1394_start_write(struct raw1394_handle *handle, nodeid_t node, req->generation = handle->generation; req->tag = tag; - req->address = ((u_int64_t)node << 48) | addr; + req->address = ((__u64)node << 48) | addr; req->length = length; - req->sendb = (kptr_t)data; + req->sendb = (__u64)data; return (int)write(handle->fd, req, sizeof(*req)); } @@ -64,9 +64,9 @@ int raw1394_start_lock(struct raw1394_handle *handle, nodeid_t node, req->generation = handle->generation; req->tag = tag; - req->address = ((u_int64_t)node << 48) | addr; - req->sendb = (kptr_t)sendbuf; - req->recvb = (kptr_t)result; + req->address = ((__u64)node << 48) | addr; + req->sendb = (__u64)sendbuf; + req->recvb = (__u64)result; req->misc = extcode; switch (extcode) {