|
From: Carlson, J. <ja...@mi...> - 2011-03-29 18:52:46
|
Afternoon,
A colleague and I are trying to use FUSE as an in-between to talk to a UIO driver and we're running into some issues. Here's what we want to do. We want an application to read/write to the UIO driver, but at a given offset (as the UIO driver is a passthrough to shared memory). So what we did is create a FUSE filesystem and upon a read we would look up the correct offset based on the argument (path would include the name of the app) and then mmap the memory and pass back what we want...
However, when we tried to do this, the UIO Driver itself seemed inaccessible, so starting from the code fusempl.c we couldn't do a
$cat /tmp/foo/dev/random (if FUSE was mounted on /tmp/foo, with a rootdir / ). So:
mkdir /tmp/foo
fusexmpl /tmpfoo
cat /tmp/foo/dev/random
Permissions denied...
However I noticed that when I changed to a symbolic link in my home directory...
ln -s /dev/random ~/rnd/device
cat /tmp/foo/home/myaccount/rnd/device
gives me what I want... Then the next hurdle was interacting not just with a device, but the UIO device itself.
Now I move onto interacting with UIO driver, and this might be un-necessary but we had to start somewhere and so we adopted the provided source and a symlink to the uio driver. When we do the mmap in uio_readlink; where we specify .readlink = uio_readlink in the fuse_ops struct, we do see the memory (we can log it in the readlink call when the user application calls read, but the user application (the read(fd, &buffer, 100) , where fd = open("/tmp/foo/device" -> /dev/uio0) gets an invalid argument. We suspect that the readlink is functioning well but that an underlying read is getting called somewhere as a read on a uio device is only valid for 4 bytes (the interrupt) and all other sizes result in an invalid argument (which is what we see in the errno).
Again, what we want is from a user program:
open("path/to/fuse/device")
read(fd)...
close
and the corresponding write,
but in the read/write, for the "device" we want to use our UIO handlers to talk directly to the UIO device.
Any help would be greatly appreciated.
Thanks
- Jared
|