Re: How to grab a block of binary data w/out using ioctls?
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. This is my scenario exactly. It is also much easier to make sure the data is coherent if I can grab it all at once. In my case, I'm wanting to add this to the pktgen module, for reporting stats. But, it seems sysfs is designed mostly for drivers with some sort of 'object' behind it. Would I need to create some faked out dummy object in order to use sysfs with pktgen? I also notice there is already a /sys/modules/pktgen node in sysfs..is there any easy way to stick my binary file interface in that directory? Thanks, Ben -- Ben Greear <[EMAIL PROTECTED]> Candela Technologies Inc http://www.candelatech.com - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
* Ben Greear | 2006-10-23 17:44:24 [-0700]: >Since IOCTLs are out of favor these days, what would be >a preferred way to get a block of binary data out of the >kernel? I suggest netlink socket for that purpose! Netlink scales also well if the amount of data "surprisedly" rise. >Thanks, >Ben HGN - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
Jeff Garzik wrote: On Tue, Oct 24, 2006 at 09:52:15PM -0700, Randy.Dunlap wrote: 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); this is ok ack, thanks for looking. ./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, these appear to be incorrect -- ~Randy - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
On Tue, Oct 24, 2006 at 09:52:15PM -0700, Randy.Dunlap wrote: > 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); this is ok > ./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, these appear to be incorrect Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
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_ Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
On Tue, 24 Oct 2006 22:47:18 -0400 Jeff Garzik wrote: > On Tue, Oct 24, 2006 at 07:25:48PM -0700, Ben Greear wrote: > > From reading the Documentation/filesystems/sysfs.txt, it seems like > > it is not recommended that one use sysfs for anything other than > > very simple (and single) attributes. > > > > If you know of a piece of code that actually passes back a struct or > > other binary blob of data, please point me to it so I can learn from it. > > 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. 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? --- ~Randy - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
On Tue, Oct 24, 2006 at 07:25:48PM -0700, Ben Greear wrote: > From reading the Documentation/filesystems/sysfs.txt, it seems like > it is not recommended that one use sysfs for anything other than > very simple (and single) attributes. > > If you know of a piece of code that actually passes back a struct or > other binary blob of data, please point me to it so I can learn from it. Please grep for sysfs_create_bin_file, you will find plenty of examples. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
Jeff Garzik wrote: On Mon, Oct 23, 2006 at 09:54:48PM -0700, Randy Dunlap wrote: Similarly, sysfs is desirable in some circumstances, but not for blocks of binary data. sysfs specifically has APIs for binary data... From reading the Documentation/filesystems/sysfs.txt, it seems like it is not recommended that one use sysfs for anything other than very simple (and single) attributes. If you know of a piece of code that actually passes back a struct or other binary blob of data, please point me to it so I can learn from it. Thanks, Ben Jeff -- Ben Greear <[EMAIL PROTECTED]> Candela Technologies Inc http://www.candelatech.com - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
Jeff Garzik wrote: On Mon, Oct 23, 2006 at 09:54:48PM -0700, Randy Dunlap wrote: Similarly, sysfs is desirable in some circumstances, but not for blocks of binary data. sysfs specifically has APIs for binary data... Ack that, sorry about that. -- ~Randy - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
On Mon, Oct 23, 2006 at 09:54:48PM -0700, Randy Dunlap wrote: > Similarly, sysfs is desirable in some circumstances, but > not for blocks of binary data. sysfs specifically has APIs for binary data... Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to grab a block of binary data w/out using ioctls?
On Mon, 23 Oct 2006 17:44:24 -0700 Ben Greear wrote: > Since IOCTLs are out of favor these days, what would be > a preferred way to get a block of binary data out of the > kernel? > > I just want to grab a stats structure (well-aligned 32 and 64-bit counters > and fixed-length strings) for a pktgen interface. > > Can you do this with seq-files somehow? seq-files just use printk() for text output. Not well-suited to binary output. Similarly, sysfs is desirable in some circumstances, but not for blocks of binary data. ioctls or netlink or debugfs or relay output (see how blktrace uses relay output) are your choices (I may have missed some. :) ioctls can be OK for some purposes. If you want to avoid them, try debugfs or relay. (I haven't looked at debugfs very much; it may be more text-oriented also...) --- ~Randy - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
How to grab a block of binary data w/out using ioctls?
Since IOCTLs are out of favor these days, what would be a preferred way to get a block of binary data out of the kernel? I just want to grab a stats structure (well-aligned 32 and 64-bit counters and fixed-length strings) for a pktgen interface. Can you do this with seq-files somehow? Thanks, Ben -- Ben Greear <[EMAIL PROTECTED]> Candela Technologies Inc http://www.candelatech.com - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html