blob: 758ff25b86bf4d73ea843a1c154f64d6272139f1 [file] [log] [blame]
Miklos Szeredi4cecc252005-09-27 15:42:22 +00001This was generated on 2005/09/27 from
Miklos Szeredia2c5e562004-10-19 22:01:21 +00002
Miklos Szeredi4cecc252005-09-27 15:42:22 +00003 http://fuse.sourceforge.net/wiki/index.php/FAQ
Miklos Szeredia2c5e562004-10-19 22:01:21 +00004
Miklos Szeredi4cecc252005-09-27 15:42:22 +00005For an up to date version please see the above page. You can also add
6new entries there.
Miklos Szeredia2c5e562004-10-19 22:01:21 +00007
Miklos Szeredi4cecc252005-09-27 15:42:22 +00008General
9=======
Miklos Szeredia2c5e562004-10-19 22:01:21 +000010
Miklos Szeredi4cecc252005-09-27 15:42:22 +000011How can I umount a filesystem
12-----------------------------
13
14Filesystems mounted without sysadmin privileges can be umounted with
15the command
16
17 fusermount -u mountpoint
18
19What's the difference between FUSE and LUFS?
20--------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000021
22The main difference between them is that in LUFS the filesystem is a
23shared object (.so) which is loaded by lufsmount, and in FUSE the
24filesystem is a separate executable, which uses the fuse library. The
Miklos Szeredi4cecc252005-09-27 15:42:22 +000025actual API is very similar, and there's a translator, that can load
26LUFS modules and run them using the FUSE kernel module (see the lufis
27package on the FUSE page).
Miklos Szeredia2c5e562004-10-19 22:01:21 +000028
29Another difference is that LUFS does some caching of directories and
30file attributes. FUSE does not do this, so it provides a 'thinner'
31interface.
32
Miklos Szeredi4cecc252005-09-27 15:42:22 +000033By now LUFS development seems to have completely ceased.
Miklos Szeredia2c5e562004-10-19 22:01:21 +000034
Miklos Szeredi4cecc252005-09-27 15:42:22 +000035Why is it called FUSE? There's a ZX Spectrum emulator called Fuse too.
36----------------------------------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000037
Miklos Szeredi4cecc252005-09-27 15:42:22 +000038At the time of christening it, the author of FUSE (the filesystem)
39hadn't heard of Fuse (the Speccy emulator). Which is ironic, since he
40knew Philip Kendall, the author of that other Fuse from earlier times.
41Btw. the author of FUSE (the filesystem) also created a Speccy
42emulator called Spectemu.
Miklos Szeredie5183742005-02-02 11:14:04 +000043
Miklos Szeredi4cecc252005-09-27 15:42:22 +000044The name wanted to be a clever acronym for "Filesystem in USErspace",
45but it turned out to be an unfortunate choice. The author has since
46vowed never to name a project after a common term, not even anything
47found more than a handful of times on Google.
Miklos Szeredie5183742005-02-02 11:14:04 +000048
Miklos Szeredi4cecc252005-09-27 15:42:22 +000049API
50===
Miklos Szeredia2c5e562004-10-19 22:01:21 +000051
Miklos Szeredi4cecc252005-09-27 15:42:22 +000052Which method is called on the close() system call?
53--------------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000054
Miklos Szeredi4cecc252005-09-27 15:42:22 +000055flush() and possibly release(). For details see the documentation of
56these methods in <fuse.h>
Miklos Szeredia2c5e562004-10-19 22:01:21 +000057
Miklos Szeredi4cecc252005-09-27 15:42:22 +000058Wouldn't it be simpler if there were a single close() method?
59-------------------------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000060
Miklos Szeredi4cecc252005-09-27 15:42:22 +000061No, because the relationship between the close() system call and the
62release of the file (the opposite of open) is not as simple as people
63tend to imagine. UNIX allows open files to acquire multiple
64references
Miklos Szeredia2c5e562004-10-19 22:01:21 +000065
Miklos Szeredi4cecc252005-09-27 15:42:22 +000066 * after fork() two processes refer to the same open file
Miklos Szeredia2c5e562004-10-19 22:01:21 +000067
Miklos Szeredi4cecc252005-09-27 15:42:22 +000068 * dup() and dup2() make another file descriptor refer to the same
69 file
Miklos Szeredia2c5e562004-10-19 22:01:21 +000070
Miklos Szeredi4cecc252005-09-27 15:42:22 +000071 * mmap() makes a memory mapping refer to an open file
Miklos Szeredia2c5e562004-10-19 22:01:21 +000072
Miklos Szeredi4cecc252005-09-27 15:42:22 +000073This means, that for a single open() system call, there could be more
74than one close() and possibly munmap() calls until the open file is
75finally released.
Miklos Szeredia2c5e562004-10-19 22:01:21 +000076
Miklos Szeredi4cecc252005-09-27 15:42:22 +000077Can I return an error from release()?
78-------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000079
Miklos Szeredi4cecc252005-09-27 15:42:22 +000080No, it's not possible.
Miklos Szeredia2c5e562004-10-19 22:01:21 +000081
Miklos Szeredi4cecc252005-09-27 15:42:22 +000082If you need to return errors on close, you must do that from flush().
Miklos Szeredia2c5e562004-10-19 22:01:21 +000083
Miklos Szeredi4cecc252005-09-27 15:42:22 +000084How do I know which is the last flush() before release()?
85---------------------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000086
Miklos Szeredi4cecc252005-09-27 15:42:22 +000087You can't. All flush() calls should be treated equally. Anyway it
88wouldn't be worth optimizing away non-final flushes, since it's fairly
89rare to have multiple write-flush sequences on an open file.
Miklos Szeredia2c5e562004-10-19 22:01:21 +000090
Miklos Szeredi4cecc252005-09-27 15:42:22 +000091Why doesn't FUSE forward ioctl() calls to the filesystem?
92---------------------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +000093
Miklos Szeredi4cecc252005-09-27 15:42:22 +000094Because it's not possible: data passed to ioctl() doesn't have a well
95defined length and structure like read() and write(). Consider using
96getxattr() and setxattr() instead.
Miklos Szeredia2c5e562004-10-19 22:01:21 +000097
Miklos Szeredi4cecc252005-09-27 15:42:22 +000098Is there a way to know the uid, gid or pid of the process performing
99--------------------------------------------------------------------
100the operation?
101--------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000102
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000103Yes: fuse_get_context()->uid, etc.
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000104
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000105Problems
106========
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000107
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000108Why are some bytes zeroed when reading a file?
109----------------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000110
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000111This happens if the filesystem returns a short count from the read()
112method. If the file wasn't opened in direct I/O mode, the read()
113method must return exactly the requested number of bytes, unless it's
114the end of the file.
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000115
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000116If the file was opened in direct I/O mode (with direct_io mount
117option, or by setting the direct_io field of fuse_file_info at open)
118the read can return a smaller value than requested. In this case the
119end of file can be signalled by returning zero.
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000120
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000121Why doesn't find work on my filesystem?
122---------------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000123
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000124The st_nlink member must be set correctly for directories to make find
125work. If it's not set correctly the -noleaf option of find can be
126used to make it ignore the hard link count (see man find).
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000127
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000128The correct value of st_nlink for directories is NSUB + 2. Where NSUB
129is the number of subdirectories. NOTE: regular-file/symlink/etc
130entries do not count into NSUB, only directories.
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000131
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000132If calculating NSUB is hard, the filesystem can set st_nlink of
133directories to 1, and find will still work. This is not documented
Miklos Szeredi4322e172005-08-02 09:53:51 +0000134behavior of find, and it's not clear whether this is intended or just
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000135by accident. But for example the NTFS filesysem relies on this, so
136it's unlikely that this "feature" will go away.
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000137
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000138What is the reason for IO errors?
139---------------------------------
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000140
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000141The kernel part of FUSE returns the EIO error value, whenever the
142userspace filesystem sends a "bad" reply. Sometimes these are
143unavoidable, and not necessarily a fault of the filesystem. Possible
144causes of this are (non-exhaustive)
145
146 * the filesystem returned a short count on write()
147
148 * the type of the file has changed (e.g. a directory suddenly
149 became a symlink)
150
151 * a directory entry contained a filename that was too long (no,
152 ENAMETOOLONG is not the right error here)
153
154 * the same node ID value was used for two different directories
155 (i.e. hard-linked directories are not allowed)
156
157Misc
158====
159
160Can the filesystem ask a question on the terminal of the user?
161--------------------------------------------------------------
Miklos Szeredie5183742005-02-02 11:14:04 +0000162
Miklos Szeredia2c5e562004-10-19 22:01:21 +0000163It would not be possible generally speaking, since it might not be an
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000164interactive program but rather a daemon, or a GUI program doing the
165operation. However you should be able to get the PID for the caller,
166and by looking in /proc you should be able to find the process tty or
167something similar.
Miklos Szeredie5183742005-02-02 11:14:04 +0000168
Miklos Szeredi4cecc252005-09-27 15:42:22 +0000169But this is not recommended. You should rather think about solving
170this another way.