- Update to libraw1394 v2.0.0 release

epel9
Jarod Wilson 17 years ago
parent 3083b2968e
commit cdb72e8774

@ -3,3 +3,4 @@ libraw1394-1.2.1.tar.gz
fw-device-cdev.h
libraw1394-1.3.0.tar.gz
libraw1394-2.0.0-20080430_git.tar.bz2
libraw1394-2.0.0.tar.gz

@ -1,140 +0,0 @@
Originally submitted via Red Hat bugzilla by Philippe Troin:
https://bugzilla.redhat.com/show_bug.cgi?id=451727
Description:
While trying to track down some crashes in kino, I found the following problems
with libraw1394:
* There is a DIR* leak in raw1394_set_port().
* Lots of data structures are not fully initialized when calling IEEE1394
ioctl()s. These cause valgrind errors (benign, as valgrind does not know
how to interpret all ioctls. However these also cause kino to crash in
libraw1394. I've added a bunch of memset()s to prevent this problem from
happening.
Author: Philippe Troin <phil@fifi.org>
Forward-ported to libraw1394 git tree by Jarod Wilson.
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
--
src/fw-iso.c | 2 ++
src/fw.c | 15 ++++++++++++++-
tools/testlibraw.c | 1 +
3 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/fw-iso.c b/src/fw-iso.c
index 471d981..a1794c3 100644
--- a/src/fw-iso.c
+++ b/src/fw-iso.c
@@ -401,6 +401,7 @@ iso_init(fw_handle_t handle, int type,
}
handle->iso.closure.func = handle_iso_event;
+ memset(&ep, 0, sizeof(ep));
ep.events = EPOLLIN;
ep.data.ptr = &handle->iso.closure;
if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD,
@@ -411,6 +412,7 @@ iso_init(fw_handle_t handle, int type,
return -1;
}
+ memset(&create, 0, sizeof(create));
create.type = type;
create.channel = channel;
create.speed = speed;
diff --git a/src/fw.c b/src/fw.c
index 1322fe2..3c61385 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -149,6 +149,8 @@ scan_devices(fw_handle_t handle)
fd = open(filename, O_RDWR);
if (fd < 0)
continue;
+ memset(&get_info, 0, sizeof(get_info));
+ memset(&reset, 0, sizeof(reset));
get_info.version = FW_CDEV_VERSION;
get_info.rom = 0;
get_info.rom_length = 0;
@@ -404,7 +406,10 @@ fw_handle_t fw_new_handle(void)
struct epoll_event ep;
int i;
+ memset(&ep, 0, sizeof(ep));
+
handle = malloc(sizeof *handle);
+ memset(handle, 0, sizeof(*handle));
handle->tag_handler = default_tag_handler;
handle->arm_tag_handler = default_arm_tag_handler;
@@ -580,6 +585,8 @@ int fw_set_port(fw_handle_t handle, int port)
if (fd < 0)
continue;
+ memset(&get_info, 0, sizeof(get_info));
+ memset(&reset, 0, sizeof(reset));
get_info.version = FW_CDEV_VERSION;
get_info.rom = 0;
get_info.rom_length = 0;
@@ -603,10 +610,12 @@ int fw_set_port(fw_handle_t handle, int port)
sizeof handle->devices[i].filename);
handle->devices[i].closure.func = handle_device_event;
+ memset(&ep, 0, sizeof(ep));
ep.events = EPOLLIN;
ep.data.ptr = &handle->devices[i].closure;
if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
close(fd);
+ closedir(dir);
return -1;
}
@@ -621,6 +630,8 @@ int fw_set_port(fw_handle_t handle, int port)
i++;
}
+ closedir(dir);
+
return 0;
}
@@ -1220,6 +1231,7 @@ fw_start_fcp_listen(fw_handle_t handle)
closure->callback = handle_fcp_request;
+ memset(&request, 0, sizeof(request));
request.offset = CSR_REGISTER_BASE + CSR_FCP_COMMAND;
request.length = CSR_FCP_END - CSR_FCP_COMMAND;
request.closure = ptr_to_u64(closure);
@@ -1256,6 +1268,7 @@ fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
struct fw_cdev_get_info get_info;
int err;
+ memset(&get_info, 0, sizeof(get_info));
get_info.version = FW_CDEV_VERSION;
get_info.rom = ptr_to_u64(buffer);
get_info.rom_length = buffersize;
@@ -1284,7 +1297,7 @@ fw_bandwidth_modify (raw1394handle_t handle,
if (bandwidth == 0)
return 0;
-
+
addr = CSR_REGISTER_BASE + CSR_BANDWIDTH_AVAILABLE;
/* Read current bandwidth usage from IRM. */
result = raw1394_read (handle, raw1394_get_irm_id (handle), addr,
diff --git a/tools/testlibraw.c b/tools/testlibraw.c
index 2f02a6d..efd87ad 100644
--- a/tools/testlibraw.c
+++ b/tools/testlibraw.c
@@ -202,6 +202,7 @@ int main(int argc, char **argv)
read_topology_map(handle);
printf("testing config rom stuff\n");
+ memset(rom, 0, sizeof(rom));
retval=raw1394_get_config_rom(handle, rom, 0x100, &rom_size, &rom_version);
printf("get_config_rom returned %d, romsize %d, rom_version %d\n",retval,rom_size,rom_version);
printf("here are the first 10 quadlets:\n");

@ -1,176 +0,0 @@
From stefanr@s5r6.in-berlin.de Sat Jun 21 09:38:52 2008
Return-Path: <linux1394-devel-bounces@lists.sourceforge.net>
Received: from mail.boston.redhat.com ([unix socket])
by mail.boston.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-8.1.RHEL4) with LMTPA;
Sat, 21 Jun 2008 12:23:29 -0400
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
by mail.boston.redhat.com (8.13.1/8.13.1) with ESMTP id m5LGNTgY024156
for <jwilson@boston.redhat.com>; Sat, 21 Jun 2008 12:23:29 -0400
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5LGNSrM016955
for <jwilson@redhat.com>; Sat, 21 Jun 2008 12:23:28 -0400
Received: from lists-outbound.sourceforge.net (lists-outbound.sourceforge.net [66.35.250.225])
by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id m5LGNER3009229
for <jwilson@redhat.com>; Sat, 21 Jun 2008 12:23:15 -0400
Received: from sc8-sf-list1-new.sourceforge.net (sc8-sf-list1-new-b.sourceforge.net [10.3.1.93])
by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP
id 61A4C13B5E; Sat, 21 Jun 2008 09:23:09 -0700 (PDT)
Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92]
helo=mail.sourceforge.net)
by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43)
id 1KA5r3-0001G2-Jl for linux1394-devel@lists.sourceforge.net;
Sat, 21 Jun 2008 09:22:22 -0700
Received: from einhorn.in-berlin.de ([192.109.42.8] ident=root)
by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256)
(Exim 4.44) id 1KA5ot-0005aS-SV
for linux1394-devel@lists.sourceforge.net;
Sat, 21 Jun 2008 09:20:10 -0700
X-Envelope-From: stefanr@s5r6.in-berlin.de
Received: from stein ([83.221.231.7]) (authenticated bits=0)
by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id
m5LDcvG8006732; Sat, 21 Jun 2008 15:39:03 +0200
Date: Sat, 21 Jun 2008 15:38:52 +0200 (CEST)
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: [libraw1394 patch] Fix raw1394_read_cycle_timer after juju
integration
To: Dan Dennedy <dan@dennedy.org>
Message-ID: <tkrat.bef510e320235a97@s5r6.in-berlin.de>
MIME-Version: 1.0
Content-Disposition: INLINE
X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254
X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32
X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8
X-Spam-Report: Spam Filtering performed by sourceforge.net.
See http://spamassassin.org/tag/ for more details.
Report problems to
http://sf.net/tracker/?func=add&group_id=1&atid=200001
Cc: linux1394-devel@lists.sourceforge.net,
Pieter Palmers <pieterp@joow.be>
X-BeenThere: linux1394-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: Linux IEEE 1394 development list
<linux1394-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/linux1394-devel>,
<mailto:linux1394-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=linux1394-devel>
List-Post: <mailto:linux1394-devel@lists.sourceforge.net>
List-Help: <mailto:linux1394-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/linux1394-devel>,
<mailto:linux1394-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: linux1394-devel-bounces@lists.sourceforge.net
Errors-To: linux1394-devel-bounces@lists.sourceforge.net
X-RedHat-Spam-Score: -0.943
X-Length: 6916
X-UID: 4508
The ieee1394 version of raw1394_read_cycle_timer() fell over the cliff
in "First cut at integrating juju". This brings it back and adds a juju
version of it.
Also correct a typo in the inline documentation: s/get/read/
---
This is only compile-tested. I have no idea if the juju version works
at all. But at least the ieee1394 part is quite obvious.
src/dispatch.c | 11 +++++++++++
src/fw-iso.c | 19 +++++++++++++++++++
src/fw.h | 2 ++
src/raw1394.h | 2 +-
4 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/src/dispatch.c b/src/dispatch.c
index 4fe805e..aa40071 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -543,3 +543,14 @@ void raw1394_iso_shutdown(raw1394handle_t handle)
else
ieee1394_iso_shutdown(handle->mode.ieee1394);
}
+
+int raw1394_read_cycle_timer(raw1394handle_t handle,
+ u_int32_t *cycle_timer, u_int64_t *local_time)
+{
+ if (handle && handle->is_fw)
+ return fw_read_cycle_timer(handle->mode.fw,
+ cycle_timer, local_time);
+ else
+ return ieee1394_read_cycle_timer(handle->mode.ieee1394,
+ cycle_timer, local_time);
+}
diff --git a/src/fw-iso.c b/src/fw-iso.c
index a1794c3..f493444 100644
--- a/src/fw-iso.c
+++ b/src/fw-iso.c
@@ -529,3 +529,22 @@ void fw_iso_shutdown(fw_handle_t handle)
free(handle->iso.packets);
handle->iso.packets = NULL;
}
+
+int fw_read_cycle_timer(fw_handle_t handle,
+ u_int32_t *cycle_timer, u_int64_t *local_time)
+{
+#ifdef FW_CDEV_IOC_GET_CYCLE_TIMER /* added in kernel 2.6.24 */
+ int err;
+ struct fw_cdev_get_cycle_timer ctr = { 0 };
+
+ err = ioctl(handle->iso.fd, FW_CDEV_IOC_GET_CYCLE_TIMER, &ctr);
+ if (!err) {
+ *cycle_timer = ctr.cycle_timer;
+ *local_time = ctr.local_time;
+ }
+ return err;
+#else
+ errno = ENOSYS;
+ return -1;
+#endif /* defined(FW_CDEV_IOC_GET_CYCLE_TIMER) */
+}
diff --git a/src/fw.h b/src/fw.h
index e3196de..4ee9017 100644
--- a/src/fw.h
+++ b/src/fw.h
@@ -253,5 +253,7 @@ int fw_iso_recv_unlisten_channel(fw_handle_t handle,
int fw_iso_recv_set_channel_mask(fw_handle_t handle, u_int64_t mask);
void fw_iso_stop(fw_handle_t handle);
void fw_iso_shutdown(fw_handle_t handle);
+int fw_read_cycle_timer(fw_handle_t handle,
+ u_int32_t *cycle_timer, u_int64_t *local_time);
#endif
diff --git a/src/raw1394.h b/src/raw1394.h
index 1bcdf19..7cc07e6 100644
--- a/src/raw1394.h
+++ b/src/raw1394.h
@@ -329,7 +329,7 @@ void raw1394_iso_stop(raw1394handle_t handle);
void raw1394_iso_shutdown(raw1394handle_t handle);
/**
- * raw1394_get_cycle_timer - get the current value of the cycle timer
+ * raw1394_read_cycle_timer - get the current value of the cycle timer
* @handle: libraw1394 handle
* @cycle_timer: buffer for Isochronous Cycle Timer
* @local_time: buffer for local system time in microseconds since Epoch
--
1.5.4.5
--
Stefan Richter
-=====-==--- -==- =-=-=
http://arcgraph.de/sr/
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel

@ -1,22 +1,15 @@
%define gitrev 20080430_git
Summary: Library providing low-level IEEE-1394 access
Name: libraw1394
Version: 2.0.0
Release: 0.2.%{gitrev}%{?dist}
Release: 1%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
#Source: http://www.linux1394.org/dl/libraw1394-%{version}.tar.gz
# Pre-2.0.0 snapshot generated from git://dennedy.org/libraw1394.git
Source: %{name}-%{version}-%{gitrev}.tar.bz2
Source: http://www.linux1394.org/dl/libraw1394-%{version}.tar.gz
URL: http://www.linux1394.org/
ExcludeArch: s390 s390x
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf automake libtool kernel-headers
Patch0: libraw1394-memset-and-patch-up-leaks-git.patch
Patch1: libraw1394-restore-raw1394_read_cycle_timer.patch
%description
The libraw1394 library provides direct access to the IEEE-1394 bus through
the Linux 1394 subsystem's raw1394 user space interface. Support for both
@ -35,11 +28,7 @@ Development libraries needed to build applications against libraw1394.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
./autogen.sh
%configure --disable-static
make %{?_smp_mflags}
@ -76,6 +65,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Jul 18 2008 Jarod Wilson <jwilson@redhat.com> - 2.0.0-1
- Update to libraw1394 v2.0.0 release
* Mon Jun 23 2008 Jarod Wilson <jwilson@redhat.com> - 2.0.0-0.2.20080430_git
- Restore ieee1394 raw1394_read_cycle_timer, add firewire variant

@ -1 +1 @@
6ef4d6b593d919c36d65856f19be34b5 libraw1394-2.0.0-20080430_git.tar.bz2
f037629cc02509d4f24f6170bd656694 libraw1394-2.0.0.tar.gz

Loading…
Cancel
Save