Changeset View
Changeset View
Standalone View
Standalone View
fs/common/fstest_lfs.c
/* $NetBSD: fstest_lfs.c,v 1.5 2015/08/30 18:27:26 dholland Exp $ */ | /* $NetBSD: fstest_lfs.c,v 1.8 2020/06/17 00:16:21 kamil Exp $ */ | ||||
/*- | /*- | ||||
* Copyright (c) 2010 The NetBSD Foundation, Inc. | * Copyright (c) 2010 The NetBSD Foundation, Inc. | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* This code is derived from software contributed to The NetBSD Foundation | * This code is derived from software contributed to The NetBSD Foundation | ||||
* by Nicolas Joly. | * by Nicolas Joly. | ||||
* | * | ||||
Show All 28 Lines | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <ufs/ufs/ufsmount.h> | #include <ufs/ufs/ufsmount.h> | ||||
#include <rump/rump.h> | #include <rump/rump.h> | ||||
#include <rump/rump_syscallshotgun.h> | |||||
#include <rump/rump_syscalls.h> | #include <rump/rump_syscalls.h> | ||||
#include "h_fsmacros.h" | #include "h_fsmacros.h" | ||||
#include "mount_lfs.h" | #include "mount_lfs.h" | ||||
struct lfstestargs { | struct lfstestargs { | ||||
struct ufs_args ta_uargs; | struct ufs_args ta_uargs; | ||||
pthread_t ta_cleanerthread; | pthread_t ta_cleanerthread; | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | lfs_fstest_delfs(const atf_tc_t *tc, void *buf) | ||||
return 0; | return 0; | ||||
} | } | ||||
static void * | static void * | ||||
cleaner(void *arg) | cleaner(void *arg) | ||||
{ | { | ||||
char thepath[MAXPATHLEN]; | char thepath[MAXPATHLEN]; | ||||
struct lfstestargs *args = arg; | struct lfstestargs *args = arg; | ||||
const char *the_argv[7]; | const char *the_argv[9]; | ||||
char buf[64]; | char buf[64]; | ||||
rump_pub_lwproc_newlwp(rump_sys_getpid()); | |||||
/* this inspired by the cleaner code. fixme */ | /* this inspired by the cleaner code. fixme */ | ||||
sprintf(thepath, "/dev/r%s", args->ta_devpath+5); | sprintf(thepath, "/dev/r%s", args->ta_devpath+5); | ||||
rump_pub_etfs_register(thepath, args->ta_hostpath, RUMP_ETFS_CHR); | rump_pub_etfs_register(thepath, args->ta_hostpath, RUMP_ETFS_CHR); | ||||
sprintf(buf, "%p", &args->ta_cleanerloop); | sprintf(buf, "%p", &args->ta_cleanerloop); | ||||
the_argv[0] = "megamaid"; | the_argv[0] = "megamaid"; | ||||
the_argv[1] = "-D"; /* don't fork() & detach */ | the_argv[1] = "-D"; /* don't fork() & detach */ | ||||
the_argv[2] = "-S"; | the_argv[2] = "-S"; | ||||
the_argv[3] = buf; | the_argv[3] = buf; | ||||
the_argv[4] = args->ta_mntpath; | the_argv[4] = "-J"; | ||||
the_argv[5] = NULL; | the_argv[5] = thepath; | ||||
the_argv[6] = args->ta_mntpath; | |||||
the_argv[7] = NULL; | |||||
/* xxxatf */ | /* xxxatf */ | ||||
optind = 1; | optind = 1; | ||||
opterr = 1; | opterr = 1; | ||||
lfs_cleaner_main(5, __UNCONST(the_argv)); | lfs_cleaner_main(7, __UNCONST(the_argv)); | ||||
rump_pub_lwproc_releaselwp(); | |||||
return NULL; | return NULL; | ||||
} | } | ||||
int | int | ||||
lfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags) | lfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags) | ||||
{ | { | ||||
struct lfstestargs *args = buf; | struct lfstestargs *args = buf; | ||||
Show All 35 Lines |