/*
* Fuse: Filesystem in Userspace
*
*
* This program can be distributed under the terms of the GNU LGPLv2.
* See the file COPYING.LIB
*/
#include "fuse.h"
#include "fuse_opt.h"
#include <libuvfs.h>
#include "fuse_impl.h"
#include <libintl.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <priv.h>
#include <unistd.h>
enum {
};
};
enum {
};
struct helper_opts {
char *mountpoint;
};
};
/*
* Non-failing strdup; see umem_alloc(3C). Note that the nofail callback is
* set in libfuse.
*/
char *
{
char *rc;
return (rc);
}
/*
* Counterpart to libfuse_strdup().
*/
void
{
}
/*
* Append an option to a buffer containing a comma-separated list of
* options. Return -1 on overflow, or 0 on success.
*/
static int
{
return (-1);
return (-1);
return (0);
}
/*
* Process a mount option for fuse. Returns zero if something is wrong,
* one otherwise. Called via the fuse_opt_parse framework.
*/
/*ARGSUSED*/
static int
{
int rc;
if (key != KEY_MOUNT_OPT)
return (1);
/*
* Convert "direct_io" into "forcedirectio"
*/
if (rc == -1)
return (0);
return (1);
}
/*
* Process argument according to fuse_opt_parse() and the fuse_mount_opts.
*/
int
{
}
static void
{
progname);
"mount options\n"));
"print help\n"));
"print version\n"));
}
static void
helper_version(void)
{
}
/*
* Callback function for parsing the helper options via fuse_opt_parse().
*/
static int
{
switch (key) {
case KEY_HELP:
case KEY_VERSION:
return (1);
case FUSE_OPT_KEY_NONOPT:
if (!hopts->mountpoint) {
gettext("bad mount point "));
return (-1);
}
mountpoint));
} else {
arg);
return (-1);
}
default:
return (1);
}
}
/*
* Parse the command line according to fuse_helper_opts.
*/
/*ARGSUSED*/
int
int *multithreaded, int *foreground)
{
int rc;
if (rc == -1)
return (-1);
if (mountpoint)
else
return (0);
err:
return (-1);
}
/*
* Create the fuse_chan structure, containing the libuvfs_fs_t.
*/
struct fuse_chan *
{
if (is_smf)
else {
if (fsid == 0)
return (0);
}
return (fuse_chan);
}
/*
* Free a fuse_chan, releasing its underlying libuvfs_fs_t.
*/
static void
{
}
/*
* Perform another round of fuse_opt_parse, and call the mount(2) system
* call with the derived options. Returns a pointer to a fuse_chan
* structure on success, or a NULL on error.
*/
struct fuse_chan *
{
opts[0] = '\0';
return (NULL);
if (!priv_ineffect(PRIV_SYS_MOUNT)) {
return (NULL);
}
opts, MAX_MNTOPT_STR) != 0)
return (NULL);
return (fuse_chan);
}
/*
* Unmount, and free the fuse_chan structure.
*/
void
{
(void) umount2(mountpoint, 0);
}