Subject: Re: How to grab a block of binary data w/out using ioctls?

From: "Randy.Dunlap" <[email-masked]>
Date: Tue, 24 Oct 2006 21:52:15 -0700

Jeff Garzik wrote:
> On Tue, Oct 24, 2006 at 09:35:49PM -0700, Randy Dunlap wrote:
>>> Please grep for sysfs_create_bin_file, you will find plenty of examples.
>> Hm, I thought that sysfs binary files were supposed to be
>> for "transparent" blobs of data, not for structured data.
>> E.g., a "firmware" blob would be OK.
> 
> Depends.  Normally ASCII is greatly preferred, but passing in/out big
> data structures can be a huge pain, thunking to/from ASCII.
> 
> 
>> And I'm looking at current users.  ISTM that this one:
>>
>> arch/ppc/syslib/mv64x60.c:2443:	sysfs_create_bin_file(&mv64xxx_device.dev.kobj, &mv64xxx_hs_reg_attr);
>>
>> in its sysfs read function returns a string (binary data converted
>> to a string) instead of returning binary data.  Or did I misread it?
>> or misunderstand sysfs binary data?
> 
> Yeah, that one shouldn't be using _bin_

Thanks.  It's not the only one like that.  Also these 3 uses are incorrect AFAICT:

./drivers/firmware/dell_rbu.c:721:	rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
./drivers/firmware/dell_rbu.c:724:	rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr);
./drivers/firmware/dell_rbu.c:727:	rc = sysfs_create_bin_file(&rbu_device->dev.kobj,

-- 
~Randy