LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   sysfs bin file lseek problem (https://www.linuxquestions.org/questions/linux-general-1/sysfs-bin-file-lseek-problem-538616/)

gtopmiller 03-18-2007 10:03 PM

sysfs bin file lseek problem
 
I'm using version 2.6.16.27 release of the kernel and have implemented the w1 driver for the ds2433. In the ds2433_w1 module it creates a sysfs bin file using sysfs_create_bin_file function. This creates a file called /sys/bus/w1/devices/23-00000073aae7/eeprom which I can open, read, and write. I can not lseek. I get an error with errno = 29, which is defined as ESPIPE. The lseek man page indicates "ESPIPE Fildes is associated with a pipe, socket, or FIFO". The ds2433 is not one of these and I don't see any way to add an lseek callback to the sysfs_create_bin_file. I assumed it was inherently part of it. The bin_attribute of the sysfs bin file has read and write callbacks which have an offset as an argument so it should be a simple implementation for lseek. Is there some attribute that needs to be added to have sysfs bin files support lseek?

Thanks for any advice.

gtopmiller 04-10-2007 04:35 PM

This was not really a problem. I was checking for the return value of lseek to be equal to zero and returning an error if it wasn't. lseek will usually return a non-zero value since it is returning the position in the file.


All times are GMT -5. The time now is 04:35 PM.