From: Antti Kantee Date: Wed, 10 Feb 2016 18:15:21 +0000 (+0000) Subject: Finish genfs -> cookfs rename. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ab605071dab810e5684196555d370981d26e6676;p=osstest%2Frumprun.git Finish genfs -> cookfs rename. Call the runtime counterpart, which prepares the cooked fs for consumption, "platefs". --- diff --git a/app-tools/cookfs.in b/app-tools/cookfs.in index 1de45a3..d315d79 100644 --- a/app-tools/cookfs.in +++ b/app-tools/cookfs.in @@ -59,7 +59,7 @@ nuketmpdir () rm -rf ${nukeme} } -TMPDIR=$(mktemp -d /tmp/rumprun-genfs.XXXXXX) +TMPDIR=$(mktemp -d /tmp/rumprun-cookfs.XXXXXX) trap nuketmpdir 0 INT TERM LINKPATH=${TMPDIR}/linkme LINKPATH_BIN="_binary_$(echo ${LINKPATH} | tr '/.-' '_')" @@ -199,7 +199,7 @@ printhead () printf 'static struct rumprun_extfile files[] = {\n' 1>&4 printf '#include \n\n' - printf '#include \n\n' + printf '#include \n\n' } printtail () @@ -211,7 +211,7 @@ printtail () printf 'static void __attribute__((constructor))\n' printf 'rumpfs_externatilize(void)\n' printf '{\n\n' - printf '\trumprun_genfs(dirlist, __arraycount(dirlist),\n' + printf '\trumprun_platefs(dirlist, __arraycount(dirlist),\n' printf '\t files, __arraycount(files));\n' printf '}\n' } diff --git a/lib/librumprun_base/Makefile b/lib/librumprun_base/Makefile index e6c556c..1426205 100644 --- a/lib/librumprun_base/Makefile +++ b/lib/librumprun_base/Makefile @@ -10,9 +10,9 @@ SRCS+= sysproxy.c # doesn't really belong here, but at the moment we don't have # a rumpkernel-only "userspace" lib -SRCS+= genfs.c +SRCS+= platefs.c -INCS= genfs.h +INCS= platefs.h INCSDIR= /usr/include/rumprun WARNS= 5 diff --git a/lib/librumprun_base/genfs.c b/lib/librumprun_base/genfs.c deleted file mode 100644 index 7416a71..0000000 --- a/lib/librumprun_base/genfs.c +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2016 Antti Kantee - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#include -#include - -#include -#include -#include - -#include - -void -rumprun_genfs(const char **dirs, size_t ndirs, - struct rumprun_extfile *refs, size_t nrefs) -{ - unsigned i; - int fd; - - for (i = 0; i < ndirs; i++) { - if (rump_sys_mkdir(dirs[i], 0777) == -1) { - if (*bmk_sched_geterrno() != RUMP_EEXIST) - bmk_platform_halt("genfs: mkdir"); - } - } - - - for (i = 0; i < nrefs; i++) { - if ((fd = rump_sys_open(refs[i].ref_fname, - RUMP_O_CREAT | RUMP_O_RDWR | RUMP_O_EXCL, 0777)) == -1) - bmk_platform_halt("genfs: open"); - if (rump_sys_fcntl(fd, RUMPFS_FCNTL_EXTSTORAGE_ADD, - &refs[i].ref_es) == -1) - bmk_platform_halt("genfs: fcntl"); - rump_sys_close(fd); - } -} diff --git a/lib/librumprun_base/genfs.h b/lib/librumprun_base/genfs.h deleted file mode 100644 index 93aa480..0000000 --- a/lib/librumprun_base/genfs.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 2016 Antti Kantee - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _RUMPRUN_GENFS_H_ -#define _RUMPRUN_GENFS_H_ - -#include - -struct rumprun_extfile { - const char *ref_fname; - struct rumpfs_extstorage ref_es; -}; - -void rumprun_genfs(const char **, size_t, struct rumprun_extfile *, size_t); - -#endif /* _RUMPRUN_GENFS_H_ */ diff --git a/lib/librumprun_base/platefs.c b/lib/librumprun_base/platefs.c new file mode 100644 index 0000000..15d5c63 --- /dev/null +++ b/lib/librumprun_base/platefs.c @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2016 Antti Kantee + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include +#include +#include + +#include + +void +rumprun_platefs(const char **dirs, size_t ndirs, + struct rumprun_extfile *refs, size_t nrefs) +{ + unsigned i; + int fd; + + for (i = 0; i < ndirs; i++) { + if (rump_sys_mkdir(dirs[i], 0777) == -1) { + if (*bmk_sched_geterrno() != RUMP_EEXIST) + bmk_platform_halt("platefs: mkdir"); + } + } + + + for (i = 0; i < nrefs; i++) { + if ((fd = rump_sys_open(refs[i].ref_fname, + RUMP_O_CREAT | RUMP_O_RDWR | RUMP_O_EXCL, 0777)) == -1) + bmk_platform_halt("platefs: open"); + if (rump_sys_fcntl(fd, RUMPFS_FCNTL_EXTSTORAGE_ADD, + &refs[i].ref_es) == -1) + bmk_platform_halt("platefs: fcntl"); + rump_sys_close(fd); + } +} diff --git a/lib/librumprun_base/platefs.h b/lib/librumprun_base/platefs.h new file mode 100644 index 0000000..45d8bfe --- /dev/null +++ b/lib/librumprun_base/platefs.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2016 Antti Kantee + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _RUMPRUN_GENFS_H_ +#define _RUMPRUN_GENFS_H_ + +#include + +struct rumprun_extfile { + const char *ref_fname; + struct rumpfs_extstorage ref_es; +}; + +void rumprun_platefs(const char **, size_t, + struct rumprun_extfile *, size_t); + +#endif /* _RUMPRUN_GENFS_H_ */