On Tue, Mar 5, 2013 at 4:29 PM, Sylvestre Gallon <ccna....@gmail.com> wrote: > > Martin, > > You will find inline the kernel patch >
And here the userland : Index: Makefile =================================================================== RCS file: /cvs/src/sbin/Makefile,v retrieving revision 1.97 diff -u -p -u -p -r1.97 Makefile --- Makefile 23 Aug 2012 06:37:27 -0000 1.97 +++ Makefile 5 Mar 2013 15:21:12 -0000 @@ -5,7 +5,7 @@ SUBDIR= atactl badsect bioctl clri dhcli fsck_msdos fsdb fsirand growfs ifconfig iked init iopctl ipsecctl \ isakmpd kbd ldattach lmccontrol mknod modload modunload mount \ mount_cd9660 mount_ext2fs mount_ffs mount_msdos \ - mount_nfs mount_ntfs mount_procfs mount_udf \ + mount_nfs mount_ntfs mount_procfs mount_fusefs mount_udf \ mount_vnd mountd ncheck_ffs newfs newfs_ext2fs newfs_msdos \ nfsd nologin pdisk pfctl pflogd ping ping6 quotacheck \ reboot restore route rtsol savecore scan_ffs \ Index: mount_fusefs/Makefile =================================================================== RCS file: mount_fusefs/Makefile diff -N mount_fusefs/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mount_fusefs/Makefile 5 Mar 2013 15:21:18 -0000 @@ -0,0 +1,10 @@ +# $OpenBSD: src/sbin/mount_procfs/Makefile,v 1.7 2004/06/22 21:12:00 otto Exp $ + +PROG= mount_fusefs +SRCS= mount_fusefs.c getmntopts.c + +MOUNT= ${.CURDIR}/../mount +CFLAGS+= -I${MOUNT} +.PATH: ${MOUNT} + +.include <bsd.prog.mk> Index: mount_fusefs/mount_fusefs.c =================================================================== RCS file: mount_fusefs/mount_fusefs.c diff -N mount_fusefs/mount_fusefs.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mount_fusefs/mount_fusefs.c 5 Mar 2013 15:21:18 -0000 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2012 Sylvestre Gallon <ccna....@gmail.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/mount.h> + +#include <err.h> +#include <errno.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "mntopts.h" + +const struct mntopt mopts[] = { + MOPT_STDOPTS, + { "subtype", 0, MFLAG_SET | MFLAG_STRVAL | MFLAG_OPT }, + { "fsname", 0, MFLAG_SET | MFLAG_STRVAL | MFLAG_OPT }, + { NULL } +}; + +void usage(void); + +int +main(int argc, char *argv[]) +{ + int ch, mntflags, altflags; + struct fusefs_args args; + char path[MAXPATHLEN]; + + mntflags = altflags = 0; + while ((ch = getopt(argc, argv, "o:")) != -1) + switch (ch) { + case 'o': + altflags |= getmntopts(optarg, mopts, &mntflags); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 2) + usage(); + + args.flags = altflags; + args.fd = atoi(argv[0]); + + if (realpath(argv[1], path) == NULL) + err(1, "realpath %s", argv[1]); + + if (mount(MOUNT_FUSEFS, path, mntflags, &args)) { + if (errno == EOPNOTSUPP) + errx(1, "%s: Filesystem not supported by kernel", + argv[1]); + else + err(1, "%s", argv[1]); + } + exit(0); +} + +void +usage(void) +{ + (void)fprintf(stderr, + "usage: mount_procfs [-o options] fd mount_point\n"); + exit(1); +}