Bug#356352: libsysfs2 patch

2006-07-08 Thread Filippo Giunchedi
On Sun, Jul 09, 2006 at 12:03:50AM +0200, Steinar H. Gunderson wrote:
> Newest upstream is now 13.0. I've taken the patch, forward-ported it to 13.0
> and fixed a few errors (valgrind is very useful for this kind of work, by the
> way). It works without crashing or giving valgrind hits (at least "hwinfo"
> and "hwinfo --pci"), but it has a number of small memory leaks. (I suspect
> the latter is not a consequence of the patch, though.)

thanks!
as stated before I was unable to tell if hwinfo gave me more or less
informations than without the patch, though the patch looks rather easy I
suspect it is working.
Of course the best would be to hear from upstream but I doubt they care enough.

filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

Gretchen: Donnie Darko? What the hell kind of name is that? It's like
  some sort of superhero or something
Donnie: What makes you think I'm not?
-- from Donnie Darko (2001)


signature.asc
Description: Digital signature


Processed: Re: Bug#356352: libsysfs2 patch

2006-07-08 Thread Debian Bug Tracking System
Processing commands for [EMAIL PROTECTED]:

> tags 356352 + patch
Bug#356352: hwinfo - FTBFS: warning: implicit declaration of function 
'sysfs_read_dir_links'
Tags were: help
Tags added: patch

> thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)


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



Bug#356352: libsysfs2 patch

2006-07-08 Thread Steinar H. Gunderson
tags 356352 + patch
thanks

On Mon, Jun 26, 2006 at 09:06:39PM +0200, Morten Werner Olsen wrote:
> The patch applies fine with 12.33 (newest upstream I found atm), but I
> get this error when running hwinfo (this is the shared libary one -
> similar source package that is in experimental, but with your patch and
> newer upstream release):

Newest upstream is now 13.0. I've taken the patch, forward-ported it to 13.0
and fixed a few errors (valgrind is very useful for this kind of work, by the
way). It works without crashing or giving valgrind hits (at least "hwinfo"
and "hwinfo --pci"), but it has a number of small memory leaks. (I suspect
the latter is not a consequence of the patch, though.)

/* Steinar */
-- 
Homepage: http://www.sesse.net/
Only in hwinfo-13.0.patched: .depend
Only in hwinfo-13.0.patched: hwinfo
Only in hwinfo-13.0.patched: hwinfo.o
Only in hwinfo-13.0.patched/src/hd: adb.o
Only in hwinfo-13.0.patched/src/hd: bios.o
Only in hwinfo-13.0.patched/src/hd: block.o
Only in hwinfo-13.0.patched/src/hd: braille.o
Only in hwinfo-13.0.patched/src/hd: cpu.o
Only in hwinfo-13.0.patched/src/hd: .depend
diff -ur hwinfo-13.0/src/hd/edd.c hwinfo-13.0.patched/src/hd/edd.c
--- hwinfo-13.0/src/hd/edd.c2006-06-29 16:03:37.0 +0200
+++ hwinfo-13.0.patched/src/hd/edd.c2006-07-08 23:47:31.0 +0200
@@ -53,9 +53,9 @@
   bios_info_t *bt;
   edd_info_t *ei;
 
-  struct sysfs_directory *sf_dir;
-  struct sysfs_directory *sf_dir_2;
-  struct sysfs_link *sf_link;
+  struct dlist *sf_dir_list;
+  struct sysfs_attribute *node, *tmpattr;
+  char attrpath[SYSFS_PATH_MAX], linkpath[SYSFS_PATH_MAX];
 
   for(u = 0; u < sizeof hd_data->edd / sizeof *hd_data->edd; u++) {
 free_mem(hd_data->edd[u].sysfs_id);
@@ -63,69 +63,92 @@
 
   memset(hd_data->edd, 0, sizeof hd_data->edd);
 
-  sf_dir = sysfs_open_directory("/sys/firmware/edd");
-
-  if(sf_dir) {
-if(!sysfs_read_all_subdirs(sf_dir)) {
-  if(sf_dir->subdirs) {
-dlist_for_each_data(sf_dir->subdirs, sf_dir_2, struct sysfs_directory) 
{
+  sf_dir_list = sysfs_open_directory_list("/sys/firmware/edd");
+  
+  if(sf_dir_list) {
+dlist_for_each_data(sf_dir_list, node, struct sysfs_attribute) {
 
   if(
-sscanf(sf_dir_2->name, "int13_dev%02x", &u) == 1 &&
+sscanf(node->name, "int13_dev%02x", &u) == 1 &&
 u >= 0x80 &&
 u <= 0xff
   ) {
+
 edd_cnt++;
 
 u -= 0x80;
 
 ei = hd_data->edd + u;
-
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"sectors"), &ul0, 0)) {
+
+sprintf(attrpath, "/sys/firmware/edd/%s/sectors", node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->sectors = ul0;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"default_cylinders"), &ul0, 0)) {
+sprintf(attrpath, "/sys/firmware/edd/%s/default_cylinders", 
node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->edd.cyls = ul0;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"default_heads"), &ul0, 0)) {
+sprintf(attrpath, "/sys/firmware/edd/%s/default_heads", 
node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->edd.heads = ul0;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"default_sectors_per_track"), &ul0, 0)) {
+sprintf(attrpath, 
"/sys/firmware/edd/%s/default_sectors_per_track", node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->edd.sectors = ul0;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"legacy_max_cylinder"), &ul0, 0)) {
+sprintf(attrpath, "/sys/firmware/edd/%s/legacy_max_cylinder", 
node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->legacy.cyls = ul0 + 1;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"legacy_max_head"), &ul0, 0)) {
+sprintf(attrpath, "/sys/firmware/edd/%s/legacy_max_head", 
node->name);
+tmpattr = sysfs_open_attribute(attrpath); 
+if(hd_attr_uint(tmpattr, &ul0, 0)) {
   ei->legacy.heads = ul0 + 1;
 }
+sysfs_close_attribute(tmpattr);
 
-if(hd_attr_uint(sysfs_get_directory_attribute(sf_dir_2, 
"legacy_sectors_per_track")

Bug#356352: libsysfs2 patch

2006-06-30 Thread Filippo Giunchedi
On Mon, Jun 26, 2006 at 09:06:39PM +0200, Morten Werner Olsen wrote:
> > The output from debian's hwinfo and 12.9 patched are not identical though,
> > I can't tell if there's more information or less, I have it available for
> > display.
> 
> Thanks a lot for this patch! :)
> 
> The patch applies fine with 12.33 (newest upstream I found atm), but I
> get this error when running hwinfo (this is the shared libary one -
> similar source package that is in experimental, but with your patch and
> newer upstream release):
> 
>   [EMAIL PROTECTED]:~$ /usr/sbin/hwinfo 
>   > usb.3.3: input*** glibc detected *** double free or corruption
>   > (fasttop): 0x0807dbf0 ***
>   Aborted

indeed, the patch is nowhere near to be polished, I need to check it further
:|
It should be a start, though. I'm going to have a look at it also, but don't
hold your breath :)

filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

Date: Tuesday, 2002/10/22 - 08:09
dselect proves the existence of Satan. It's the worst part of Debian.


signature.asc
Description: Digital signature


Bug#356352: libsysfs2 patch

2006-06-30 Thread Morten Werner Olsen
On Tue, Jun 13, 2006 at 11:32:55PM +0200, Filippo Giunchedi wrote:

> this: 
> http://people.debian.org/~filippo/patches/hwinfo-12.31_libsysfs2-0.1.patch
> is my first attempt to port hwinfo to libsysfs2, the patch is against
> 12.31 but applies to 12.9 with all hunks successful (just a few offsets).
> Please test the patch if it works for you (at least if it finds the same
> amount of hardware, or more :))
> The output from debian's hwinfo and 12.9 patched are not identical though,
> I can't tell if there's more information or less, I have it available for
> display.

Thanks a lot for this patch! :)

The patch applies fine with 12.33 (newest upstream I found atm), but I
get this error when running hwinfo (this is the shared libary one -
similar source package that is in experimental, but with your patch and
newer upstream release):

  [EMAIL PROTECTED]:~$ /usr/sbin/hwinfo 
  > usb.3.3: input*** glibc detected *** double free or corruption
  > (fasttop): 0x0807dbf0 ***
  Aborted

This error is also when using --hw_item, when hw_item is one of block,
bluetooth, braille, camera, cdrom, chipcard, disk, dsl, floppy, hub,
isdn, joystick, keyboard, modem, mouse, netcard, network, partition,
printer, scanner, usb and wlan.

I also got a segmentation fault for hw_item like pci, pcmcia and pppoe:

  [EMAIL PROTECTED]:~$ /usr/sbin/hwinfo --pci
  > net.1: get network dataSegmentation fault

I have not tested 12.33 without your patch yet, not as a static binary,
and not 12.31 nor 12.9 with your patch. Hope to do some more testing
later tonight, and will send updates to you and BTS. Maybe I will have
time to run hwinfo in Valgrind too.. :)


- Werner



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



Bug#356352: libsysfs2 patch

2006-06-15 Thread Filippo Giunchedi
Hi,
this: http://people.debian.org/~filippo/patches/hwinfo-12.31_libsysfs2-0.1.patch
is my first attempt to port hwinfo to libsysfs2, the patch is against 12.31 but
applies to 12.9 with all hunks successful (just a few offsets).
Please test the patch if it works for you (at least if it finds the same amount
of hardware, or more :))
The output from debian's hwinfo and 12.9 patched are not identical though, I
can't tell if there's more information or less, I have it available for display.

thanks,
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

What a strange illusion it is to suppose that beauty is goodness.
-- Lev Tolstoj


signature.asc
Description: Digital signature