<commit_before>/*
  FUSE: Filesystem in Userspace
  Copyright (C) 2005-2008 <NAME> <<EMAIL>>

  This program can be distributed under the terms of the GNU LGPLv2.
  See the file COPYING.LIB.
*/

#include "fuse_i.h"
#include "fuse_misc.h"
#include "fuse_opt.h"

#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <paths.h>
#include <limits.h>
#include <kvm.h>

#define FUSERMOUNT_PROG		"mount_fusefs"
#define FUSE_DEV_TRUNK		"/dev/fuse"
#define FUSE_ANS_WCHAN          "fu_ans"

enum {
	KEY_ALLOW_ROOT,
	KEY_RO,
	KEY_HELP,
	KEY_VERSION,
	KEY_KERN
};

struct mount_opts {
	int allow_other;
	int allow_root;
	int ishelp;
	char *kernel_opts;
};

static const struct fuse_opt fuse_mount_opts[] = {
	{ "allow_other", offsetof(struct mount_opts, allow_other), 1 },
	{ "allow_root", offsetof(struct mount_opts, allow_root), 1 },
	FUSE_OPT_KEY("allow_root",	    KEY_ALLOW_ROOT),
	FUSE_OPT_KEY("-r",		    KEY_RO),
	FUSE_OPT_KEY("-h",		    KEY_HELP),
	FUSE_OPT_KEY("--help",		    KEY_HELP),
	FUSE_OPT_KEY("-V",		    KEY_VERSION),
	FUSE_OPT_KEY("--version",	    KEY_VERSION),
	/* standard FreeBSD mount options */
	FUSE_OPT_KEY("dev",		    KEY_KERN),
	FUSE_OPT_KEY("async",		    KEY_KERN),
	FUSE_OPT_KEY("atime",		    KEY_KERN),
	FUSE_OPT_KEY("dev",		    KEY_KERN),
	FUSE_OPT_KEY("exec",		    KEY_KERN),
	FUSE_OPT_KEY("suid",		    KEY_KERN),
	FUSE_OPT_KEY("symfollow",	    KEY_KERN),
	FUSE_OPT_KEY("rdonly",		    KEY_KERN),
	FUSE_OPT_KEY("sync",		    KEY_KERN),
	FUSE_OPT_KEY("union",		    KEY_KERN),
	FUSE_OPT_KEY("userquota",	    KEY_KERN),
	FUSE_OPT_KEY("groupquota",	    KEY_KERN),
	FUSE_OPT_KEY("clusterr",	    KEY_KERN),
	FUSE_OPT_KEY("clusterw",	    KEY_KERN),
	FUSE_OPT_KEY("suiddir",		    KEY_KERN),
	FUSE_OPT_KEY("snapshot",	    KEY_KERN),
	FUSE_OPT_KEY("multilabel",	    KEY_KERN),
	FUSE_OPT_KEY("acls",		    KEY_KERN),
	FUSE_OPT_KEY("force",		    KEY_KERN),
	FUSE_OPT_KEY("update",		    KEY_KERN),
	FUSE_OPT_KEY("ro",		    KEY_KERN),
	FUSE_OPT_KEY("rw",		    KEY_KERN),
	FUSE_OPT_KEY("auto",		    KEY_KERN),
	/* options supported under both Linux and FBSD */
	FUSE_OPT_KEY("allow_other",	    KEY_KERN),
	FUSE_OPT_KEY("default_permissions", KEY_KERN),
	/* FBSD FUSE specific mount options */
	FUSE_OPT_KEY("private",		    KEY_KERN),
	FUSE_OPT_KEY("neglect_shares",	    KEY_KERN),
	FUSE_OPT_KEY("push_symlinks_in",    KEY_KERN),
	/* stock FBSD mountopt parsing routine lets anything be negated... */
	FUSE_OPT_KEY("nodev",		    KEY_KERN),
	FUSE_OPT_KEY("noasync",		    KEY_KERN),
	FUSE_OPT_KEY("noatime",		    KEY_KERN),
	FUSE_OPT_KEY("nodev",		    KEY_KERN),
	FUSE_OPT_KEY("noexec",		    KEY_KERN),
	FUSE_OPT_KEY("nosuid",		    KEY_KERN),
	FUSE_OPT_KEY("nosymfollow",	    KEY_KERN),
	FUSE_OPT_KEY("nordonly",	    KEY_KERN),
	FUSE_OPT_KEY("nosync",		    KEY_KERN),
	FUSE_OPT_KEY("nounion",		    KEY_KERN),
	FUSE_OPT_KEY("nouserquota",	    KEY_KERN),
	FUSE_OPT_KEY("nogroupquota",	    KEY_KERN),
	FUSE_OPT_KEY("noclusterr",	    KEY_KERN),
	FUSE_OPT_KEY("noclusterw",	    KEY_KERN),
	FUSE_OPT_KEY("nosuiddir",	    KEY_KERN),
	FUSE_OPT_KEY("nosnapshot",	    KEY_KERN),
	FUSE_OPT_KEY("nomultilabel",	    KEY_KERN),
	FUSE_OPT_KEY("noacls",		    KEY_KERN),
	FUSE_OPT_KEY("noforce",		    KEY_KERN),
	FUSE_OPT_KEY("noupdate",	    KEY_KERN),
	FUSE_OPT_KEY("noro",		    KEY_KERN),
	FUSE_OPT_KEY("norw",		    KEY_KERN),
	FUSE_OPT_KEY("noauto",		    KEY_KERN),
	FUSE_OPT_KEY("noallow_other",	    KEY_KERN),
	FUSE_OPT_KEY("nodefault_permissions", KEY_KERN),
	FUSE_OPT_KEY("noprivate",	    KEY_KERN),
	FUSE_OPT_KEY("noneglect_shares",    KEY_KERN),
	FUSE_OPT_KEY("nopush_symlinks_in",  KEY_KERN),
	/*
	 * Linux specific mount options, but let just the mount util
	 * handle them
	 */
	FUSE_OPT_KEY("fsname=",		    KEY_KERN),
	FUSE_OPT_KEY("nonempty",	    KEY_KERN),
	FUSE_OPT_KEY("large_read",	    KEY_KERN),
	FUSE_OPT_KEY("max_read=",	    KEY_KERN),
	FUSE_OPT_END
};

static void mount_help(void)
{
	fprintf(stderr,
		"    -o allow_root	    allow access to root\n"
		);<commit_msg>lib/mount_bsd.c: add support for the subtype option<commit_after>/*
  FUSE: Filesystem in Userspace
  Copyright (C) 2005-2008 <NAME> <<EMAIL>>

  This program can be distributed under the terms of the GNU LGPLv2.
  See the file COPYING.LIB.
*/

#include "fuse_i.h"
#include "fuse_misc.h"
#include "fuse_opt.h"

#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <paths.h>
#include <limits.h>
#include <kvm.h>

#define FUSERMOUNT_PROG		"mount_fusefs"
#define FUSE_DEV_TRUNK		"/dev/fuse"
#define FUSE_ANS_WCHAN          "fu_ans"

enum {
	KEY_ALLOW_ROOT,
	KEY_RO,
	KEY_HELP,
	KEY_VERSION,
	KEY_KERN
};

struct mount_opts {
	int allow_other;
	int allow_root;
	int ishelp;
	char *kernel_opts;
};

static const struct fuse_opt fuse_mount_opts[] = {
	{ "allow_other", offsetof(struct mount_opts, allow_other), 1 },
	{ "allow_root", offsetof(struct mount_opts, allow_root), 1 },
	FUSE_OPT_KEY("allow_root",	    KEY_ALLOW_ROOT),
	FUSE_OPT_KEY("-r",		    KEY_RO),
	FUSE_OPT_KEY("-h",		    KEY_HELP),
	FUSE_OPT_KEY("--help",		    KEY_HELP),
	FUSE_OPT_KEY("-V",		    KEY_VERSION),
	FUSE_OPT_KEY("--version",	    KEY_VERSION),
	/* standard FreeBSD mount options */
	FUSE_OPT_KEY("dev",		    KEY_KERN),
	FUSE_OPT_KEY("async",		    KEY_KERN),
	FUSE_OPT_KEY("atime",		    KEY_KERN),
	FUSE_OPT_KEY("dev",		    KEY_KERN),
	FUSE_OPT_KEY("exec",		    KEY_KERN),
	FUSE_OPT_KEY("suid",		    KEY_KERN),
	FUSE_OPT_KEY("symfollow",	    KEY_KERN),
	FUSE_OPT_KEY("rdonly",		    KEY_KERN),
	FUSE_OPT_KEY("sync",		    KEY_KERN),
	FUSE_OPT_KEY("union",		    KEY_KERN),
	FUSE_OPT_KEY("userquota",	    KEY_KERN),
	FUSE_OPT_KEY("groupquota",	    KEY_KERN),
	FUSE_OPT_KEY("clusterr",	    KEY_KERN),
	FUSE_OPT_KEY("clusterw",	    KEY_KERN),
	FUSE_OPT_KEY("suiddir",		    KEY_KERN),
	FUSE_OPT_KEY("snapshot",	    KEY_KERN),
	FUSE_OPT_KEY("multilabel",	    KEY_KERN),
	FUSE_OPT_KEY("acls",		    KEY_KERN),
	FUSE_OPT_KEY("force",		    KEY_KERN),
	FUSE_OPT_KEY("update",		    KEY_KERN),
	FUSE_OPT_KEY("ro",		    KEY_KERN),
	FUSE_OPT_KEY("rw",		    KEY_KERN),
	FUSE_OPT_KEY("auto",		    KEY_KERN),
	/* options supported under both Linux and FBSD */
	FUSE_OPT_KEY("allow_other",	    KEY_KERN),
	FUSE_OPT_KEY("default_permissions", KEY_KERN),
	/* FBSD FUSE specific mount options */
	FUSE_OPT_KEY("private",		    KEY_KERN),
	FUSE_OPT_KEY("neglect_shares",	    KEY_KERN),
	FUSE_OPT_KEY("push_symlinks_in",    KEY_KERN),
	/* stock FBSD mountopt parsing routine lets anything be negated... */
	FUSE_OPT_KEY("nodev",		    KEY_KERN),
	FUSE_OPT_KEY("noasync",		    KEY_KERN),
	FUSE_OPT_KEY("noatime",		    KEY_KERN),
	FUSE_OPT_KEY("nodev",		    KEY_KERN),
	FUSE_OPT_KEY("noexec",		    KEY_KERN),
	FUSE_OPT_KEY("nosuid",		    KEY_KERN),
	FUSE_OPT_KEY("nosymfollow",	    KEY_KERN),
	FUSE_OPT_KEY("nordonly",	    KEY_KERN),
	FUSE_OPT_KEY("nosync",		    KEY_KERN),
	FUSE_OPT_KEY("nounion",		    KEY_KERN),
	FUSE_OPT_KEY("nouserquota",	    KEY_KERN),
	FUSE_OPT_KEY("nogroupquota",	    KEY_KERN),
	FUSE_OPT_KEY("noclusterr",	    KEY_KERN),
	FUSE_OPT_KEY("noclusterw",	    KEY_KERN),
	FUSE_OPT_KEY("nosuiddir",	    KEY_KERN),
	FUSE_OPT_KEY("nosnapshot",	    KEY_KERN),
	FUSE_OPT_KEY("nomultilabel",	    KEY_KERN),
	FUSE_OPT_KEY("noacls",		    KEY_KERN),
	FUSE_OPT_KEY("noforce",		    KEY_KERN),
	FUSE_OPT_KEY("noupdate",	    KEY_KERN),
	FUSE_OPT_KEY("noro",		    KEY_KERN),
	FUSE_OPT_KEY("norw",		    KEY_KERN),
	FUSE_OPT_KEY("noauto",		    KEY_KERN),
	FUSE_OPT_KEY("noallow_other",	    KEY_KERN),
	FUSE_OPT_KEY("nodefault_permissions", KEY_KERN),
	FUSE_OPT_KEY("noprivate",	    KEY_KERN),
	FUSE_OPT_KEY("noneglect_shares",    KEY_KERN),
	FUSE_OPT_KEY("nopush_symlinks_in",  KEY_KERN),
	/*
	 * Linux specific mount options, but let just the mount util
	 * handle them
	 */
	FUSE_OPT_KEY("fsname=",		    KEY_KERN),
	FUSE_OPT_KEY("subtype=",	    KEY_KERN),
	FUSE_OPT_KEY("nonempty",	    KEY_KERN),
	FUSE_OPT_KEY("large_read",	    KEY_KERN),
	FUSE_OPT_KEY("max_read=",	    KEY_KERN),
	FUSE_OPT_END
};

static void mount_help(void)
{
	fprintf(stderr,
		"    -o allow_root	    allow access to root\n"
		);
{'fraction_non_alphanumeric': 0.1410332895835819, 'fraction_numerical': 0.002624985085312015, 'mean_word_length': 4.37997432605905, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4576563', 'n_tokens_mistral': 3691, 'n_tokens_neox': 3574, 'n_words': 568}