diff options
-rw-r--r-- | .editorconfig | 2 | ||||
-rw-r--r-- | GNUmakefile | 12 | ||||
-rw-r--r-- | build-aux/measurestack/app_plugins.py | 2 | ||||
-rw-r--r-- | cmd/sbc_harness/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib9p/CMakeLists.txt | 30 | ||||
-rw-r--r-- | lib9p/core.c (renamed from lib9p/9p.c) | 4 | ||||
-rwxr-xr-x | lib9p/core.gen (renamed from lib9p/proto.gen) | 8 | ||||
-rw-r--r-- | lib9p/core_gen/__init__.py (renamed from lib9p/protogen/__init__.py) | 8 | ||||
-rw-r--r-- | lib9p/core_gen/c.py (renamed from lib9p/protogen/c.py) | 8 | ||||
-rw-r--r-- | lib9p/core_gen/c9util.py (renamed from lib9p/protogen/c9util.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_format.py (renamed from lib9p/protogen/c_format.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_marshal.py (renamed from lib9p/protogen/c_marshal.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_unmarshal.py (renamed from lib9p/protogen/c_unmarshal.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_validate.py (renamed from lib9p/protogen/c_validate.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/cutil.py (renamed from lib9p/protogen/cutil.py) | 2 | ||||
-rw-r--r-- | lib9p/core_gen/h.py (renamed from lib9p/protogen/h.py) | 6 | ||||
-rw-r--r-- | lib9p/core_gen/idlutil.py (renamed from lib9p/protogen/idlutil.py) | 2 | ||||
-rw-r--r-- | lib9p/core_generated.c (renamed from lib9p/9p.generated.c) | 8 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/_core_generated.h (renamed from lib9p/include/lib9p/9p.generated.h) | 6 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/core.h (renamed from lib9p/include/lib9p/9p.h) | 10 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/linux-errno.h (renamed from lib9p/include/lib9p/linux-errno.h) | 0 | ||||
-rwxr-xr-x | lib9p/core_include/lib9p/linux-errno.h.gen (renamed from lib9p/include/lib9p/linux-errno.h.gen) | 0 | ||||
-rw-r--r-- | lib9p/core_tables.c (renamed from lib9p/tables.c) | 4 | ||||
-rw-r--r-- | lib9p/core_tables.h (renamed from lib9p/tables.h) | 10 | ||||
-rw-r--r-- | lib9p/core_utf8.h (renamed from lib9p/utf8.h) | 8 | ||||
-rw-r--r-- | lib9p/srv.c | 2 | ||||
-rw-r--r-- | lib9p/srv_include/lib9p/srv.h (renamed from lib9p/include/lib9p/srv.h) | 2 | ||||
-rw-r--r-- | lib9p/tests/client_config/config.h | 21 | ||||
-rw-r--r-- | lib9p/tests/test_compile.c | 2 | ||||
-rwxr-xr-x | lib9p/tests/test_compile.c.gen | 2 | ||||
-rw-r--r-- | lib9p/tests/test_compile_config/config.h | 19 | ||||
-rw-r--r-- | lib9p/tests/test_server/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib9p/tests/testclient-sess.c | 2 | ||||
-rw-r--r-- | lib9p_util/CMakeLists.txt | 2 |
34 files changed, 82 insertions, 113 deletions
diff --git a/.editorconfig b/.editorconfig index 7aadb15..5631ee8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -73,7 +73,7 @@ _mode = sh [{lib9p/linux-errno.txt.gen,lib9p/tests/runtest,lib9p/tests/testclient-p9p}] _mode = bash -[{lib9p/proto.gen,lib9p/include/lib9p/linux-errno.h.gen}] +[{lib9p/core.gen,lib9p/core_include/lib9p/linux-errno.h.gen}] _mode = python3 indent_style = space indent_size = 4 diff --git a/GNUmakefile b/GNUmakefile index 904977d..1249634 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -37,16 +37,16 @@ generate/files += 3rd-party/linux-errno.txt 3rd-party/linux-errno.txt: lib9p/linux-errno.txt.gen $< $(linux.git) $@ -generate/files += lib9p/include/lib9p/linux-errno.h -lib9p/include/lib9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt +generate/files += lib9p/core_include/lib9p/linux-errno.h +lib9p/core_include/lib9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt $^ >$@ -generate/files += lib9p/9p.generated.c lib9p/include/lib9p/9p.generated.h -lib9p/9p.generated.c lib9p/include/lib9p/9p.generated.h &: lib9p/proto.gen lib9p/idl/__init__.py lib9p/protogen lib9p/protogen/*.py lib9p/idl lib9p/idl/*.9p +generate/files += lib9p/core_generated.c lib9p/core_include/lib9p/_core_generated.h +lib9p/core_generated.c lib9p/core_include/lib9p/_core_generated.h &: lib9p/core.gen lib9p/idl/__init__.py lib9p/core_gen lib9p/core_gen/*.py lib9p/idl lib9p/idl/*.9p $< $(filter %.9p,$^) generate/files += lib9p/tests/test_compile.c -lib9p/tests/test_compile.c: %: %.gen lib9p/include/lib9p/9p.generated.h +lib9p/tests/test_compile.c: %: %.gen lib9p/core_include/lib9p/_core_generated.h $^ $@ generate/files += libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt @@ -130,7 +130,7 @@ lint/python3: lint/%: build-aux/venv ./build-aux/venv/bin/black --check $(sources_$*) ./build-aux/venv/bin/isort --check $(sources_$*) ./build-aux/venv/bin/pylint $(sources_$*) - ! grep -nh 'SPECIAL$$' -- lib9p/proto.gen lib9p/protogen/*.py + ! grep -nh 'SPECIAL$$' -- lib9p/core.gen lib9p/core_gen/*.py ./build-aux/venv/bin/pytest $(foreach f,$(sources_python3),$(if $(filter test_%.py,$(notdir $f)),$f)) lint/make lint/cmake lint/gitignore lint/ini lint/9p-idl lint/9p-log lint/markdown lint/pip lint/man-cat: lint/%: @: TODO: Write/adopt linters for these file types diff --git a/build-aux/measurestack/app_plugins.py b/build-aux/measurestack/app_plugins.py index 16ac297..9152ef3 100644 --- a/build-aux/measurestack/app_plugins.py +++ b/build-aux/measurestack/app_plugins.py @@ -305,7 +305,7 @@ class Lib9PPlugin: ) lib9p_generated_c_fname = util.get_zero_or_one( - lambda fname: fname.endswith("lib9p/9p.generated.c"), arg_c_fnames + lambda fname: fname.endswith("lib9p/_core_generated.c"), arg_c_fnames ) # Read config ########################################################## diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index 678af07..6e722d7 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -30,7 +30,7 @@ target_link_libraries(sbc_harness_objs libusb libdhcp libhw_cr - lib9p + lib9p_srv lib9p_util ) pico_minimize_runtime(sbc_harness_objs diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt index 949b6d6..543d01a 100644 --- a/lib9p/CMakeLists.txt +++ b/lib9p/CMakeLists.txt @@ -3,27 +3,35 @@ # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later -add_library(lib9p INTERFACE) -target_include_directories(lib9p PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_sources(lib9p INTERFACE - 9p.generated.c - 9p.c - tables.c - srv.c +add_library(lib9p_core INTERFACE) +target_include_directories(lib9p_core PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/core_include) +target_sources(lib9p_core INTERFACE + core.c + core_generated.c + core_tables.c ) -target_link_libraries(lib9p INTERFACE - libcr_ipc +target_link_libraries(lib9p_core INTERFACE libfmt libhw_generic libmisc ) +add_library(lib9p_srv INTERFACE) +target_include_directories(lib9p_srv PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/srv_include) +target_sources(lib9p_srv INTERFACE + srv.c +) +target_link_libraries(lib9p_srv INTERFACE + lib9p_core + libcr_ipc +) + if (ENABLE_TESTS) add_subdirectory(tests/test_server) function(add_lib9p_executable arg_testname) add_executable("${arg_testname}" "tests/${arg_testname}.c") - target_link_libraries("${arg_testname}" lib9p) + target_link_libraries("${arg_testname}" lib9p_core) target_include_directories("${arg_testname}" PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/client_config @@ -42,6 +50,6 @@ if (ENABLE_TESTS) add_lib9p_executable("testclient-sess") add_lib9p_test("./testclient-sess") - add_lib_test(lib9p test_compile) + add_lib_test(lib9p_core test_compile) target_include_directories(test_compile PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_compile_config) endif() diff --git a/lib9p/9p.c b/lib9p/core.c index e7b20b5..a07461d 100644 --- a/lib9p/9p.c +++ b/lib9p/core.c @@ -1,4 +1,4 @@ -/* lib9p/9p.c - Base 9P protocol utilities for both clients and servers +/* lib9p/core.c - Base 9P protocol utilities for both clients and servers * * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later @@ -10,7 +10,7 @@ #include <libfmt/fmt.h> /* for fmt_vsnprintf() */ -#include <lib9p/9p.h> +#include <lib9p/core.h> /* strings ********************************************************************/ diff --git a/lib9p/proto.gen b/lib9p/core.gen index 60f1347..b30ec31 100755 --- a/lib9p/proto.gen +++ b/lib9p/core.gen @@ -1,6 +1,6 @@ #!/usr/bin/env python -# lib9p/proto.gen - Generate C marshalers/unmarshalers for .9p files -# defining 9P protocol variants. +# lib9p/core.gen - Generate C marshalers/unmarshalers for .9p files +# defining 9P protocol variants. # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later @@ -9,7 +9,7 @@ import os.path import sys sys.path.insert(0, os.path.normpath(os.path.join(__file__, ".."))) -import protogen # pylint: disable=wrong-import-position +import core_gen # pylint: disable=wrong-import-position if __name__ == "__main__": - protogen.main() + core_gen.main() diff --git a/lib9p/protogen/__init__.py b/lib9p/core_gen/__init__.py index c2c6173..b0da237 100644 --- a/lib9p/protogen/__init__.py +++ b/lib9p/core_gen/__init__.py @@ -1,4 +1,4 @@ -# lib9p/protogen/__init__.py - Generate C marshalers/unmarshalers for +# lib9p/core_gen/__init__.py - Generate C marshalers/unmarshalers for # .9p files defining 9P protocol variants # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> @@ -50,8 +50,10 @@ def main() -> None: versions, typs = parser.all() outdir = os.path.normpath(os.path.join(sys.argv[0], "..")) with open( - os.path.join(outdir, "include/lib9p/9p.generated.h"), "w", encoding="utf-8" + os.path.join(outdir, "core_include/lib9p/_core_generated.h"), + "w", + encoding="utf-8", ) as fh: fh.write(h.gen_h(versions, typs)) - with open(os.path.join(outdir, "9p.generated.c"), "w", encoding="utf-8") as fh: + with open(os.path.join(outdir, "core_generated.c"), "w", encoding="utf-8") as fh: fh.write(c.gen_c(versions, typs)) diff --git a/lib9p/protogen/c.py b/lib9p/core_gen/c.py index 530bdb6..b2e856d 100644 --- a/lib9p/protogen/c.py +++ b/lib9p/core_gen/c.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c.py - Generate 9p.generated.c +# lib9p/core_gen/c.py - Generate core_generated.c # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later @@ -31,10 +31,10 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str: #include <libmisc/assert.h> #include <libmisc/endian.h> -#include <lib9p/9p.h> +#include <lib9p/core.h> -#include "tables.h" -#include "utf8.h" +#include "core_tables.h" +#include "core_utf8.h" """ # libobj vtables ########################################################### ret += """ diff --git a/lib9p/protogen/c9util.py b/lib9p/core_gen/c9util.py index cf91951..84fdee4 100644 --- a/lib9p/protogen/c9util.py +++ b/lib9p/core_gen/c9util.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c9util.py - Utilities for generating lib9p-specific C +# lib9p/core_gen/c9util.py - Utilities for generating lib9p-specific C # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/c_format.py b/lib9p/core_gen/c_format.py index 4a809d1..8c0cded 100644 --- a/lib9p/protogen/c_format.py +++ b/lib9p/core_gen/c_format.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c_format.py - Generate C pretty-print functions +# lib9p/core_gen/c_format.py - Generate C pretty-print functions # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/c_marshal.py b/lib9p/core_gen/c_marshal.py index 4dab864..e8f00ac 100644 --- a/lib9p/protogen/c_marshal.py +++ b/lib9p/core_gen/c_marshal.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c_marshal.py - Generate C marshal functions +# lib9p/core_gen/c_marshal.py - Generate C marshal functions # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/c_unmarshal.py b/lib9p/core_gen/c_unmarshal.py index 34635f9..1afbe1d 100644 --- a/lib9p/protogen/c_unmarshal.py +++ b/lib9p/core_gen/c_unmarshal.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c_unmarshal.py - Generate C unmarshal functions +# lib9p/core_gen/c_unmarshal.py - Generate C unmarshal functions # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/c_validate.py b/lib9p/core_gen/c_validate.py index 535a750..1ddaf44 100644 --- a/lib9p/protogen/c_validate.py +++ b/lib9p/core_gen/c_validate.py @@ -1,4 +1,4 @@ -# lib9p/protogen/c_validate.py - Generate C validation functions +# lib9p/core_gen/c_validate.py - Generate C validation functions # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/cutil.py b/lib9p/core_gen/cutil.py index 8df6db9..9183cc4 100644 --- a/lib9p/protogen/cutil.py +++ b/lib9p/core_gen/cutil.py @@ -1,4 +1,4 @@ -# lib9p/protogen/cutil.py - Utilities for generating C code +# lib9p/core_gen/cutil.py - Utilities for generating C code # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/protogen/h.py b/lib9p/core_gen/h.py index 8f7fba2..3defcb8 100644 --- a/lib9p/protogen/h.py +++ b/lib9p/core_gen/h.py @@ -1,4 +1,4 @@ -# lib9p/protogen/h.py - Generate 9p.generated.h +# lib9p/core_gen/h.py - Generate _core_generated.h # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later @@ -159,8 +159,8 @@ def gen_h(versions: set[str], typs: list[idl.UserType]) -> str: ret = f"""/* Generated by `{' '.join(sys.argv)}`. DO NOT EDIT! */ -#ifndef _LIB9P_9P_H_ -\t#error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead +#ifndef _LIB9P_CORE_H_ +\t#error Do not include <lib9p/_core_generated.h> directly; include <lib9p/core.h> instead #endif #include <stdint.h> /* for uint{{n}}_t types */ diff --git a/lib9p/protogen/idlutil.py b/lib9p/core_gen/idlutil.py index dc4d012..9843675 100644 --- a/lib9p/protogen/idlutil.py +++ b/lib9p/core_gen/idlutil.py @@ -1,4 +1,4 @@ -# lib9p/protogen/idlutil.py - Utilities for working with the 9P idl package +# lib9p/core_gen/idlutil.py - Utilities for working with the 9P idl package # # Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib9p/9p.generated.c b/lib9p/core_generated.c index 914a612..ee78bff 100644 --- a/lib9p/9p.generated.c +++ b/lib9p/core_generated.c @@ -1,4 +1,4 @@ -/* Generated by `lib9p/proto.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ +/* Generated by `lib9p/core.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ #include <stdbool.h> #include <stddef.h> /* for size_t */ @@ -8,10 +8,10 @@ #include <libmisc/assert.h> #include <libmisc/endian.h> -#include <lib9p/9p.h> +#include <lib9p/core.h> -#include "tables.h" -#include "utf8.h" +#include "core_tables.h" +#include "core_utf8.h" /* libobj vtables *************************************************************/ #if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/core_include/lib9p/_core_generated.h index 49b4818..9d54eac 100644 --- a/lib9p/include/lib9p/9p.generated.h +++ b/lib9p/core_include/lib9p/_core_generated.h @@ -1,7 +1,7 @@ -/* Generated by `lib9p/proto.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ +/* Generated by `lib9p/core.gen lib9p/idl/2002-9P2000.9p lib9p/idl/2003-9P2000.p9p.9p lib9p/idl/2005-9P2000.u.9p lib9p/idl/2010-9P2000.L.9p lib9p/idl/2012-9P2000.e.9p`. DO NOT EDIT! */ -#ifndef _LIB9P_9P_H_ - #error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead +#ifndef _LIB9P_CORE_H_ + #error Do not include <lib9p/_core_generated.h> directly; include <lib9p/core.h> instead #endif #include <stdint.h> /* for uint{n}_t types */ diff --git a/lib9p/include/lib9p/9p.h b/lib9p/core_include/lib9p/core.h index 42381cf..24d28ac 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/core_include/lib9p/core.h @@ -1,11 +1,11 @@ -/* lib9p/9p.h - Base 9P protocol definitions for both clients and servers +/* lib9p/core.h - Base 9P protocol definitions for both clients and servers * * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIB9P_9P_H_ -#define _LIB9P_9P_H_ +#ifndef _LIB9P_CORE_H_ +#define _LIB9P_CORE_H_ #include <stdbool.h> #include <sys/types.h> /* for ssize_t */ @@ -13,7 +13,7 @@ #include <libmisc/assert.h> #include <lib9p/linux-errno.h> -#include <lib9p/9p.generated.h> +#include <lib9p/_core_generated.h> #ifndef CONFIG_9P_MAX_ERR_SIZE #error config.h must define CONFIG_9P_MAX_ERR_SIZE @@ -203,4 +203,4 @@ void lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct lib9p_stat *obj, uint8_t *ret_bytes); -#endif /* _LIB9P_9P_H_ */ +#endif /* _LIB9P_CORE_H_ */ diff --git a/lib9p/include/lib9p/linux-errno.h b/lib9p/core_include/lib9p/linux-errno.h index e864fb6..e864fb6 100644 --- a/lib9p/include/lib9p/linux-errno.h +++ b/lib9p/core_include/lib9p/linux-errno.h diff --git a/lib9p/include/lib9p/linux-errno.h.gen b/lib9p/core_include/lib9p/linux-errno.h.gen index 2c736a2..2c736a2 100755 --- a/lib9p/include/lib9p/linux-errno.h.gen +++ b/lib9p/core_include/lib9p/linux-errno.h.gen diff --git a/lib9p/tables.c b/lib9p/core_tables.c index 86e3298..e4cbd4a 100644 --- a/lib9p/tables.c +++ b/lib9p/core_tables.c @@ -1,4 +1,4 @@ -/* lib9p/tables.c - Access tables of version and message information +/* lib9p/core_tables.c - Access tables of version and message information * * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later @@ -9,7 +9,7 @@ #include <libmisc/endian.h> #include <libmisc/log.h> /* for const_byte_str() */ -#include "tables.h" +#include "core_tables.h" /* bounds checks **************************************************************/ diff --git a/lib9p/tables.h b/lib9p/core_tables.h index edb402a..2c5f745 100644 --- a/lib9p/tables.h +++ b/lib9p/core_tables.h @@ -1,13 +1,13 @@ -/* lib9p/tables.h - Declare tables of version and message information +/* lib9p/core_tables.h - Declare tables of version and message information * * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIB9P_TABLES_H_ -#define _LIB9P_TABLES_H_ +#ifndef _LIB9P_CORE_TABLES_H_ +#define _LIB9P_CORE_TABLES_H_ -#include <lib9p/9p.h> +#include <lib9p/core.h> /* version ********************************************************************/ @@ -56,4 +56,4 @@ ssize_t _lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t * void _lib9p_stat_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out); bool _lib9p_stat_marshal(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _marshal_ret *ret); -#endif /* _LIB9P_TABLES_H_ */ +#endif /* _LIB9P_CORE_TABLES_H_ */ diff --git a/lib9p/utf8.h b/lib9p/core_utf8.h index 5ffd674..636d4eb 100644 --- a/lib9p/utf8.h +++ b/lib9p/core_utf8.h @@ -1,11 +1,11 @@ -/* lib9p/utf8.h - Internal UTF-8 validation +/* lib9p/core_utf8.h - Internal UTF-8 validation * * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ -#ifndef _LIB9P_UTF8_H_ -#define _LIB9P_UTF8_H_ +#ifndef _LIB9P_CORE_UTF8_H_ +#define _LIB9P_CORE_UTF8_H_ static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) { uint32_t ch; @@ -31,4 +31,4 @@ static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) { #define is_valid_utf8(str, len) _is_valid_utf8(str, len, false) #define is_valid_utf8_without_nul(str, len) _is_valid_utf8(str, len, true) -#endif /* _LIB9P_UTF8_H_ */ +#endif /* _LIB9P_CORE_UTF8_H_ */ diff --git a/lib9p/srv.c b/lib9p/srv.c index 0a33e03..c64f995 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -382,7 +382,7 @@ static void srv_respond_error(struct srv_req *req) { /* XXX: This assumes that a version's min_msg_size is the * Rerror overhead. That's true for the current - * implementation of protogen, but is a sneaky assumption. */ + * implementation of core_gen, but is a sneaky assumption. */ uint32_t overhead = lib9p_version_min_msg_size(sess->version); /* Truncate the error-string if necessary to avoid needing to diff --git a/lib9p/include/lib9p/srv.h b/lib9p/srv_include/lib9p/srv.h index bb5efb9..03021d5 100644 --- a/lib9p/include/lib9p/srv.h +++ b/lib9p/srv_include/lib9p/srv.h @@ -15,7 +15,7 @@ #include <libmisc/private.h> #include <libobj/obj.h> -#include <lib9p/9p.h> +#include <lib9p/core.h> /* context ********************************************************************/ diff --git a/lib9p/tests/client_config/config.h b/lib9p/tests/client_config/config.h index 65ee9de..bcf030d 100644 --- a/lib9p/tests/client_config/config.h +++ b/lib9p/tests/client_config/config.h @@ -7,8 +7,6 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -/* 9P *************************************************************************/ - #define CONFIG_9P_MAX_ERR_SIZE 128 #define CONFIG_9P_MAX_9P2000_e_WELEM 16 @@ -18,23 +16,4 @@ #define CONFIG_9P_ENABLE_9P2000_L 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_p9p 1 /* bool */ -/* 9P server (unused) *********************************************************/ - -#define CONFIG_9P_SRV_MAX_MSG_SIZE ((4*1024)+24) -#define CONFIG_9P_SRV_MAX_HOSTMSG_SIZE CONFIG_9P_SRV_MAX_MSG_SIZE+16 -#define CONFIG_9P_SRV_MAX_FIDS 16 -#define CONFIG_9P_SRV_MAX_REQS 2 -#define CONFIG_9P_SRV_MAX_DEPTH 3 - -/* COROUTINE (unused) *********************************************************/ - -#define CONFIG_COROUTINE_STACK_SIZE_DEFAULT (32*1024) -#define CONFIG_COROUTINE_NAME_LEN 16 -#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ -#define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */ -#define CONFIG_COROUTINE_DEBUG 0 /* bool */ -#define CONFIG_COROUTINE_VALGRIND 1 /* bool */ -#define CONFIG_COROUTINE_GDB 1 /* bool */ -#define CONFIG_COROUTINE_NUM 2 - #endif /* _CONFIG_H_ */ diff --git a/lib9p/tests/test_compile.c b/lib9p/tests/test_compile.c index 8f2445d..9245eb2 100644 --- a/lib9p/tests/test_compile.c +++ b/lib9p/tests/test_compile.c @@ -1,6 +1,6 @@ /* lib9p/tests/test_compile.c - Generated by lib9p/tests/test_compile.c.gen. DO NOT EDIT! */ -#include <lib9p/9p.h> +#include <lib9p/core.h> int main(void) { [[gnu::unused]] uint64_t x; x = LIB9P_TAG_NOTAG; diff --git a/lib9p/tests/test_compile.c.gen b/lib9p/tests/test_compile.c.gen index 47046b3..1289943 100755 --- a/lib9p/tests/test_compile.c.gen +++ b/lib9p/tests/test_compile.c.gen @@ -10,7 +10,7 @@ outfile=$2 { echo "/* ${outfile} - Generated by $0. DO NOT EDIT! */" echo - echo "#include <lib9p/9p.h>" + echo "#include <lib9p/core.h>" echo 'int main(void) {' echo ' [[gnu::unused]] uint64_t x;' sed -nE 's/^\s*#\s*define\s*(\S[^ (]*)\s.*/ x = \1;/p' <"$generated_h" diff --git a/lib9p/tests/test_compile_config/config.h b/lib9p/tests/test_compile_config/config.h index cc8eec1..f899dfa 100644 --- a/lib9p/tests/test_compile_config/config.h +++ b/lib9p/tests/test_compile_config/config.h @@ -7,32 +7,13 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -/* 9P *************************************************************************/ - #define CONFIG_9P_MAX_ERR_SIZE 128 #define CONFIG_9P_MAX_9P2000_e_WELEM 16 -#define CONFIG_9P_SRV_MAX_MSG_SIZE ((4*1024)+24) -#define CONFIG_9P_SRV_MAX_HOSTMSG_SIZE CONFIG_9P_SRV_MAX_MSG_SIZE+16 -#define CONFIG_9P_SRV_MAX_FIDS 16 -#define CONFIG_9P_SRV_MAX_REQS 2 -#define CONFIG_9P_SRV_MAX_DEPTH 3 - #define CONFIG_9P_ENABLE_9P2000 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_e 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_L 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_p9p 1 /* bool */ -/* COROUTINE ******************************************************************/ - -#define CONFIG_COROUTINE_STACK_SIZE_DEFAULT (32*1024) -#define CONFIG_COROUTINE_NAME_LEN 16 -#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ -#define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */ -#define CONFIG_COROUTINE_DEBUG 0 /* bool */ -#define CONFIG_COROUTINE_VALGRIND 1 /* bool */ -#define CONFIG_COROUTINE_GDB 1 /* bool */ -#define CONFIG_COROUTINE_NUM 2 - #endif /* _CONFIG_H_ */ diff --git a/lib9p/tests/test_server/CMakeLists.txt b/lib9p/tests/test_server/CMakeLists.txt index 681e583..b659373 100644 --- a/lib9p/tests/test_server/CMakeLists.txt +++ b/lib9p/tests/test_server/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries(test_server_objs libcr libcr_ipc libmisc - lib9p lib9p_util libhw_cr ) diff --git a/lib9p/tests/testclient-sess.c b/lib9p/tests/testclient-sess.c index 437c489..764168d 100644 --- a/lib9p/tests/testclient-sess.c +++ b/lib9p/tests/testclient-sess.c @@ -15,7 +15,7 @@ #include <libmisc/assert.h> #include <libmisc/endian.h> -#include <lib9p/9p.h> +#include <lib9p/core.h> #define MAX_MSG_SIZE (8*1024) diff --git a/lib9p_util/CMakeLists.txt b/lib9p_util/CMakeLists.txt index 2e5790e..feeada7 100644 --- a/lib9p_util/CMakeLists.txt +++ b/lib9p_util/CMakeLists.txt @@ -9,5 +9,5 @@ target_sources(lib9p_util INTERFACE static.c ) target_link_libraries(lib9p_util INTERFACE - lib9p + lib9p_srv ) |