Mail regarding open

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mail regarding open

sankar raman
Hi,

I am rewriting the example filesystem
fusexmp.c by changing the open, read, write
and release system calls.

I modified the open system call to store
the open descriptors in a hash table
and not to close them. So the read and
write system calls will use the descriptor
created by open.

But I am getting the following error:
when I typed cat fd.c

LOOKUP /root/fd.c
   NODEID: 22
   unique: 43, error: 0 (Success), outsize: 136
unique: 44, opcode: OPEN (14), nodeid: 22, insize: 48
OPEN : /root/fd.c //MY PRINTF for debug purposes
Segmentation fault

Thanks in advance
J.Sankararaman

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Mail regarding open

Vincenzo Ciancia
sankar raman wrote:

> But I am getting the following error:
> when I typed cat fd.c
>

If you use the version 2.2 or above of the interface (as fusexmp distributed
with the latest version of fuse does), open has an additional argument,
with type struct fuse file info *, and in its "fh" field you can store your
handle. A struct of the same type, with the fh field filled with the value
that you provided in open(), will be returned to each read(), write() ecc.
call made from the process which performed the open() call.

However, this will not reuse open files on a per-path basis (which is not
posix-compliant, but you might be interest in doing things that way) - to
do that you have to use an hashtable as you are in fact doing. At this
point, the segfault might be caused by not properly locking the hashtable,
because fuse is multithreaded by default, i.e. there can be a different
thread for each request. Try to use the "-s" option to fusexmp, and see if
the error disappears, or post your code here for more advice.

Bye

Vincenzo

--
Please note that I do not read the e-mail address used in the from field but
I read vincenzo_ml at yahoo dot it
Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo
vincenzo_ml at yahoo dot it



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel