mirror of
https://github.com/libfuse/libfuse.git
synced 2024-11-23 12:14:15 +08:00
whitespace fixes
This commit is contained in:
parent
ff30a6cd43
commit
e5183747da
104
ChangeLog
104
ChangeLog
@ -4,7 +4,7 @@
|
||||
|
||||
2005-01-28 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix compilation on 2.6.7
|
||||
* Fix compilation on 2.6.7
|
||||
|
||||
2005-01-26 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
@ -47,14 +47,14 @@
|
||||
|
||||
* fusermount: remove capability setting, which was the cause of
|
||||
problems for some users. It seems that FS related capabilities
|
||||
are removed by setfsuid(), so this isn't even needed.
|
||||
are removed by setfsuid(), so this isn't even needed.
|
||||
|
||||
2005-01-15 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* fix compilation on 2.4 kernels (reported by Valient Gough)
|
||||
|
||||
* fix failure to unmount bug (found by David Shaw)
|
||||
|
||||
|
||||
* fusermount: improve parsing of /etc/fuse.conf
|
||||
|
||||
2005-01-13 Miklos Szeredi <miklos@szeredi.hu>
|
||||
@ -141,7 +141,7 @@
|
||||
These will cause some regressions, but stability is considered
|
||||
more important. If any of these features turns out to be
|
||||
important, it can be readded with the deadlock problems addressed.
|
||||
|
||||
|
||||
* Make all requests interruptible (only with SIGKILL currently).
|
||||
This can be used to break any deadlock produced by the userspace
|
||||
filesystem accessing it's own exported files. The RELEASE request
|
||||
@ -245,7 +245,7 @@
|
||||
* fusermount: fix warning if fuse module is not loaded
|
||||
|
||||
* kernel: use /dev/fuse on 2.4 too
|
||||
|
||||
|
||||
2004-11-26 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* libfuse API change: open, read, write, flush, fsync and release
|
||||
@ -347,7 +347,7 @@
|
||||
usually needs to be set to "/usr/local/lib/pkgconfig".
|
||||
|
||||
* fuse.h is now installed in ${prefix}/include/fuse/
|
||||
|
||||
|
||||
2004-11-02 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added "use_ino" mount option. This enables the filesystems to
|
||||
@ -406,21 +406,21 @@
|
||||
|
||||
* Fix mounting and umounting FUSE filesystem under another FUSE
|
||||
filesystem by non-root (bug spotted by Valient Gough)
|
||||
|
||||
|
||||
2004-09-21 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix deadlock in case of memory allocation failure. Patch by
|
||||
Christian Magnusson
|
||||
|
||||
|
||||
2004-09-16 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Check memory allocation failures in libfuse
|
||||
|
||||
|
||||
2004-09-14 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Check temporary file creation failure in do_getdir(). Bug
|
||||
spotted by Terje Oseberg
|
||||
|
||||
|
||||
2004-09-13 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Allow "large_read" option for 2.6 kernels but warn of deprecation
|
||||
@ -429,7 +429,7 @@
|
||||
This is only a temporary solution
|
||||
|
||||
* Support compiling FUSE kernel module on 2.4.x UML kernels
|
||||
|
||||
|
||||
2004-09-09 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix bug in case two FORGETs for the same node are executed in
|
||||
@ -441,13 +441,13 @@
|
||||
* Add -D_REENTRANT to the compile flags
|
||||
|
||||
* Add documentation of fuse internals by Terje Oseberg
|
||||
|
||||
|
||||
2004-08-16 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Change release method to be non-interruptible. Fixes bug
|
||||
causing missing release() call when program which has opened files
|
||||
is killed (reported by Franco Broi and David Shaw)
|
||||
|
||||
|
||||
2004-07-29 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Add fuse_invalidate() to library API
|
||||
@ -465,7 +465,7 @@
|
||||
* Extend kernel API with file handles. A file handle is returned
|
||||
by open, and passed to read, write, flush, fsync and release.
|
||||
This is currently only used for debug output in the library.
|
||||
|
||||
|
||||
* Security changes:
|
||||
|
||||
* Change the current directory to the mountpoint before checking
|
||||
@ -484,16 +484,16 @@
|
||||
* Clean up mount option passing to fusermount and to fuse_new()
|
||||
BEWARE: this changes the userspace API slightly, and the command
|
||||
line usage of programs using fuse_main()
|
||||
|
||||
|
||||
2004-07-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Optimize reading under 2.6 kernels by issuing multiple page
|
||||
asynchronous read requests
|
||||
|
||||
|
||||
2004-07-18 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Only use redirty_page_for_writepage() for kernels >= 2.6.6
|
||||
|
||||
|
||||
2004-07-16 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Separate directory entry and inode attribute validity timer
|
||||
@ -516,13 +516,13 @@
|
||||
|
||||
* If temporary buffer allocation fails in raw read, fall back to a
|
||||
smaller buffer
|
||||
|
||||
|
||||
2004-07-12 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix bug in do_open() in libfuse: open count was incremented
|
||||
after the reply is sent so it could race with unlink/forget and
|
||||
cause an abort.
|
||||
|
||||
|
||||
2004-07-08 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* When performing create or remove operation, refresh the parent's
|
||||
@ -606,24 +606,24 @@
|
||||
* Work with newer libtool (1.5a)
|
||||
|
||||
* Check for st_atim member of struct stat
|
||||
|
||||
|
||||
2004-06-22 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* No request allocation needed on inode and file release
|
||||
|
||||
|
||||
2004-06-21 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix possible inode leak in userspace in case of unfinished
|
||||
lookup/mknod/mkdir/symlink/link operation.
|
||||
|
||||
|
||||
2004-06-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix some races and cleanups in fuse_read_super()
|
||||
|
||||
|
||||
2004-06-19 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Requests are allocated at open time
|
||||
|
||||
|
||||
2004-06-03 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Build shared library as well as static (using libtool)
|
||||
@ -643,23 +643,23 @@
|
||||
* Don't call getdir method from open() only from first readdir().
|
||||
Open is sometimes just used to store the current directory
|
||||
(e.g. find)
|
||||
|
||||
|
||||
2004-05-18 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added flush() call
|
||||
|
||||
|
||||
2004-05-04 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Extended attributes support for 2.4 (patch by Cody Pisto)
|
||||
|
||||
|
||||
2004-04-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fixed parser with modversions (Mattias Wadman)
|
||||
|
||||
|
||||
2004-04-19 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added mount option parser to 2.4 build
|
||||
|
||||
|
||||
2004-04-13 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Replaced binary mount data with text options
|
||||
@ -709,7 +709,7 @@
|
||||
2004-03-02 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* fuse_main() adds "-n progname" to the fusermount command line
|
||||
|
||||
|
||||
* More kernel interface changes:
|
||||
|
||||
* Lookup/getattr return cache timeout values
|
||||
@ -750,11 +750,11 @@
|
||||
* rdev size increased to 32 bits for mknod
|
||||
|
||||
* kernel interface version changed to 3.1
|
||||
|
||||
|
||||
2004-02-18 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* user-mount upgraded for 2.6.3 kernel
|
||||
|
||||
|
||||
2004-02-17 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added user-mount.2.6.2-rc3.patch
|
||||
@ -763,11 +763,11 @@
|
||||
|
||||
* fusermount should allow (un)mounting for non-root even if not
|
||||
suid-root
|
||||
|
||||
|
||||
2004-02-12 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Remove MS_PERMISSION mount flag (that means something else now)
|
||||
|
||||
|
||||
2004-02-10 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added check for i_size_read/write functions to configure.in
|
||||
@ -784,15 +784,15 @@
|
||||
* Use i_size_read/write for accessing inode->i_size
|
||||
|
||||
* Make loopback mount of a fuse file work
|
||||
|
||||
|
||||
2004-02-04 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Released 1.1
|
||||
|
||||
|
||||
2004-01-29 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Properly check if the inode exists in fuse_invalidate
|
||||
|
||||
|
||||
2004-01-27 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added -q option for fusermount
|
||||
@ -812,11 +812,11 @@
|
||||
* Fix typo (thanks Marcos Dione)
|
||||
|
||||
* Compile fixes for 2.4 kernels
|
||||
|
||||
|
||||
2004-01-23 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Fix CONFIG_MODVERSIONS compile on 2.6
|
||||
|
||||
|
||||
2004-01-22 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Write all pending data before a RELEASE operation
|
||||
@ -842,7 +842,7 @@
|
||||
|
||||
* Fix 32-bit dev handling in getattr and mknod for 2.6 kernels.
|
||||
(Note: the mknod method does not yet use 32bit device number)
|
||||
|
||||
|
||||
2004-01-13 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Code cleanups
|
||||
@ -859,7 +859,7 @@
|
||||
|
||||
2004-01-05 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added -d option to fusermount
|
||||
* Added -d option to fusermount
|
||||
|
||||
2003-12-15 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
@ -875,7 +875,7 @@
|
||||
|
||||
2003-12-12 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Make it compile on 2.4.19.
|
||||
* Make it compile on 2.4.19.
|
||||
|
||||
* Add fsync operation (write file failed on xemacs & vi)
|
||||
|
||||
@ -903,7 +903,7 @@
|
||||
- Added '__init__' handler to base Fuse class, which allows
|
||||
your Python class to know the mountpoint and mount args,
|
||||
as attributes myfs.mountpoint, myfs.optlist, myfs.optdict
|
||||
|
||||
|
||||
* General:
|
||||
- added 'mount.fuse' script (in util/ dir), which is meant to be
|
||||
symlinked from /sbin, and which allows FUSE filesystems to
|
||||
@ -924,11 +924,11 @@
|
||||
|
||||
* Mtab handling fix in fusermount by "Valient Gough" (SF patch
|
||||
#766443)
|
||||
|
||||
|
||||
2003-10-13 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Error code fixes in kernel module
|
||||
|
||||
|
||||
2003-10-04 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* kernel version detection fix
|
||||
@ -1032,7 +1032,7 @@
|
||||
2002-01-09 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Version 0.95 released
|
||||
|
||||
|
||||
2002-01-09 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Revaidate all path components not just the last, this means a
|
||||
@ -1043,7 +1043,7 @@
|
||||
* Update and fix python interface
|
||||
|
||||
2002-01-07 Mark Glines <mark@glines.org>
|
||||
|
||||
|
||||
* Added statfs() support to kernel, lib, examples, and perl!
|
||||
|
||||
2001-12-26 Miklos Szeredi <miklos@szeredi.hu>
|
||||
@ -1053,10 +1053,10 @@
|
||||
* Ported to Compaq IPAQ
|
||||
|
||||
2001-12-20 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
|
||||
* Added function fuse_get_context() to library API (inspired by
|
||||
patch from Matt Ryan)
|
||||
|
||||
patch from Matt Ryan)
|
||||
|
||||
* Added flags to fusermount and to kernel interface to control
|
||||
permission checking
|
||||
|
||||
@ -1069,7 +1069,7 @@
|
||||
|
||||
2001-12-02 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Added perl bindings by Mark Glines
|
||||
* Added perl bindings by Mark Glines
|
||||
|
||||
2001-11-21 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
@ -1078,7 +1078,7 @@
|
||||
* fuse_main() helper function added
|
||||
|
||||
2001-11-18 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
|
||||
* Optimized read/write operations, so that minimal copying of data
|
||||
is done
|
||||
|
||||
|
32
FAQ
32
FAQ
@ -29,10 +29,10 @@ Subject: close() not in struct fuse_operations
|
||||
> Is there a reason for 'close' not being one of the
|
||||
> fuse_operations? I'd need to know when files are
|
||||
> closed...
|
||||
|
||||
|
||||
It's not easy. Consider mmap(): if you have a memory file, even after
|
||||
closing it, you can read or write the file through memory.
|
||||
|
||||
closing it, you can read or write the file through memory.
|
||||
|
||||
Despite this there are close()-like operations: flush and release.
|
||||
Flush gets called on each close() and release gets called when there
|
||||
are no more uses of a file, including memory mappings.
|
||||
@ -58,7 +58,7 @@ writing for example, and use that information for finally flushing
|
||||
dirty data of a file.
|
||||
|
||||
> So it appears that there may even be additional file operations after
|
||||
> one or more of the release calls..
|
||||
> one or more of the release calls..
|
||||
|
||||
That is expected also. It would be a bug if there were reads/writes
|
||||
after the last release, or if the number of releases didn't match the
|
||||
@ -82,7 +82,7 @@ In release() the error value is ignored, and not every close will
|
||||
cause a release. Consider this:
|
||||
|
||||
- process opens a file
|
||||
- process forks
|
||||
- process forks
|
||||
- parent closes the file
|
||||
- child closes the file
|
||||
|
||||
@ -125,7 +125,7 @@ Subject: Short reads
|
||||
> bytes. What I expected to see was the kernel to then issue a read for
|
||||
> length 65536 and offset 10. Instead what I saw in the result was the
|
||||
> 10 bytes I returned, followed by 65526 zero bytes.
|
||||
>
|
||||
>
|
||||
> Is this the intended behavior?
|
||||
|
||||
Yes. You can easily program around it with a for-loop in your read
|
||||
@ -135,14 +135,14 @@ function.
|
||||
> difference, I'd like to suggest doing it the other way: many people
|
||||
> (like me) implement their fuse read function in terms of read(), and
|
||||
> read() can return early.
|
||||
|
||||
No. Read from a pipe/socket can be short, but read from a file can't.
|
||||
|
||||
No. Read from a pipe/socket can be short, but read from a file can't.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Subject: protocol error
|
||||
|
||||
> I'm having trouble with file writing. I can
|
||||
> 'echo something > file' to a file, but
|
||||
> I'm having trouble with file writing. I can
|
||||
> 'echo something > file' to a file, but
|
||||
> 'cp file something' or 'cat something > file'
|
||||
> gives a protocol error.
|
||||
|
||||
@ -176,14 +176,14 @@ Subject: Uid/gid/pid
|
||||
> Is there any easy way to know the uid of a reader? For example, let's
|
||||
> say I wanted to create a file that contained 'foo' for uid 1, but
|
||||
> 'bar' for uid 2.
|
||||
|
||||
Yes:
|
||||
|
||||
|
||||
Yes:
|
||||
|
||||
fuse_get_context()->uid
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Subject: 'find' command
|
||||
Subject: 'find' command
|
||||
|
||||
|
||||
> I'm having trouble getting the find command to search through fuse
|
||||
@ -208,7 +208,7 @@ Subject: File system interactivity
|
||||
> question to the terminal that issued the request.
|
||||
>
|
||||
> Is there a way I can achieve this goal?
|
||||
|
||||
|
||||
It would not be possible generally speaking, since it might not be an
|
||||
interactive program but rather a daemon, or a GUI program creating the
|
||||
file. However you should be able to get the PID for the caller, and
|
||||
@ -217,4 +217,4 @@ something similar. Perhaps it would be better to redesign your program
|
||||
not to have such interactivity anyway, try to use e.g. extended
|
||||
attributes of files to set per-file options, or a configuration file
|
||||
for your filesystem.
|
||||
|
||||
|
||||
|
10
Filesystems
10
Filesystems
@ -51,7 +51,7 @@ Download: http://www.select-tech.si/fuse/
|
||||
|
||||
Alternate download: http://www.cl.cam.ac.uk/~tdm25/fuse-j/
|
||||
|
||||
Description:
|
||||
Description:
|
||||
|
||||
FUSE-J provides Java binding for FUSE. It comes with the
|
||||
"proof-of-concept" ZIP filesystem which seems to be pretty stable.
|
||||
@ -92,10 +92,10 @@ Homepage: http://www.freenet.org.nz/phonebook
|
||||
|
||||
Description:
|
||||
|
||||
PhoneBook is expressly designed for use in situations where someone can
|
||||
be under pressure (legal, military and/or criminal) to disclose
|
||||
decryption keys, and has a 'chaffing' scheme whereby the user can
|
||||
disclose only passphrases for non-sensitive material, and credibly deny
|
||||
PhoneBook is expressly designed for use in situations where someone can
|
||||
be under pressure (legal, military and/or criminal) to disclose
|
||||
decryption keys, and has a 'chaffing' scheme whereby the user can
|
||||
disclose only passphrases for non-sensitive material, and credibly deny
|
||||
the existence of anything else.
|
||||
|
||||
==============================================================================
|
||||
|
4
README
4
README
@ -60,7 +60,7 @@ Security
|
||||
|
||||
If you run 'make install', the fusermount program is installed
|
||||
set-user-id to root. This is done to allow normal users to mount
|
||||
their own filesystem implementations.
|
||||
their own filesystem implementations.
|
||||
|
||||
There must however be some limitations, in order to prevent Bad User from
|
||||
doing nasty things. Currently those limitations are:
|
||||
@ -176,4 +176,4 @@ debug
|
||||
fsname=NAME
|
||||
|
||||
Sets the filesystem name. The default is the program name.
|
||||
|
||||
|
||||
|
@ -7,10 +7,10 @@ m4_ifdef([LT_INIT],
|
||||
[AC_PROG_LIBTOOL])
|
||||
AC_PROG_CC
|
||||
|
||||
# compatibility for automake < 1.8
|
||||
# compatibility for automake < 1.8
|
||||
if test -z "$mkdir_p"; then
|
||||
mkdir_p="../mkinstalldirs"
|
||||
AC_SUBST(mkdir_p)
|
||||
AC_SUBST(mkdir_p)
|
||||
fi
|
||||
|
||||
CFLAGS="-Wall -W -g -O2"
|
||||
|
@ -153,7 +153,7 @@ static int xmp_chmod(const char *path, mode_t mode)
|
||||
res = chmod(path, mode);
|
||||
if(res == -1)
|
||||
return -errno;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ static int xmp_chown(const char *path, uid_t uid, gid_t gid)
|
||||
static int xmp_truncate(const char *path, off_t size)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
||||
res = truncate(path, size);
|
||||
if(res == -1)
|
||||
return -errno;
|
||||
@ -182,7 +182,7 @@ static int xmp_truncate(const char *path, off_t size)
|
||||
static int xmp_utime(const char *path, struct utimbuf *buf)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
||||
res = utime(path, buf);
|
||||
if(res == -1)
|
||||
return -errno;
|
||||
@ -196,7 +196,7 @@ static int xmp_open(const char *path, struct fuse_file_info *fi)
|
||||
int res;
|
||||
|
||||
res = open(path, fi->flags);
|
||||
if(res == -1)
|
||||
if(res == -1)
|
||||
return -errno;
|
||||
|
||||
close(res);
|
||||
@ -217,7 +217,7 @@ static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
|
||||
res = pread(fd, buf, size, offset);
|
||||
if(res == -1)
|
||||
res = -errno;
|
||||
|
||||
|
||||
close(fd);
|
||||
return res;
|
||||
}
|
||||
@ -236,7 +236,7 @@ static int xmp_write(const char *path, const char *buf, size_t size,
|
||||
res = pwrite(fd, buf, size, offset);
|
||||
if(res == -1)
|
||||
res = -errno;
|
||||
|
||||
|
||||
close(fd);
|
||||
return res;
|
||||
}
|
||||
@ -256,7 +256,7 @@ static int xmp_release(const char *path, struct fuse_file_info *fi)
|
||||
{
|
||||
/* Just a stub. This method is optional and can safely be left
|
||||
unimplemented */
|
||||
|
||||
|
||||
(void) path;
|
||||
(void) fi;
|
||||
return 0;
|
||||
|
@ -65,7 +65,7 @@ static int hello_read(const char *path, char *buf, size_t size, off_t offset,
|
||||
(void) fi;
|
||||
if(strcmp(path, hello_path) != 0)
|
||||
return -ENOENT;
|
||||
|
||||
|
||||
len = strlen(hello_str);
|
||||
if (offset < len) {
|
||||
if (offset + size > len)
|
||||
|
@ -18,7 +18,7 @@ static int null_getattr(const char *path, struct stat *stbuf)
|
||||
{
|
||||
if(strcmp(path, "/") != 0)
|
||||
return -ENOENT;
|
||||
|
||||
|
||||
stbuf->st_mode = S_IFREG | 0644;
|
||||
stbuf->st_nlink = 1;
|
||||
stbuf->st_uid = getuid();
|
||||
|
@ -51,7 +51,7 @@ struct fuse;
|
||||
typedef struct fuse_dirhandle *fuse_dirh_t;
|
||||
|
||||
/** Function to add an entry in a getdir() operation
|
||||
*
|
||||
*
|
||||
* @param h the handle passed to the getdir() operation
|
||||
* @param name the file name of the directory entry
|
||||
* @param type the file type (0 if unknown) see <dirent.h>
|
||||
@ -82,7 +82,7 @@ struct fuse_file_info {
|
||||
* Most of these should work very similarly to the well known UNIX
|
||||
* file system operations. A major exception is that instead of
|
||||
* returning an error in 'errno', the operation should return the
|
||||
* negated error value (-errno) directly.
|
||||
* negated error value (-errno) directly.
|
||||
*
|
||||
* All methods are optional, but some are essential for a useful
|
||||
* filesystem (e.g. getattr). Flush, release and fsync are special
|
||||
@ -99,7 +99,7 @@ struct fuse_operations {
|
||||
int (*getattr) (const char *, struct stat *);
|
||||
|
||||
/** Read the target of a symbolic link
|
||||
*
|
||||
*
|
||||
* The buffer should be filled with a null terminated string. The
|
||||
* buffer size argument includes the space for the terminating
|
||||
* null character. If the linkname is too long to fit in the
|
||||
@ -140,19 +140,19 @@ struct fuse_operations {
|
||||
|
||||
/** Create a hard link to a file */
|
||||
int (*link) (const char *, const char *);
|
||||
|
||||
|
||||
/** Change the permission bits of a file */
|
||||
int (*chmod) (const char *, mode_t);
|
||||
|
||||
|
||||
/** Change the owner and group of a file */
|
||||
int (*chown) (const char *, uid_t, gid_t);
|
||||
|
||||
|
||||
/** Change the size of a file */
|
||||
int (*truncate) (const char *, off_t);
|
||||
|
||||
|
||||
/** Change the access and/or modification times of a file */
|
||||
int (*utime) (const char *, struct utimbuf *);
|
||||
|
||||
|
||||
/** File open operation
|
||||
*
|
||||
* No creation, or trunctation flags (O_CREAT, O_EXCL, O_TRUNC)
|
||||
@ -174,8 +174,8 @@ struct fuse_operations {
|
||||
*/
|
||||
int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *);
|
||||
|
||||
/** Write data to an open file
|
||||
*
|
||||
/** Write data to an open file
|
||||
*
|
||||
* Write should return exactly the number of bytes requested
|
||||
* except on error. An exception to this is when the 'direct_io'
|
||||
* mount option is specified (see read operation).
|
||||
@ -184,13 +184,13 @@ struct fuse_operations {
|
||||
struct fuse_file_info *);
|
||||
|
||||
/** Get file system statistics
|
||||
*
|
||||
*
|
||||
* The 'f_type' and 'f_fsid' fields are ignored
|
||||
*/
|
||||
int (*statfs) (const char *, struct statfs *);
|
||||
|
||||
/** Possibly flush cached data
|
||||
*
|
||||
/** Possibly flush cached data
|
||||
*
|
||||
* BIG NOTE: This is not equivalent to fsync(). It's not a
|
||||
* request to sync dirty data.
|
||||
*
|
||||
@ -199,7 +199,7 @@ struct fuse_operations {
|
||||
* has cached dirty data, this is a good place to write back data
|
||||
* and return any errors. Since many applications ignore close()
|
||||
* errors this is not always useful.
|
||||
*
|
||||
*
|
||||
* NOTE: The flush() method may be called more than once for each
|
||||
* open(). This happens if more than one file descriptor refers
|
||||
* to an opened file due to dup(), dup2() or fork() calls. It is
|
||||
@ -210,7 +210,7 @@ struct fuse_operations {
|
||||
int (*flush) (const char *, struct fuse_file_info *);
|
||||
|
||||
/** Release an open file
|
||||
*
|
||||
*
|
||||
* Release is called when there are no more references to an open
|
||||
* file: all file descriptors are closed and all memory mappings
|
||||
* are unmapped.
|
||||
@ -229,21 +229,21 @@ struct fuse_operations {
|
||||
* should be flushed, not the meta data.
|
||||
*/
|
||||
int (*fsync) (const char *, int, struct fuse_file_info *);
|
||||
|
||||
|
||||
/** Set extended attributes */
|
||||
int (*setxattr) (const char *, const char *, const char *, size_t, int);
|
||||
|
||||
|
||||
/** Get extended attributes */
|
||||
int (*getxattr) (const char *, const char *, char *, size_t);
|
||||
|
||||
|
||||
/** List extended attributes */
|
||||
int (*listxattr) (const char *, char *, size_t);
|
||||
|
||||
|
||||
/** Remove extended attributes */
|
||||
int (*removexattr) (const char *, const char *);
|
||||
};
|
||||
|
||||
/** Extra context that may be needed by some filesystems
|
||||
/** Extra context that may be needed by some filesystems
|
||||
*
|
||||
* The uid, gid and pid fields are not filled in case of a writepage
|
||||
* operation.
|
||||
@ -251,7 +251,7 @@ struct fuse_operations {
|
||||
struct fuse_context {
|
||||
/** Pointer to the fuse object */
|
||||
struct fuse *fuse;
|
||||
|
||||
|
||||
/** User ID of the calling process */
|
||||
uid_t uid;
|
||||
|
||||
@ -270,7 +270,7 @@ struct fuse_context {
|
||||
*
|
||||
* This is for the lazy. This is all that has to be called from the
|
||||
* main() function.
|
||||
*
|
||||
*
|
||||
* This function does the following:
|
||||
* - parses command line options (-d -s and -h)
|
||||
* - passes relevant mount options to the fuse_mount()
|
||||
@ -284,7 +284,7 @@ struct fuse_context {
|
||||
*
|
||||
* @param argc the argument counter passed to the main() function
|
||||
* @param argv the argument vector passed to the main() function
|
||||
* @param op the file system operation
|
||||
* @param op the file system operation
|
||||
* @return 0 on success, nonzero on failure
|
||||
*/
|
||||
/*
|
||||
@ -325,11 +325,11 @@ void fuse_unmount(const char *mountpoint);
|
||||
* @param op_size the size of the fuse_operations structure
|
||||
* @return the created FUSE handle
|
||||
*/
|
||||
struct fuse *fuse_new(int fd, const char *opts,
|
||||
struct fuse *fuse_new(int fd, const char *opts,
|
||||
const struct fuse_operations *op, size_t op_size);
|
||||
|
||||
/**
|
||||
* Destroy the FUSE handle.
|
||||
* Destroy the FUSE handle.
|
||||
*
|
||||
* The filesystem is not unmounted.
|
||||
*
|
||||
@ -341,7 +341,7 @@ void fuse_destroy(struct fuse *f);
|
||||
* FUSE event loop.
|
||||
*
|
||||
* Requests from the kernel are processed, and the apropriate
|
||||
* operations are called.
|
||||
* operations are called.
|
||||
*
|
||||
* @param f the FUSE handle
|
||||
* @return 0 if no error occured, -1 otherwise
|
||||
@ -372,12 +372,12 @@ int fuse_loop_mt(struct fuse *f);
|
||||
|
||||
/**
|
||||
* Get the current context
|
||||
*
|
||||
*
|
||||
* The context is only valid for the duration of a filesystem
|
||||
* operation, and thus must not be stored and used later.
|
||||
*
|
||||
* @param f the FUSE handle
|
||||
* @return the context
|
||||
* @return the context
|
||||
*/
|
||||
struct fuse_context *fuse_get_context(void);
|
||||
|
||||
@ -402,7 +402,7 @@ int fuse_is_lib_option(const char *opt);
|
||||
|
||||
/**
|
||||
* The real main function
|
||||
*
|
||||
*
|
||||
* Do not call this directly, use fuse_main()
|
||||
*/
|
||||
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
|
||||
|
@ -32,7 +32,7 @@ fi
|
||||
if test -z "$kernsrcver"; then
|
||||
AC_MSG_RESULT([Not found])
|
||||
AC_MSG_ERROR([
|
||||
*** Cannot determine the version of the linux kernel source. Please
|
||||
*** Cannot determine the version of the linux kernel source. Please
|
||||
*** configure the kernel before running this script])
|
||||
fi
|
||||
AC_MSG_RESULT([$kernsrcver])
|
||||
@ -86,7 +86,7 @@ if test "$ENABLE_FUSE_MODULE" = y; then
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
isuml=no
|
||||
KERNELMAKE_PARAMS=
|
||||
KERNELCPPFLAGS=
|
||||
|
108
lib/fuse.c
108
lib/fuse.c
@ -77,11 +77,11 @@ struct fuse_getdir_out {
|
||||
__u32 fd;
|
||||
};
|
||||
|
||||
#define FUSE_GETDIR 7
|
||||
#define FUSE_GETDIR 7
|
||||
|
||||
static const char *opname(enum fuse_opcode opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
switch (opcode) {
|
||||
case FUSE_LOOKUP: return "LOOKUP";
|
||||
case FUSE_FORGET: return "FORGET";
|
||||
case FUSE_GETATTR: return "GETATTR";
|
||||
@ -136,7 +136,7 @@ static struct node *get_node_nocheck(struct fuse *f, nodeid_t nodeid)
|
||||
for (node = f->id_table[hash]; node != NULL; node = node->id_next)
|
||||
if (node->nodeid == nodeid)
|
||||
return node;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ static void unhash_id(struct fuse *f, struct node *node)
|
||||
size_t hash = node->nodeid % f->id_table_size;
|
||||
struct node **nodep = &f->id_table[hash];
|
||||
|
||||
for (; *nodep != NULL; nodep = &(*nodep)->id_next)
|
||||
for (; *nodep != NULL; nodep = &(*nodep)->id_next)
|
||||
if (*nodep == node) {
|
||||
*nodep = node->id_next;
|
||||
return;
|
||||
@ -173,7 +173,7 @@ static void hash_id(struct fuse *f, struct node *node)
|
||||
{
|
||||
size_t hash = node->nodeid % f->id_table_size;
|
||||
node->id_next = f->id_table[hash];
|
||||
f->id_table[hash] = node;
|
||||
f->id_table[hash] = node;
|
||||
}
|
||||
|
||||
static unsigned int name_hash(struct fuse *f, nodeid_t parent, const char *name)
|
||||
@ -194,7 +194,7 @@ static void unhash_name(struct fuse *f, struct node *node)
|
||||
if (node->name) {
|
||||
size_t hash = name_hash(f, node->parent, node->name);
|
||||
struct node **nodep = &f->name_table[hash];
|
||||
|
||||
|
||||
for (; *nodep != NULL; nodep = &(*nodep)->name_next)
|
||||
if (*nodep == node) {
|
||||
*nodep = node->name_next;
|
||||
@ -270,7 +270,7 @@ static struct node *find_node(struct fuse *f, nodeid_t parent, char *name,
|
||||
struct node *node;
|
||||
int mode = attr->mode & S_IFMT;
|
||||
int rdev = 0;
|
||||
|
||||
|
||||
if (S_ISCHR(mode) || S_ISBLK(mode))
|
||||
rdev = attr->rdev;
|
||||
|
||||
@ -278,12 +278,12 @@ static struct node *find_node(struct fuse *f, nodeid_t parent, char *name,
|
||||
node = lookup_node(f, parent, name);
|
||||
if (node != NULL) {
|
||||
if (!(f->flags & FUSE_USE_INO))
|
||||
attr->ino = node->nodeid;
|
||||
attr->ino = node->nodeid;
|
||||
} else {
|
||||
node = (struct node *) calloc(1, sizeof(struct node));
|
||||
if (node == NULL)
|
||||
goto out_err;
|
||||
|
||||
|
||||
node->refctr = 1;
|
||||
node->nodeid = next_id(f);
|
||||
if (!(f->flags & FUSE_USE_INO))
|
||||
@ -324,7 +324,7 @@ static char *get_path_name(struct fuse *f, nodeid_t nodeid, const char *name)
|
||||
char buf[FUSE_MAX_PATH];
|
||||
char *s = buf + FUSE_MAX_PATH - 1;
|
||||
struct node *node;
|
||||
|
||||
|
||||
*s = '\0';
|
||||
|
||||
if (name != NULL) {
|
||||
@ -340,7 +340,7 @@ static char *get_path_name(struct fuse *f, nodeid_t nodeid, const char *name)
|
||||
s = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
s = add_name(buf, s, node->name);
|
||||
if (s == NULL)
|
||||
break;
|
||||
@ -392,7 +392,7 @@ static int rename_node(struct fuse *f, nodeid_t olddir, const char *oldname,
|
||||
struct node *node;
|
||||
struct node *newnode;
|
||||
int err = 0;
|
||||
|
||||
|
||||
pthread_mutex_lock(&f->lock);
|
||||
node = lookup_node(f, olddir, oldname);
|
||||
newnode = lookup_node(f, newdir, newname);
|
||||
@ -407,13 +407,13 @@ static int rename_node(struct fuse *f, nodeid_t olddir, const char *oldname,
|
||||
}
|
||||
unhash_name(f, newnode);
|
||||
}
|
||||
|
||||
|
||||
unhash_name(f, node);
|
||||
if (hash_name(f, node, newdir, newname) == -1) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
if (hide)
|
||||
node->is_hidden = 1;
|
||||
|
||||
@ -485,7 +485,7 @@ static int send_reply_raw(struct fuse *f, char *outbuf, size_t outsize)
|
||||
out->unique, out->error, strerror(-out->error), outsize);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
/* This needs to be done before the reply, otherwise the scheduler
|
||||
could play tricks with us, and only let the counter be
|
||||
increased long after the operation is done */
|
||||
@ -529,7 +529,7 @@ static int send_reply(struct fuse *f, struct fuse_in_header *in, int error,
|
||||
out->error = error;
|
||||
if (argsize != 0)
|
||||
memcpy(outbuf + sizeof(struct fuse_out_header), arg, argsize);
|
||||
|
||||
|
||||
res = send_reply_raw(f, outbuf, outsize);
|
||||
free(outbuf);
|
||||
}
|
||||
@ -576,11 +576,11 @@ static char *hidden_name(struct fuse *f, nodeid_t dir, const char *oldname,
|
||||
newnode = lookup_node(f, dir, newname);
|
||||
} while(newnode);
|
||||
pthread_mutex_unlock(&f->lock);
|
||||
|
||||
|
||||
newpath = get_path_name(f, dir, newname);
|
||||
if (!newpath)
|
||||
break;
|
||||
|
||||
|
||||
res = f->op.getattr(newpath, &buf);
|
||||
if (res != 0)
|
||||
break;
|
||||
@ -714,7 +714,7 @@ static int do_chmod(struct fuse *f, const char *path, struct fuse_attr *attr)
|
||||
res = f->op.chmod(path, attr->mode);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static int do_chown(struct fuse *f, const char *path, struct fuse_attr *attr,
|
||||
int valid)
|
||||
@ -722,7 +722,7 @@ static int do_chown(struct fuse *f, const char *path, struct fuse_attr *attr,
|
||||
int res;
|
||||
uid_t uid = (valid & FATTR_UID) ? attr->uid : (uid_t) -1;
|
||||
gid_t gid = (valid & FATTR_GID) ? attr->gid : (gid_t) -1;
|
||||
|
||||
|
||||
res = -ENOSYS;
|
||||
if (f->op.chown)
|
||||
res = f->op.chown(path, uid, gid);
|
||||
@ -776,7 +776,7 @@ static void do_setattr(struct fuse *f, struct fuse_in_header *in,
|
||||
res = do_chown(f, path, attr, valid);
|
||||
if (!res && (valid & FATTR_SIZE))
|
||||
res = do_truncate(f, path, attr);
|
||||
if (!res && (valid & (FATTR_ATIME | FATTR_MTIME)) ==
|
||||
if (!res && (valid & (FATTR_ATIME | FATTR_MTIME)) ==
|
||||
(FATTR_ATIME | FATTR_MTIME))
|
||||
res = do_utime(f, path, attr);
|
||||
if (!res) {
|
||||
@ -1017,7 +1017,7 @@ static void do_rename(struct fuse *f, struct fuse_in_header *in,
|
||||
res = -ENOSYS;
|
||||
if (f->op.rename) {
|
||||
res = 0;
|
||||
if (!(f->flags & FUSE_HARD_REMOVE) &&
|
||||
if (!(f->flags & FUSE_HARD_REMOVE) &&
|
||||
is_open(f, newdir, newname))
|
||||
res = hide_node(f, newpath, newdir, newname);
|
||||
if (res == 0) {
|
||||
@ -1030,7 +1030,7 @@ static void do_rename(struct fuse *f, struct fuse_in_header *in,
|
||||
}
|
||||
free(oldpath);
|
||||
}
|
||||
send_reply(f, in, res, NULL, 0);
|
||||
send_reply(f, in, res, NULL, 0);
|
||||
}
|
||||
|
||||
static void do_link(struct fuse *f, struct fuse_in_header *in,
|
||||
@ -1096,7 +1096,7 @@ static void do_open(struct fuse *f, struct fuse_in_header *in,
|
||||
printf("OPEN[%lu] flags: 0x%x\n", fi.fh, arg->flags);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
pthread_mutex_lock(&f->lock);
|
||||
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
|
||||
if(res2 == -ENOENT) {
|
||||
@ -1173,10 +1173,10 @@ static void do_release(struct fuse *f, struct fuse_in_header *in,
|
||||
else if (path)
|
||||
((struct fuse_operations_compat2 *) &f->op)->release(path, fi.flags);
|
||||
}
|
||||
|
||||
|
||||
if(unlink_hidden && path)
|
||||
f->op.unlink(path);
|
||||
|
||||
|
||||
if (path)
|
||||
free(path);
|
||||
|
||||
@ -1197,7 +1197,7 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
|
||||
size_t size;
|
||||
size_t outsize;
|
||||
struct fuse_file_info fi;
|
||||
|
||||
|
||||
memset(&fi, 0, sizeof(fi));
|
||||
fi.fh = arg->fh;
|
||||
|
||||
@ -1209,13 +1209,13 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
|
||||
(unsigned long) arg->fh, arg->size, arg->offset);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
res = -ENOSYS;
|
||||
if (f->op.read)
|
||||
res = f->op.read(path, buf, arg->size, arg->offset, &fi);
|
||||
free(path);
|
||||
}
|
||||
|
||||
|
||||
size = 0;
|
||||
if (res >= 0) {
|
||||
size = res;
|
||||
@ -1230,7 +1230,7 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
|
||||
out->unique = in->unique;
|
||||
out->error = res;
|
||||
outsize = sizeof(struct fuse_out_header) + size;
|
||||
|
||||
|
||||
send_reply_raw(f, outbuf, outsize);
|
||||
free(outbuf);
|
||||
}
|
||||
@ -1263,8 +1263,8 @@ static void do_write(struct fuse *f, struct fuse_in_header *in,
|
||||
res = f->op.write(path, PARAM(arg), arg->size, arg->offset, &fi);
|
||||
free(path);
|
||||
}
|
||||
|
||||
if (res >= 0) {
|
||||
|
||||
if (res >= 0) {
|
||||
outarg.size = res;
|
||||
res = 0;
|
||||
}
|
||||
@ -1369,7 +1369,7 @@ static void do_setxattr(struct fuse *f, struct fuse_in_header *in,
|
||||
if (f->op.setxattr)
|
||||
res = f->op.setxattr(path, name, value, arg->size, arg->flags);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
send_reply(f, in, res, NULL, 0);
|
||||
}
|
||||
|
||||
@ -1386,7 +1386,7 @@ static int common_getxattr(struct fuse *f, struct fuse_in_header *in,
|
||||
if (f->op.getxattr)
|
||||
res = f->op.getxattr(path, name, value, size);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1400,7 +1400,7 @@ static void do_getxattr_read(struct fuse *f, struct fuse_in_header *in,
|
||||
else {
|
||||
struct fuse_out_header *out = (struct fuse_out_header *) outbuf;
|
||||
char *value = outbuf + sizeof(struct fuse_out_header);
|
||||
|
||||
|
||||
res = common_getxattr(f, in, name, value, size);
|
||||
size = 0;
|
||||
if (res > 0) {
|
||||
@ -1410,7 +1410,7 @@ static void do_getxattr_read(struct fuse *f, struct fuse_in_header *in,
|
||||
memset(out, 0, sizeof(struct fuse_out_header));
|
||||
out->unique = in->unique;
|
||||
out->error = res;
|
||||
|
||||
|
||||
send_reply_raw(f, outbuf, sizeof(struct fuse_out_header) + size);
|
||||
free(outbuf);
|
||||
}
|
||||
@ -1434,7 +1434,7 @@ static void do_getxattr(struct fuse *f, struct fuse_in_header *in,
|
||||
struct fuse_getxattr_in *arg)
|
||||
{
|
||||
char *name = PARAM(arg);
|
||||
|
||||
|
||||
if (arg->size)
|
||||
do_getxattr_read(f, in, name, arg->size);
|
||||
else
|
||||
@ -1454,7 +1454,7 @@ static int common_listxattr(struct fuse *f, struct fuse_in_header *in,
|
||||
if (f->op.listxattr)
|
||||
res = f->op.listxattr(path, list, size);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1468,7 +1468,7 @@ static void do_listxattr_read(struct fuse *f, struct fuse_in_header *in,
|
||||
else {
|
||||
struct fuse_out_header *out = (struct fuse_out_header *) outbuf;
|
||||
char *list = outbuf + sizeof(struct fuse_out_header);
|
||||
|
||||
|
||||
res = common_listxattr(f, in, list, size);
|
||||
size = 0;
|
||||
if (res > 0) {
|
||||
@ -1478,7 +1478,7 @@ static void do_listxattr_read(struct fuse *f, struct fuse_in_header *in,
|
||||
memset(out, 0, sizeof(struct fuse_out_header));
|
||||
out->unique = in->unique;
|
||||
out->error = res;
|
||||
|
||||
|
||||
send_reply_raw(f, outbuf, sizeof(struct fuse_out_header) + size);
|
||||
free(outbuf);
|
||||
}
|
||||
@ -1519,7 +1519,7 @@ static void do_removexattr(struct fuse *f, struct fuse_in_header *in,
|
||||
if (f->op.removexattr)
|
||||
res = f->op.removexattr(path, name);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
send_reply(f, in, res, NULL, 0);
|
||||
}
|
||||
|
||||
@ -1558,7 +1558,7 @@ static void do_opendir(struct fuse *f, struct fuse_in_header *in,
|
||||
dh->fuse = f;
|
||||
dh->fp = tmpfile();
|
||||
dh->filled = 0;
|
||||
|
||||
|
||||
res = -EIO;
|
||||
if (dh->fp == NULL) {
|
||||
perror("fuse: failed to create temporary file");
|
||||
@ -1606,7 +1606,7 @@ static void do_readdir(struct fuse *f, struct fuse_in_header *in,
|
||||
out->unique = in->unique;
|
||||
out->error = res;
|
||||
outsize = sizeof(struct fuse_out_header) + size;
|
||||
|
||||
|
||||
send_reply_raw(f, outbuf, outsize);
|
||||
free(outbuf);
|
||||
}
|
||||
@ -1654,9 +1654,9 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
|
||||
ctx->uid = in->uid;
|
||||
ctx->gid = in->gid;
|
||||
ctx->pid = in->pid;
|
||||
|
||||
|
||||
argsize = cmd->buflen - sizeof(struct fuse_in_header);
|
||||
|
||||
|
||||
switch (in->opcode) {
|
||||
case FUSE_LOOKUP:
|
||||
do_lookup(f, in, (char *) inarg);
|
||||
@ -1681,11 +1681,11 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
|
||||
case FUSE_MKNOD:
|
||||
do_mknod(f, in, (struct fuse_mknod_in *) inarg);
|
||||
break;
|
||||
|
||||
|
||||
case FUSE_MKDIR:
|
||||
do_mkdir(f, in, (struct fuse_mkdir_in *) inarg);
|
||||
break;
|
||||
|
||||
|
||||
case FUSE_UNLINK:
|
||||
do_unlink(f, in, (char *) inarg);
|
||||
break;
|
||||
@ -1695,14 +1695,14 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
|
||||
break;
|
||||
|
||||
case FUSE_SYMLINK:
|
||||
do_symlink(f, in, (char *) inarg,
|
||||
do_symlink(f, in, (char *) inarg,
|
||||
((char *) inarg) + strlen((char *) inarg) + 1);
|
||||
break;
|
||||
|
||||
case FUSE_RENAME:
|
||||
do_rename(f, in, (struct fuse_rename_in *) inarg);
|
||||
break;
|
||||
|
||||
|
||||
case FUSE_LINK:
|
||||
do_link(f, in, (struct fuse_link_in *) inarg);
|
||||
break;
|
||||
@ -1806,13 +1806,13 @@ struct fuse_cmd *fuse_read_cmd(struct fuse *f)
|
||||
free_cmd(cmd);
|
||||
if (fuse_exited(f) || errno == EINTR || errno == ENOENT)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* ENODEV means we got unmounted, so we silenty return failure */
|
||||
if (errno != ENODEV) {
|
||||
/* BAD... This will happen again */
|
||||
perror("fuse: reading device");
|
||||
}
|
||||
|
||||
|
||||
fuse_exit(f);
|
||||
return NULL;
|
||||
}
|
||||
@ -1824,7 +1824,7 @@ struct fuse_cmd *fuse_read_cmd(struct fuse *f)
|
||||
return NULL;
|
||||
}
|
||||
cmd->buflen = res;
|
||||
|
||||
|
||||
/* Forget is special, it can be done without messing with threads. */
|
||||
if (in->opcode == FUSE_FORGET) {
|
||||
do_forget(f, in, (struct fuse_forget_in *) inarg);
|
||||
@ -1903,7 +1903,7 @@ static int parse_lib_opts(struct fuse *f, const char *opts)
|
||||
fprintf(stderr, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
while((opt = strsep(&s, ","))) {
|
||||
if (strcmp(opt, "debug") == 0)
|
||||
f->flags |= FUSE_DEBUG;
|
||||
@ -1911,7 +1911,7 @@ static int parse_lib_opts(struct fuse *f, const char *opts)
|
||||
f->flags |= FUSE_HARD_REMOVE;
|
||||
else if (strcmp(opt, "use_ino") == 0)
|
||||
f->flags |= FUSE_USE_INO;
|
||||
else
|
||||
else
|
||||
fprintf(stderr, "fuse: warning: unknown option `%s'\n", opt);
|
||||
}
|
||||
free(xopts);
|
||||
|
@ -101,7 +101,7 @@ static int start_thread(struct fuse_worker *w, pthread_t *thread_id)
|
||||
fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
pthread_detach(*thread_id);
|
||||
return 0;
|
||||
}
|
||||
@ -130,7 +130,7 @@ static int mt_create_context_key()
|
||||
if (err)
|
||||
fprintf(stderr, "fuse: failed to create thread specific key: %s\n",
|
||||
strerror(err));
|
||||
else
|
||||
else
|
||||
fuse_set_getcontext_func(mt_getcontext);
|
||||
}
|
||||
if (!err)
|
||||
@ -155,7 +155,7 @@ int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data)
|
||||
struct fuse_worker *w;
|
||||
int i;
|
||||
|
||||
w = malloc(sizeof(struct fuse_worker));
|
||||
w = malloc(sizeof(struct fuse_worker));
|
||||
if (w == NULL) {
|
||||
fprintf(stderr, "fuse: failed to allocate worker structure\n");
|
||||
return -1;
|
||||
|
26
lib/helper.c
26
lib/helper.c
@ -24,7 +24,7 @@ static void usage(const char *progname)
|
||||
fprintf(stderr,
|
||||
"usage: %s mountpoint [FUSE options]\n\n", progname);
|
||||
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"FUSE options:\n"
|
||||
" -d enable debug output (implies -f)\n"
|
||||
" -f foreground operation\n"
|
||||
@ -72,7 +72,7 @@ static int set_one_signal_handler(int signal, void (*handler)(int))
|
||||
perror("FUSE: cannot get old signal handler");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (old_sa.sa_handler == SIG_DFL &&
|
||||
sigaction(signal, &sa, NULL) == -1) {
|
||||
perror("Cannot set signal handler");
|
||||
@ -158,7 +158,7 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
|
||||
int argctr;
|
||||
const char *basename;
|
||||
char *fsname_opt;
|
||||
|
||||
|
||||
*kernel_opts = NULL;
|
||||
*lib_opts = NULL;
|
||||
*mountpoint = NULL;
|
||||
@ -181,7 +181,7 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
|
||||
free(fsname_opt);
|
||||
if (res == -1)
|
||||
goto err;
|
||||
|
||||
|
||||
for (argctr = 1; argctr < argc; argctr ++) {
|
||||
if (argv[argctr][0] == '-') {
|
||||
if (strlen(argv[argctr]) == 2)
|
||||
@ -197,13 +197,13 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
|
||||
if (res == -1)
|
||||
goto err;
|
||||
break;
|
||||
|
||||
|
||||
case 'd':
|
||||
res = add_options(lib_opts, kernel_opts, "debug");
|
||||
if (res == -1)
|
||||
goto err;
|
||||
break;
|
||||
|
||||
|
||||
case 'r':
|
||||
res = add_options(lib_opts, kernel_opts, "ro");
|
||||
if (res == -1)
|
||||
@ -217,11 +217,11 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
|
||||
case 's':
|
||||
*multithreaded = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
goto err;
|
||||
|
||||
|
||||
default:
|
||||
invalid_option(argv, argctr);
|
||||
goto err;
|
||||
@ -341,7 +341,7 @@ struct fuse *fuse_setup_compat2(int argc, char *argv[],
|
||||
char **mountpoint, int *multithreaded,
|
||||
int *fd)
|
||||
{
|
||||
return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
|
||||
return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
|
||||
sizeof(struct fuse_operations_compat2),
|
||||
mountpoint, multithreaded, fd, 21);
|
||||
}
|
||||
@ -373,16 +373,16 @@ static int fuse_main_common(int argc, char *argv[],
|
||||
&multithreaded, &fd, compat);
|
||||
if (fuse == NULL)
|
||||
return 1;
|
||||
|
||||
|
||||
if (multithreaded)
|
||||
res = fuse_loop_mt(fuse);
|
||||
else
|
||||
res = fuse_loop(fuse);
|
||||
|
||||
|
||||
fuse_teardown(fuse, fd, mountpoint);
|
||||
if (res == -1)
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ int fuse_main()
|
||||
void fuse_main_compat1(int argc, char *argv[],
|
||||
const struct fuse_operations_compat1 *op)
|
||||
{
|
||||
fuse_main_common(argc, argv, (struct fuse_operations *) op,
|
||||
fuse_main_common(argc, argv, (struct fuse_operations *) op,
|
||||
sizeof(struct fuse_operations_compat1), 11);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ static int receive_fd(int fd)
|
||||
/* EOF */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
cmsg = CMSG_FIRSTHDR(&msg);
|
||||
if (!cmsg->cmsg_type == SCM_RIGHTS) {
|
||||
fprintf(stderr, "got control message of unknown type %d\n",
|
||||
@ -71,10 +71,10 @@ void fuse_unmount(const char *mountpoint)
|
||||
{
|
||||
const char *mountprog = FUSERMOUNT_PROG;
|
||||
char umount_cmd[1024];
|
||||
|
||||
|
||||
snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u -q -z %s", mountprog,
|
||||
mountpoint);
|
||||
|
||||
|
||||
umount_cmd[sizeof(umount_cmd) - 1] = '\0';
|
||||
system(umount_cmd);
|
||||
}
|
||||
|
@ -7,13 +7,13 @@
|
||||
*/
|
||||
/* This program does the mounting and unmounting of FUSE filesystems */
|
||||
|
||||
/*
|
||||
/*
|
||||
* NOTE: This program should be part of (or be called from) /bin/mount
|
||||
*
|
||||
*
|
||||
* Unless that is done, operations on /etc/mtab are not under lock, and so
|
||||
* data in this file may be lost. (I will _not_ reimplement that locking,
|
||||
* and anyway that should be done in libc, if possible. But probably it
|
||||
* isn't).
|
||||
* isn't).
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -131,7 +131,7 @@ static int add_mount(const char *fsname, const char *mnt, const char *type,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ent.mnt_fsname = (char *) fsname;
|
||||
ent.mnt_dir = (char *) mnt;
|
||||
ent.mnt_type = (char *) type;
|
||||
@ -144,7 +144,7 @@ static int add_mount(const char *fsname, const char *mnt, const char *type,
|
||||
mtab, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
endmntent(fp);
|
||||
return 0;
|
||||
}
|
||||
@ -165,14 +165,14 @@ static int remove_mount(const char *mnt, int quiet, const char *mtab,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
newfp = setmntent(mtab_new, "w");
|
||||
if (newfp == NULL) {
|
||||
fprintf(stderr, "%s: failed to open %s: %s\n", progname, mtab_new,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (getuid() != 0) {
|
||||
user = get_user_name();
|
||||
if (user == NULL)
|
||||
@ -199,11 +199,10 @@ static int remove_mount(const char *mnt, int quiet, const char *mtab,
|
||||
if (res != 0) {
|
||||
fprintf(stderr, "%s: failed to add entry to %s: %s\n",
|
||||
progname, mtab_new, strerror(errno));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
endmntent(fp);
|
||||
endmntent(newfp);
|
||||
|
||||
@ -268,7 +267,7 @@ static int unmount_fuse(const char *mnt, int quiet, int lazy)
|
||||
int res;
|
||||
const char *mtab = _PATH_MOUNTED;
|
||||
const char *mtab_new = _PATH_MOUNTED "~fuse~";
|
||||
|
||||
|
||||
res = remove_mount(mnt, quiet, mtab, mtab_new);
|
||||
if (res == -1)
|
||||
return -1;
|
||||
@ -399,7 +398,7 @@ static struct mount_flags mount_flags[] = {
|
||||
static int find_mount_flag(const char *s, unsigned len, int *on, int *flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; mount_flags[i].opt != NULL; i++) {
|
||||
const char *opt = mount_flags[i].opt;
|
||||
if (strlen(opt) == len && strncmp(opt, s, len) == 0) {
|
||||
@ -421,7 +420,7 @@ static int add_option(char **optsp, const char *opt, unsigned expand)
|
||||
char *newopts;
|
||||
if (*optsp == NULL)
|
||||
newopts = strdup(opt);
|
||||
else {
|
||||
else {
|
||||
unsigned oldsize = strlen(*optsp);
|
||||
unsigned newsize = oldsize + 1 + strlen(opt) + expand + 1;
|
||||
newopts = realloc(*optsp, newsize);
|
||||
@ -440,7 +439,7 @@ static int get_mnt_opts(int flags, char *opts, char **mnt_optsp)
|
||||
{
|
||||
int i;
|
||||
int l;
|
||||
|
||||
|
||||
if (!(flags & MS_RDONLY) && add_option(mnt_optsp, "rw", 0) == -1)
|
||||
return -1;
|
||||
|
||||
@ -487,13 +486,13 @@ static int do_mount(const char *mnt, const char *type, mode_t rootmode,
|
||||
const char *s;
|
||||
char *d;
|
||||
char *fsname = NULL;
|
||||
|
||||
|
||||
optbuf = malloc(strlen(opts) + 64);
|
||||
if (!optbuf) {
|
||||
fprintf(stderr, "%s: failed to allocate memory\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for (s = opts, d = optbuf; *s;) {
|
||||
unsigned len;
|
||||
const char *fsname_str = "fsname=";
|
||||
@ -520,7 +519,7 @@ static int do_mount(const char *mnt, const char *type, mode_t rootmode,
|
||||
struct utsname utsname;
|
||||
unsigned kmaj, kmin;
|
||||
res = uname(&utsname);
|
||||
if (res == 0 &&
|
||||
if (res == 0 &&
|
||||
sscanf(utsname.release, "%u.%u", &kmaj, &kmin) == 2 &&
|
||||
(kmaj > 2 || (kmaj == 2 && kmin > 4))) {
|
||||
fprintf(stderr, "%s: note: 'large_read' mount option is deprecated for %i.%i kernels\n", progname, kmaj, kmin);
|
||||
@ -617,7 +616,7 @@ static int check_perm(const char **mntp, struct stat *stbuf, int *currdir_fd)
|
||||
int res;
|
||||
const char *mnt = *mntp;
|
||||
const char *origmnt;
|
||||
|
||||
|
||||
res = lstat(mnt, stbuf);
|
||||
if (res == -1) {
|
||||
fprintf(stderr, "%s: failed to access mountpoint %s: %s\n",
|
||||
@ -661,7 +660,7 @@ static int check_perm(const char **mntp, struct stat *stbuf, int *currdir_fd)
|
||||
progname, origmnt);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
res = access(mnt, W_OK);
|
||||
if (res == -1) {
|
||||
fprintf(stderr, "%s: user has no write access to mountpoint %s\n",
|
||||
@ -724,13 +723,13 @@ static int try_open_fuse_device(char **devp)
|
||||
int fd = try_open(FUSE_DEV_NEW, devp, 1);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
|
||||
if (fd == -1) {
|
||||
fd = try_open_new_temp(makedev(FUSE_MAJOR, FUSE_MINOR), devp);
|
||||
if (fd != -2)
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
fd = try_open(FUSE_DEV_OLD, devp, 1);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
@ -753,7 +752,7 @@ static int open_fuse_device(char **devp)
|
||||
fd = try_open_fuse_device(devp);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
|
||||
#ifndef USE_UCLIBC
|
||||
pid = fork();
|
||||
#else
|
||||
@ -771,7 +770,7 @@ static int open_fuse_device(char **devp)
|
||||
fd = try_open_fuse_device(devp);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
|
||||
fprintf(stderr, "%s: fuse device not found, try 'modprobe fuse' first\n",
|
||||
progname);
|
||||
return -1;
|
||||
@ -845,7 +844,7 @@ static int mount_fuse(const char *mnt, const char *opts)
|
||||
fchdir(currdir_fd);
|
||||
close(currdir_fd);
|
||||
}
|
||||
|
||||
|
||||
if (geteuid() == 0) {
|
||||
res = add_mount(fsname, mnt, type, mnt_opts);
|
||||
unlock_mtab(mtablock);
|
||||
@ -924,7 +923,7 @@ static char *resolve_path(const char *orig)
|
||||
return dst;
|
||||
}
|
||||
|
||||
static int send_fd(int sock_fd, int fd)
|
||||
static int send_fd(int sock_fd, int fd)
|
||||
{
|
||||
int retval;
|
||||
struct msghdr msg;
|
||||
@ -989,7 +988,7 @@ int main(int argc, char *argv[])
|
||||
const char *opts = "";
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
|
||||
for (a = 1; a < argc; a++) {
|
||||
if (argv[a][0] != '-')
|
||||
break;
|
||||
@ -1015,7 +1014,7 @@ int main(int argc, char *argv[])
|
||||
case 'z':
|
||||
lazy = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
@ -1026,7 +1025,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (a == argc) {
|
||||
fprintf(stderr, "%s: missing mountpoint argument\n", progname);
|
||||
exit(1);
|
||||
@ -1046,13 +1045,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (getuid() != 0)
|
||||
restore_privs();
|
||||
|
||||
|
||||
if (unmount) {
|
||||
if (geteuid() == 0) {
|
||||
int mtablock = lock_mtab();
|
||||
res = unmount_fuse(mnt, quiet, lazy);
|
||||
unlock_mtab(mtablock);
|
||||
} else
|
||||
} else
|
||||
res = do_unmount(mnt, quiet, lazy);
|
||||
if (res == -1)
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user