1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/dstest_ext2fs.cfg Thu Apr 22 00:12:16 2021 +0200
1.3 @@ -0,0 +1,23 @@
1.4 +-- vim:set ft=lua:
1.5 +
1.6 +local L4 = require("L4");
1.7 +
1.8 +local l = L4.default_loader;
1.9 +
1.10 +local blocksvr = l:new_channel();
1.11 +
1.12 +l:startv({
1.13 + caps = {
1.14 + server = blocksvr:svr(),
1.15 + },
1.16 + log = { "blocksvr", "r" },
1.17 + },
1.18 + "rom/dstest_block_server", "10");
1.19 +
1.20 +l:startv({
1.21 + caps = {
1.22 + server = blocksvr,
1.23 + },
1.24 + log = { "client", "r" },
1.25 + },
1.26 + "rom/dstest_ext2fs_client", "server", "rom/e2test.fs");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/conf/dstest_ext2fs.list Thu Apr 22 00:12:16 2021 +0200
2.3 @@ -0,0 +1,26 @@
2.4 +entry dstest_ext2fs
2.5 +roottask moe rom/dstest_ext2fs.cfg
2.6 +module dstest_ext2fs.cfg
2.7 +module e2test.fs
2.8 +module l4re
2.9 +module ned
2.10 +module dstest_block_server
2.11 +module dstest_ext2fs_client
2.12 +module lib4re-c.so
2.13 +module lib4re-c-util.so
2.14 +module lib4re.so
2.15 +module lib4re-util.so
2.16 +module libc_be_l4refile.so
2.17 +module libc_be_l4re.so
2.18 +module libc_be_socket_noop.so
2.19 +module libc_support_misc.so
2.20 +module libdl.so
2.21 +module libipc.so
2.22 +module libl4sys-direct.so
2.23 +module libl4sys.so
2.24 +module libl4util.so
2.25 +module libld-l4.so
2.26 +module libpthread.so
2.27 +module libstdc++.so
2.28 +module libsupc++.so
2.29 +module libuc_c.so
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/libe2access_blockserver/Control Thu Apr 22 00:12:16 2021 +0200
3.3 @@ -0,0 +1,3 @@
3.4 +requires: libc libext2fs libe2access libext2fs_blockserver
3.5 +provides: libe2access_blockserver
3.6 +maintainer: paul@boddie.org.uk
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/libe2access_blockserver/Makefile Thu Apr 22 00:12:16 2021 +0200
4.3 @@ -0,0 +1,4 @@
4.4 +PKGDIR ?= .
4.5 +L4DIR ?= $(PKGDIR)/../../..
4.6 +
4.7 +include $(L4DIR)/mk/subdir.mk
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/libe2access_blockserver/include/Makefile Thu Apr 22 00:12:16 2021 +0200
5.3 @@ -0,0 +1,7 @@
5.4 +PKGDIR ?= ..
5.5 +L4DIR ?= $(PKGDIR)/../../..
5.6 +
5.7 +PKGNAME = libe2access_blockserver
5.8 +CONTRIB_HEADERS = 1
5.9 +
5.10 +include $(L4DIR)/mk/include.mk
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/libe2access_blockserver/include/e2access/fs.h Thu Apr 22 00:12:16 2021 +0200
6.3 @@ -0,0 +1,41 @@
6.4 +/*
6.5 + * Filesystem opening functions.
6.6 + *
6.7 + * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
6.8 + *
6.9 + * This program is free software; you can redistribute it and/or
6.10 + * modify it under the terms of the GNU General Public License as
6.11 + * published by the Free Software Foundation; either version 2 of
6.12 + * the License, or (at your option) any later version.
6.13 + *
6.14 + * This program is distributed in the hope that it will be useful,
6.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.17 + * GNU General Public License for more details.
6.18 + *
6.19 + * You should have received a copy of the GNU General Public License
6.20 + * along with this program; if not, write to the Free Software
6.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
6.22 + * Boston, MA 02110-1301, USA
6.23 + */
6.24 +
6.25 +#ifndef __FS_H__
6.26 +#define __FS_H__
6.27 +
6.28 +#include <ext2fs/ext2fs.h>
6.29 +
6.30 +
6.31 +
6.32 +#ifdef __cplusplus
6.33 +extern "C" {
6.34 +#endif
6.35 +
6.36 +void e2access_init(const char *cap);
6.37 +errcode_t e2access_open(const char *filename, int flags, ext2_filsys *fs);
6.38 +
6.39 +#ifdef __cplusplus
6.40 +}
6.41 +#endif
6.42 +
6.43 +
6.44 +#endif /* __FS_H__ */
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/libe2access_blockserver/lib/Makefile Thu Apr 22 00:12:16 2021 +0200
7.3 @@ -0,0 +1,4 @@
7.4 +PKGDIR ?= ..
7.5 +L4DIR ?= $(PKGDIR)/../../..
7.6 +
7.7 +include $(L4DIR)/mk/subdir.mk
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/libe2access_blockserver/lib/src/Makefile Thu Apr 22 00:12:16 2021 +0200
8.3 @@ -0,0 +1,13 @@
8.4 +PKGDIR ?= ../..
8.5 +L4DIR ?= $(PKGDIR)/../../..
8.6 +
8.7 +TARGET = libe2access_blockserver.a libe2access_blockserver.so
8.8 +PC_FILENAME = libe2access_blockserver
8.9 +SRC_C = fs.c
8.10 +
8.11 +REQUIRES_LIBS = libext2fs libe2access libext2fs_blockserver
8.12 +
8.13 +PRIVATE_INCDIR = $(PKGDIR)/include/e2access
8.14 +CONTRIB_INCDIR = libe2access_blockserver
8.15 +
8.16 +include $(L4DIR)/mk/lib.mk
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/libe2access_blockserver/lib/src/fs.c Thu Apr 22 00:12:16 2021 +0200
9.3 @@ -0,0 +1,53 @@
9.4 +/*
9.5 + * Filesystem opening functions.
9.6 + *
9.7 + * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
9.8 + *
9.9 + * This program is free software; you can redistribute it and/or
9.10 + * modify it under the terms of the GNU General Public License as
9.11 + * published by the Free Software Foundation; either version 2 of
9.12 + * the License, or (at your option) any later version.
9.13 + *
9.14 + * This program is distributed in the hope that it will be useful,
9.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.17 + * GNU General Public License for more details.
9.18 + *
9.19 + * You should have received a copy of the GNU General Public License
9.20 + * along with this program; if not, write to the Free Software
9.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
9.22 + * Boston, MA 02110-1301, USA
9.23 + */
9.24 +
9.25 +#include "fs.h"
9.26 +
9.27 +
9.28 +
9.29 +/* Block server access configuration. */
9.30 +
9.31 +extern io_manager blockserver_io_manager;
9.32 +extern const char *blockserver_default_cap;
9.33 +
9.34 +
9.35 +
9.36 +/* Set the capability name used to access the underlying block server. */
9.37 +
9.38 +void e2access_init(const char *cap)
9.39 +{
9.40 + blockserver_default_cap = cap;
9.41 +}
9.42 +
9.43 +/* Open a filesystem provided by the indicated filename, using the given flags
9.44 + and updating the filesystem reference. Any error is returned. */
9.45 +
9.46 +errcode_t e2access_open(const char *filename, int flags, ext2_filsys *fs)
9.47 +{
9.48 + errcode_t retval = ext2fs_open(filename, flags, 0, 0, blockserver_io_manager, fs);
9.49 +
9.50 + if (retval)
9.51 + return retval;
9.52 +
9.53 + return ext2fs_read_bitmaps(*fs);
9.54 +}
9.55 +
9.56 +// vim: tabstop=2 expandtab shiftwidth=2
10.1 --- a/tests/Control Wed Apr 21 23:17:32 2021 +0200
10.2 +++ b/tests/Control Thu Apr 22 00:12:16 2021 +0200
10.3 @@ -1,3 +1,3 @@
10.4 -requires: libstdc++ libc libipc libfsclient libmem
10.5 +requires: libstdc++ libc libipc libfsclient libmem libext2fs libext2fs_blockserver libe2access_blockserver
10.6 provides: fstests
10.7 maintainer: paul@boddie.org.uk
11.1 --- a/tests/Makefile Wed Apr 21 23:17:32 2021 +0200
11.2 +++ b/tests/Makefile Thu Apr 22 00:12:16 2021 +0200
11.3 @@ -3,6 +3,7 @@
11.4
11.5 TARGET = \
11.6 dstest_block_client dstest_block_client_simple \
11.7 + dstest_ext2fs_client \
11.8 dstest_host_client \
11.9 dstest_pipe_client \
11.10 dstest_test_client \
11.11 @@ -13,12 +14,14 @@
11.12
11.13 SRC_CC_dstest_block_client_simple = dstest_block_client_simple.cc
11.14
11.15 +SRC_CC_dstest_ext2fs_client = dstest_ext2fs_client.cc
11.16 +
11.17 SRC_CC_dstest_host_client = dstest_host_client.cc
11.18
11.19 SRC_CC_dstest_pipe_client = dstest_pipe_client.cc
11.20
11.21 SRC_CC_dstest_test_client = dstest_test_client.cc
11.22
11.23 -REQUIRES_LIBS = l4re_c-util libfsclient libmem libipc libstdc++ libsystypes
11.24 +REQUIRES_LIBS = l4re_c-util libfsclient libmem libipc libstdc++ libsystypes libe2access_blockserver
11.25
11.26 include $(L4DIR)/mk/prog.mk
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/tests/dstest_ext2fs_client.cc Thu Apr 22 00:12:16 2021 +0200
12.3 @@ -0,0 +1,62 @@
12.4 +/*
12.5 + * Test dataspace operations.
12.6 + *
12.7 + * Copyright (C) 2020, 2021 Paul Boddie <paul@boddie.org.uk>
12.8 + *
12.9 + * This program is free software; you can redistribute it and/or
12.10 + * modify it under the terms of the GNU General Public License as
12.11 + * published by the Free Software Foundation; either version 2 of
12.12 + * the License, or (at your option) any later version.
12.13 + *
12.14 + * This program is distributed in the hope that it will be useful,
12.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.17 + * GNU General Public License for more details.
12.18 + *
12.19 + * You should have received a copy of the GNU General Public License
12.20 + * along with this program; if not, write to the Free Software
12.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
12.22 + * Boston, MA 02110-1301, USA
12.23 + */
12.24 +
12.25 +#include <systypes/fcntl.h>
12.26 +
12.27 +#include <stdio.h>
12.28 +
12.29 +#include <fsclient/client.h>
12.30 +
12.31 +#include <e2access/fs.h>
12.32 +
12.33 +
12.34 +
12.35 +int main(int argc, char *argv[])
12.36 +{
12.37 + if (argc < 3)
12.38 + {
12.39 + printf("Need a device and filename.\n");
12.40 + return 1;
12.41 + }
12.42 +
12.43 + /* Obtain device, filename and access parameters. */
12.44 +
12.45 + char *device = argv[1];
12.46 + char *filename = argv[2];
12.47 +
12.48 + e2access_init(device);
12.49 +
12.50 + ext2_filsys fs = NULL;
12.51 +
12.52 + errcode_t retval = e2access_open(filename, EXT2_FLAG_RW, &fs); // EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS
12.53 +
12.54 + if (retval)
12.55 + {
12.56 + printf("Could not obtain filesystem: %ld.\n", retval);
12.57 + return 1;
12.58 + }
12.59 +
12.60 + printf("Access completed.\n");
12.61 +
12.62 + return 0;
12.63 +}
12.64 +
12.65 +// vim: tabstop=2 expandtab shiftwidth=2