On Sat, 25 Nov 2006, Oliver Neukum wrote:
> OK. How about:
>
> struct sysfs_buffer_collection {
> struct list_head associated_buffers;
> struct mutex lock;
> };
>
> struct sysfs_buffer {
> size_t count;
> loff_t pos;
> char * page;
> struct sysfs_buffer_collection * set;
> struct sysfs_ops * ops;
> struct semaphore sem;
> int orphaned;
> int needs_read_fill;
> int event;
> };
>
> close() would take the lock of sysfs_buffer_collection, then remove the
> buffer from the list
> device_remove_file() takes the lock, walks the elemnts, takes their locks and
> sets orphaned,
> then it proceeds normally
> actual IO to the buffers takes the locks and checks orphaned
>
> For validity of sysfs_buffer_collection itself, we depend on the vfs
Go ahead and try to write it. You may find it's a little tricky to create
the sysfs_buffer_collection in the first place (and to delete it at the
end). It may also be hard to acquire the locks for the dentry, the
buffer, and the buffer_collection in the right order.
However it's very easy to test this sort of thing. Just use a little
shell script like this one:
#!/bin/bash
echo -n 'Press RETURN to continue... '
read </dev/tty
exec cat
Run it with stdin redirected to the attribute file, then don't press
RETURN until the driver has been unbound from the device.
Alan Stern
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel