Ejemplo n.º 1
0
static int
overlay_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&overlay_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&overlay_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "overlay",
			       SYSCTL_DESCR("Overlay file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_CREATE, CTL_EOL);
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&overlay_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&overlay_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Ejemplo n.º 2
0
static int
union_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&union_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&union_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "union",
			       SYSCTL_DESCR("Union file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 15, CTL_EOL);
		/*
		 * XXX the "15" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "15" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&union_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&union_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Ejemplo n.º 3
0
/* For using CHFS as a module. */
static int
chfs_modcmd(modcmd_t cmd, void *arg)
{
	switch (cmd) {
	case MODULE_CMD_INIT:
		return vfs_attach(&chfs_vfsops);
	case MODULE_CMD_FINI:
		return vfs_detach(&chfs_vfsops);
	default:
		return ENOTTY;
	}
}
Ejemplo n.º 4
0
static int
smbfs_modcmd(modcmd_t cmd, void *arg)
{
	const struct sysctlnode *smb = NULL;
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&smbfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&smbfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&smbfs_sysctl_log, 0, NULL, &smb,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "samba",
			       SYSCTL_DESCR("SMB/CIFS remote file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_CREATE, CTL_EOL);

		if (smb != NULL) {
			sysctl_createv(&smbfs_sysctl_log, 0, &smb, NULL,
				       CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
				       CTLTYPE_INT, "version",
				       SYSCTL_DESCR("smbfs version"),
				       NULL, SMBFS_VERSION, NULL, 0,
				       CTL_CREATE, CTL_EOL);
		}
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&smbfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&smbfs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
static int
procfs_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&procfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&procfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&procfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "procfs",
			       SYSCTL_DESCR("Process file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 12, CTL_EOL);
		/*
		 * XXX the "12" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "12" is the order as taken from sys/mount.h
		 */

		procfs_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
		    procfs_listener_cb, NULL);

		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&procfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&procfs_sysctl_log);
		kauth_unlisten_scope(procfs_listener);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Ejemplo n.º 6
0
static int
cd9660_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&cd9660_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT, CTLTYPE_NODE, "cd9660",
			       SYSCTL_DESCR("ISO-9660 file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 14, CTL_EOL);
		sysctl_createv(&cd9660_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
			       CTLTYPE_INT, "utf8_joliet",
			       SYSCTL_DESCR("Encode Joliet filenames to UTF-8"),
			       NULL, 0, &cd9660_utf8_joliet, 0,
			       CTL_VFS, 14, CD9660_UTF8_JOLIET, CTL_EOL);
		/*
		 * XXX the "14" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "14" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&cd9660_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&cd9660_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Ejemplo n.º 7
0
static int
mfs_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&mfs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&mfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "vfs", NULL,
			       NULL, 0, NULL, 0,
			       CTL_VFS, CTL_EOL);
		sysctl_createv(&mfs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
			       CTLTYPE_NODE, "mfs",
			       SYSCTL_DESCR("Memory based file system"),
			       NULL, 1, NULL, 0,
			       CTL_VFS, 3, CTL_EOL);
		/*
		 * XXX the "1" and the "3" above could be dynamic, thereby
		 * eliminating one more instance of the "number to vfs"
		 * mapping problem, but they are in order as taken from
		 * sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&mfs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&mfs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}
Ejemplo n.º 8
0
static int
nfs_modcmd(modcmd_t cmd, void *arg)
{
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&nfs_vfsops);
		if (error == 0) {
			nfs_sysctl_init();
		}
		return error;
	case MODULE_CMD_FINI:
		error = vfs_detach(&nfs_vfsops);
		if (error == 0) {
			nfs_sysctl_fini();
		}
		return error;
	default:
		return ENOTTY;
	}
}
Ejemplo n.º 9
0
static int
ext2fs_modcmd(modcmd_t cmd, void *arg)
{
//	printf("In file: %s, fun: %s,lineno: %d\n",__FILE__, __func__, __LINE__);
	int error;

	switch (cmd) {
	case MODULE_CMD_INIT:
		error = vfs_attach(&ext2fs_vfsops);
		if (error != 0)
			break;
		sysctl_createv(&ext2fs_sysctl_log, 0, NULL, NULL,
			       CTLFLAG_PERMANENT,
			       CTLTYPE_NODE, "ext2fs",
			       SYSCTL_DESCR("Linux EXT2FS file system"),
			       NULL, 0, NULL, 0,
			       CTL_VFS, 17, CTL_EOL);
		/*
		 * XXX the "17" above could be dynamic, thereby eliminating
		 * one more instance of the "number to vfs" mapping problem,
		 * but "17" is the order as taken from sys/mount.h
		 */
		break;
	case MODULE_CMD_FINI:
		error = vfs_detach(&ext2fs_vfsops);
		if (error != 0)
			break;
		sysctl_teardown(&ext2fs_sysctl_log);
		break;
	default:
		error = ENOTTY;
		break;
	}

	return (error);
}