main.c (01.09.09)
FUSE-based exFAT implementation. Requires FUSE 2.6 or later.
- Copyright (C) 2009, 2010 Andrew Nayenko
+ Copyright (C) 2010-2012 Andrew Nayenko
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define FUSE_USE_VERSION 26
#include <fuse.h>
#include <errno.h>
#include <fcntl.h>
return 0;
}
+#ifdef __APPLE__
+static int fuse_exfat_chmod(const char* path, mode_t mode)
+{
+ exfat_debug("[fuse_exfat_chmod] %s 0%ho", path, mode);
+ /* make OS X utilities happy */
+ return 0;
+}
+#endif
+
static int fuse_exfat_statfs(const char* path, struct statvfs* sfs)
{
sfs->f_bsize = CLUSTER_SIZE(*ef.sb);
.mkdir = fuse_exfat_mkdir,
.rename = fuse_exfat_rename,
.utimens = fuse_exfat_utimens,
+#ifdef __APPLE__
+ .chmod = fuse_exfat_chmod,
+#endif
.statfs = fuse_exfat_statfs,
.destroy = fuse_exfat_destroy,
};
else if (strcmp(*pp, "-v") == 0)
{
free(mount_options);
- puts("Copyright (C) 2009 Andrew Nayenko");
+ puts("Copyright (C) 2010-2012 Andrew Nayenko");
return 0;
}
else if (spec == NULL)
}
/* exit session on HUP, TERM and INT signals and ignore PIPE signal */
- if (fuse_set_signal_handlers(fuse_get_session(fh)))
+ if (fuse_set_signal_handlers(fuse_get_session(fh)) != 0)
{
fuse_unmount(mount_point, fc);
fuse_destroy(fh);
exfat_unmount(&ef);
+ exfat_error("failed to set signal handlers");
return 1;
}
- /* go to background unless "-d" option is passed */
- fuse_daemonize(debug);
-
- /* FUSE main loop */
- fuse_loop(fh);
+ /* go to background (unless "-d" option is passed) and run FUSE
+ main loop */
+ if (fuse_daemonize(debug) == 0)
+ {
+ if (fuse_loop(fh) != 0)
+ exfat_error("FUSE loop failure");
+ }
+ else
+ exfat_error("failed to daemonize");
- /* it's quite illogical but fuse_unmount() must be called BEFORE
- fuse_destroy() */
+ fuse_remove_signal_handlers(fuse_get_session(fh));
+ /* note that fuse_unmount() must be called BEFORE fuse_destroy() */
fuse_unmount(mount_point, fc);
fuse_destroy(fh);
return 0;