« Return to Thread: where to find function list with parameter names for API

Re: where to find function list with parameter names for API

by Dave Ingram :: Rate this Message:

Reply to Author | View in Thread

Simon Cornelius P Umacob wrote:

> I'm new to FUSE and I'm having a bit of trouble with the docs.
>
> Do you guys know where I can find documentation for the FUSE API that
> describes each function in detail?  I can't seem to make sense of
> fuse.h because they don't have parameter names. For instance:
>     int (*getattr) (const char *, struct stat *);    What is char*?
> What is stat*?
>     int (*link) (const char *, const char *);    Where is the source
> and target?  Which is which?
>
> There are examples files and wiki pages that I can read, but I can't
> seem to find all info on the API.
>  
A lot of useful information can be found from reading the example file
systems (such as fusexmp), which give more details. I am planning on
writing up some detailed information about the functions that FUSE will
call, but that will appear on the wiki in the next week or so.

To answer your question immediately, though, the prototypes for the two
functions might look like:

static int myfs_getattr(const char *path, struct stat *fstat) { /* ... */ }
static int myfs_link(const char *oldpath, const char *newpath) { /* ... */ }

getattr() takes two arguments: the path of the file (relative to the
root of your filesystem) that it wants to fetch the attributes for, and
a pointer to a "struct stat" variable that it wants you to fill with the
attributes. The path will always be absolute (i.e. it will start with
"/"), from the base of your file system. If your file system is mounted
at /mnt/myfs and you stat /mnt/myfs/somefile then the FUSE function will
receive "/somefile" as its path argument.

The two arguments for link() are the old path and the new path, relative
to your file system.

Again, if your file system is mounted at /mnt/myfs and you ln
/mnt/myfs/somefile /mnt/myfs/newfile then the FUSE function will receive
"/somefile" and "/newfile" as its path arguments.

Beware: The first argument of symlink() is exactly the path that is
given, and could be absolute or relative, and may not even point to
somewhere in your file system!


Dave

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel

 « Return to Thread: where to find function list with parameter names for API

LightInTheBox - Buy quality products at wholesale price!