2007-02-05 23:28:09

by Jesper Juhl

[permalink] [raw]
Subject: [PATCH][5/5] floppy.c: Fix device_create_file() warning


This fixes the warning
warning: ignoring return value of `device_create_file', declared with attribute warn_unused_result
in function `floppy_init'. It does this by checking the return value and
printing a warning message in case of no success.


Signed-off-by: Jesper Juhl <[email protected]>
---

floppy.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6.20/drivers/block/floppy.c.patch4 2007-02-05 23:22:26.000000000 +0100
+++ linux-2.6.20/drivers/block/floppy.c 2007-02-05 23:32:42.000000000 +0100
@@ -4302,7 +4302,12 @@
if (err)
goto out_flush_work;

- device_create_file(&floppy_device[drive].dev,&dev_attr_cmos);
+ err = device_create_file(&floppy_device[drive].dev, &dev_attr_cmos);
+ if (err)
+ printk(KERN_WARNING "Unable to create sysfs attribute "
+ "file for floppy device: %s\n",
+ floppy_device[drive].name);
+
/* to be cleaned up... */
disks[drive]->private_data = (void *)(long)drive;
disks[drive]->queue = floppy_queue;




2007-02-06 05:59:34

by Gene Heskett

[permalink] [raw]
Subject: Re: [PATCH][5/5] floppy.c: Fix device_create_file() warning

On Monday 05 February 2007 18:30, Jesper Juhl wrote:

And this is almost OT for this, but I'd like to interject here that in
recent history, it has been very very difficult to properly access LSN0
of a floppy. Some formats, such as those laid down by a WD-1773 floppy
controller, do indeed use a sector marking of '0' (zero) on all tracks.

This is akin to an old basic program that had a 'base' statement with an
argument of zero or one. We need, for legacy machines where a floppy
disk sneakernet is in use, to maintain this "base 0" functionality in an
easy to access format. Ditto for sector sizes of 256 and even 128 bytes.

>This fixes the warning
> warning: ignoring return value of `device_create_file', declared with
> attribute warn_unused_result in function `floppy_init'. It does this by
> checking the return value and printing a warning message in case of no
> success.
>
>
>Signed-off-by: Jesper Juhl <[email protected]>
>---
>
> floppy.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>--- linux-2.6.20/drivers/block/floppy.c.patch4 2007-02-05
> 23:22:26.000000000 +0100 +++
> linux-2.6.20/drivers/block/floppy.c 2007-02-05 23:32:42.000000000 +0100
> @@ -4302,7 +4302,12 @@
> if (err)
> goto out_flush_work;
>
>- device_create_file(&floppy_device[drive].dev,&dev_attr_cmos);
>+ err = device_create_file(&floppy_device[drive].dev, &dev_attr_cmos);
>+ if (err)
>+ printk(KERN_WARNING "Unable to create sysfs attribute "
>+ "file for floppy device: %s\n",
>+ floppy_device[drive].name);
>+
> /* to be cleaned up... */
> disks[drive]->private_data = (void *)(long)drive;
> disks[drive]->queue = floppy_queue;
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/

--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2007 by Maurice Eugene Heskett, all rights reserved.

2007-02-06 06:35:04

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH][5/5] floppy.c: Fix device_create_file() warning

Gene Heskett wrote:
> On Monday 05 February 2007 18:30, Jesper Juhl wrote:
>
> And this is almost OT for this, but I'd like to interject here that in
> recent history, it has been very very difficult to properly access LSN0
> of a floppy. Some formats, such as those laid down by a WD-1773 floppy
> controller, do indeed use a sector marking of '0' (zero) on all tracks.
>

I thought the sector numbers of floppy discs were software programmable
(at formatting time.) I believe different OSes used different offsets,
with 1, 2, 3... being the way IBM did it in the PC, but all kinds of
variants were used, including things like 0xa0, 0xa1, ... for no
apparent reason.

-hpa

2007-02-06 16:15:38

by Gene Heskett

[permalink] [raw]
Subject: Re: [PATCH][5/5] floppy.c: Fix device_create_file() warning

On Tuesday 06 February 2007 01:32, H. Peter Anvin wrote:
>Gene Heskett wrote:
>> On Monday 05 February 2007 18:30, Jesper Juhl wrote:
>>
>> And this is almost OT for this, but I'd like to interject here that in
>> recent history, it has been very very difficult to properly access
>> LSN0 of a floppy. Some formats, such as those laid down by a WD-1773
>> floppy controller, do indeed use a sector marking of '0' (zero) on all
>> tracks.
>
>I thought the sector numbers of floppy discs were software programmable
>(at formatting time.) I believe different OSes used different offsets,
>with 1, 2, 3... being the way IBM did it in the PC, but all kinds of
>variants were used, including things like 0xa0, 0xa1, ... for no
>apparent reason.
>
> -hpa
>-
What I'm referring to hpa, is the suite of floppy tools that isn't even in
the FC6 catalog for some reason, fdutils-x.x. In the past when I was
running fc2, I had to go find version 5.4, not 5.5 of that kit, build and
install that, and then revert the floppy stuffs to something borrowed
from a much older kernel before a command of 'setfdprm /dev/fd0 COCO720'
could even get past the syntax error stage, and we traced it down to an
inability to set a track format whose sector numbering scheme included a
sector number of zero as the first sector of the track.

I have a copy of fdutils-5.4 here, which I have not done a make install of
yet for FC6, so I should do a make clean;make;checkinstall --inspect and
see if it will work. I have not be able to do that since about 2.6.8 or
so.

I just installed & tested it, and it appears to work correctly with the
floppy driver in 2.6.20, but I'll see if I can dd a bootable floppy to
it, the acid test for this user anyway... 10 minutes later, looking at
the recovered image with khexedit, it looks good, everything is in the
right place AFAICT, no little one byte offsets apparent. So as long as
I'm using the older fdutils version-5.4, it looks like it works.

If it does not work, then we have locked at least one vintage computer
that I have several of, The TRS-80 Color Computer family, out of talking
to linux by any means. I have also spent the equ of several days trying
to get its file transfer utility rzsz-3.36 based on Chuck Foresburgs
code, to work through a pl2303 usb-serial convertor. Something in the
flow controls I think, I can type back and forth with terminal programs
but nothing that sends large quantities of data works.

Maybe my fears are unfounded ATM, but I did want to voice them.

--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2007 by Maurice Eugene Heskett, all rights reserved.