rpms/libpciaccess/devel libpciaccess-rom-size.patch, 1.1, 1.2 libpciaccess.spec, 1.13, 1.14
Kristian Høgsberg
krh at fedoraproject.org
Mon Feb 16 01:52:27 UTC 2009
- Previous message (by thread): rpms/perl-Catalyst-Runtime/F-10 perl-Catalyst-Runtime.spec, 1.9, 1.10 sources, 1.5, 1.6
- Next message (by thread): rpms/deluge/devel .cvsignore, 1.53, 1.54 deluge.spec, 1.83, 1.84 sources, 1.53, 1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: krh
Update of /cvs/pkgs/rpms/libpciaccess/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5000
Modified Files:
libpciaccess-rom-size.patch libpciaccess.spec
Log Message:
* Sun Feb 15 2009 Kristian Høgsberg <krh at redhat.com> - 0.10.3-5
- Unbreak the rom-size patch.
libpciaccess-rom-size.patch:
Index: libpciaccess-rom-size.patch
===================================================================
RCS file: /cvs/pkgs/rpms/libpciaccess/devel/libpciaccess-rom-size.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libpciaccess-rom-size.patch 16 Feb 2009 01:30:14 -0000 1.1
+++ libpciaccess-rom-size.patch 16 Feb 2009 01:52:27 -0000 1.2
@@ -1,15 +1,73 @@
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
-index 8c3cf67..ae9f38e 100644
+index 8c3cf67..2ea78c1 100644
--- a/src/linux_sysfs.c
+++ b/src/linux_sysfs.c
-@@ -338,6 +338,10 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
- if ( rom_size == 0 )
- rom_size = 0x10000;
-
-+ /* The caller has allocated dev->rom_size so cap the read amount. */
-+ if ( rom_size > dev->rom_size )
-+ rom_size = dev->rom_size;
+@@ -227,6 +227,7 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
+ pciaddr_t bytes;
+ unsigned i;
+ int err;
++ struct stat st;
+
+
+ err = pci_device_linux_sysfs_read( dev, config, 0, 256, & bytes );
+@@ -293,11 +294,28 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
+ flags = strtoull( next, & next, 16 );
+ if ( low_addr != 0 ) {
+ priv->rom_base = low_addr;
+- dev->rom_size = (high_addr - low_addr) + 1;
+ }
+ }
+ }
+
++ snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/rom",
++ SYS_BUS_PCI,
++ dev->domain,
++ dev->bus,
++ dev->dev,
++ dev->func );
++
++ fd = open( name, O_RDWR );
++ if ( fd == -1 ) {
++ dev->rom_size = 0x10000;
++ } else if ( fstat( fd, & st ) == -1 ) {
++ close( fd );
++ dev->rom_size = 0x10000;
++ } else {
++ close( fd );
++ dev->rom_size = st.st_size == 0 ? 0x10000 : st.st_size;
++ }
+
+ return err;
+ }
+
+@@ -309,7 +327,6 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
+ int fd;
+ struct stat st;
+ int err = 0;
+- size_t rom_size;
+ size_t total_bytes;
+
+
+@@ -334,10 +351,6 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
+ return errno;
+ }
+
+- rom_size = st.st_size;
+- if ( rom_size == 0 )
+- rom_size = 0x10000;
+-
/* This is a quirky thing on Linux. Even though the ROM and the file
* for the ROM in sysfs are read-only, the string "1" must be written to
* the file to enable the ROM. After the data has been read, "0" must be
+@@ -346,9 +359,9 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
+ write( fd, "1", 1 );
+ lseek( fd, 0, SEEK_SET );
+
+- for ( total_bytes = 0 ; total_bytes < rom_size ; /* empty */ ) {
++ for ( total_bytes = 0 ; total_bytes < dev->rom_size ; /* empty */ ) {
+ const int bytes = read( fd, (char *) buffer + total_bytes,
+- rom_size - total_bytes );
++ dev->rom_size - total_bytes );
+ if ( bytes == -1 ) {
+ err = errno;
+ break;
Index: libpciaccess.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libpciaccess/devel/libpciaccess.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- libpciaccess.spec 16 Feb 2009 01:30:14 -0000 1.13
+++ libpciaccess.spec 16 Feb 2009 01:52:27 -0000 1.14
@@ -3,7 +3,7 @@
Name: libpciaccess
Version: 0.10.3
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: PCI access library
Group: System Environment/Libraries
@@ -72,6 +72,9 @@
%{_libdir}/pkgconfig/pciaccess.pc
%changelog
+* Sun Feb 15 2009 Kristian Høgsberg <krh at redhat.com> - 0.10.3-5
+- Unbreak the rom-size patch.
+
* Sun Feb 15 2009 Kristian Høgsberg <krh at redhat.com> - 0.10.3-4
- Don't read more than the advertised rom_size.
- Previous message (by thread): rpms/perl-Catalyst-Runtime/F-10 perl-Catalyst-Runtime.spec, 1.9, 1.10 sources, 1.5, 1.6
- Next message (by thread): rpms/deluge/devel .cvsignore, 1.53, 1.54 deluge.spec, 1.83, 1.84 sources, 1.53, 1.54
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list