diff --git a/Makefile.am b/Makefile.am index 141c336..294d763 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,9 +73,6 @@ endif # Default packages # #################### -if WITH_MBR -libkernaux_la_SOURCES += src/mbr.c -endif if WITH_PFA libkernaux_la_SOURCES += src/pfa.c endif diff --git a/README.md b/README.md index 30c1b41..ea7a437 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,6 @@ zero). Work-in-progress APIs can change at any time. * Stack trace *(planned)* * Algorithms * [Page Frame Allocator](/include/kernaux/pfa.h) (*work in progress*) -* Data formats - * [MBR](/include/kernaux/mbr.h) (*work in progress*) * libc replacement (*work in progress*) * [ctype.h](/libc/include/ctype.h) * [errno.h](/libc/include/errno.h) diff --git a/configure.ac b/configure.ac index 9853a17..ab98184 100644 --- a/configure.ac +++ b/configure.ac @@ -66,7 +66,6 @@ AC_ARG_WITH( [arch-i386], AS_HELP_STRING([--without-arch-i386], [wit AC_ARG_WITH( [arch-riscv64], AS_HELP_STRING([--without-arch-riscv64], [without architecture riscv64])) AC_ARG_WITH( [arch-x86-64], AS_HELP_STRING([--without-arch-x86-64], [without architecture x86-64])) AC_ARG_WITH( [asm], AS_HELP_STRING([--without-asm], [without kernel assembler helpers])) -AC_ARG_WITH( [mbr], AS_HELP_STRING([--without-mbr], [without MBR utils])) AC_ARG_WITH( [pfa], AS_HELP_STRING([--without-pfa], [without Page Frame Allocator])) dnl Packages (disabled by default) @@ -99,7 +98,6 @@ if test -z "$with_arch_i386"; then with_arch_i386=no; fi if test -z "$with_arch_riscv64"; then with_arch_riscv64=no; fi if test -z "$with_arch_x86_64"; then with_arch_x86_64=no; fi if test -z "$with_asm"; then with_asm=no; fi -if test -z "$with_mbr"; then with_mbr=no; fi if test -z "$with_pfa"; then with_pfa=no; fi ]) AS_IF([test "$with_all" = no], do_without_all) @@ -133,7 +131,6 @@ AS_IF([test "$with_arch_i386" = no ], [with_arch_i386=no], [wit AS_IF([test "$with_arch_riscv64" = no ], [with_arch_riscv64=no], [with_arch_riscv64=yes]) AS_IF([test "$with_arch_x86_64" = no ], [with_arch_x86_64=no], [with_arch_x86_64=yes]) AS_IF([test "$with_asm" = no ], [with_asm=no], [with_asm=yes]) -AS_IF([test "$with_mbr" = no ], [with_mbr=no], [with_mbr=yes]) AS_IF([test "$with_pfa" = no ], [with_pfa=no], [with_pfa=yes]) dnl Packages (disabled by default) @@ -181,7 +178,6 @@ AM_CONDITIONAL([WITH_ARCH_I386], [test "$with_arch_i386" = yes]) AM_CONDITIONAL([WITH_ARCH_RISCV64], [test "$with_arch_riscv64" = yes]) AM_CONDITIONAL([WITH_ARCH_X86_64], [test "$with_arch_x86_64" = yes]) AM_CONDITIONAL([WITH_ASM], [test "$with_asm" = yes]) -AM_CONDITIONAL([WITH_MBR], [test "$with_mbr" = yes]) AM_CONDITIONAL([WITH_PFA], [test "$with_pfa" = yes]) dnl Packages (disabled by default) @@ -221,7 +217,6 @@ AS_IF([test "$with_arch_i386" = yes], [AC_DEFINE([WITH_ARCH_I386], AS_IF([test "$with_arch_riscv64" = yes], [AC_DEFINE([WITH_ARCH_RISCV64], [1], [with architecture riscv64])]) AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86_64], [1], [with architecture x86_64])]) AS_IF([test "$with_asm" = yes], [AC_DEFINE([WITH_ASM], [1], [with kernel assembler helpers])]) -AS_IF([test "$with_mbr" = yes], [AC_DEFINE([WITH_MBR], [1], [with MBR utils])]) AS_IF([test "$with_pfa" = yes], [AC_DEFINE([WITH_PFA], [1], [with Page Frame Allocator])]) dnl Packages (disabled by default) @@ -244,7 +239,6 @@ dnl Packages (enabled by default) AS_IF([test "$with_arch_i386" = no], [AC_SUBST([comment_line_arch_i386], [//])]) AS_IF([test "$with_arch_riscv64" = no], [AC_SUBST([comment_line_arch_riscv64], [//])]) AS_IF([test "$with_arch_x86_64" = no], [AC_SUBST([comment_line_arch_x86_64], [//])]) -AS_IF([test "$with_mbr" = no], [AC_SUBST([comment_line_mbr], [//])]) AS_IF([test "$with_pfa" = no], [AC_SUBST([comment_line_pfa], [//])]) diff --git a/include/Makefile.am b/include/Makefile.am index a12d346..4fc7da9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -12,7 +12,6 @@ nobase_include_HEADERS = \ kernaux/macro.h \ kernaux/macro/packing_end.run \ kernaux/macro/packing_start.run \ - kernaux/mbr.h \ kernaux/pfa.h \ kernaux/runtime.h \ kernaux/version.h diff --git a/include/kernaux.h b/include/kernaux.h index fb32dd0..cbdc8d4 100644 --- a/include/kernaux.h +++ b/include/kernaux.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include diff --git a/include/kernaux/mbr.h b/include/kernaux/mbr.h deleted file mode 100644 index 4ffc15f..0000000 --- a/include/kernaux/mbr.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef KERNAUX_INCLUDED_MBR -#define KERNAUX_INCLUDED_MBR - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include -#include - -#define KERNAUX_MBR_SIZE 512 -#define KERNAUX_MBR_MAGIC 0xaa55 -#define KERNAUX_MBR_ENTRIES 4 - -#define KERNAUX_MBR_BOOTSTRAP_SIZE \ - (KERNAUX_MBR_SIZE - sizeof(struct KernAux_Mbr_Info)) - -#include - -struct KernAux_Mbr_Entry { - uint8_t drive_attributes; - unsigned first_sector_chs_addr : 24; - uint8_t partition_type; - unsigned last_sector_chs_addr : 24; - uint32_t first_sector_lba_addr; - uint32_t sectors_count; -} -KERNAUX_PACKED; - -KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Mbr_Entry, 16); - -struct KernAux_Mbr_Info { - uint32_t disk_id; - uint16_t reserved; - struct KernAux_Mbr_Entry entries[KERNAUX_MBR_ENTRIES]; - uint16_t magic; -} -KERNAUX_PACKED; - -KERNAUX_STATIC_TEST_STRUCT_SIZE( - KernAux_Mbr_Info, - 8 + KERNAUX_MBR_ENTRIES * sizeof(struct KernAux_Mbr_Entry) -); - -struct KernAux_Mbr { - uint8_t bootstrap[KERNAUX_MBR_BOOTSTRAP_SIZE]; - struct KernAux_Mbr_Info info; -} -KERNAUX_PACKED; - -KERNAUX_STATIC_TEST_STRUCT_SIZE( - KernAux_Mbr, - KERNAUX_MBR_BOOTSTRAP_SIZE + sizeof(struct KernAux_Mbr_Info) -); - -#include - -bool KernAux_Mbr_is_valid(const struct KernAux_Mbr *mbr); -bool KernAux_Mbr_Info_is_valid(const struct KernAux_Mbr_Info *mbr_info); -bool KernAux_Mbr_Entry_is_valid(const struct KernAux_Mbr_Entry *mbr_entry); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/kernaux/version.h.in b/include/kernaux/version.h.in index 373bb51..592f362 100644 --- a/include/kernaux/version.h.in +++ b/include/kernaux/version.h.in @@ -1,7 +1,6 @@ #ifndef KERNAUX_INCLUDED_VERSION #define KERNAUX_INCLUDED_VERSION -@comment_line_mbr@#define KERNAUX_VERSION_WITH_MBR @comment_line_pfa@#define KERNAUX_VERSION_WITH_PFA #endif diff --git a/pkgs/freebsd/devel/libkernaux/pkg-plist b/pkgs/freebsd/devel/libkernaux/pkg-plist index 4c5134d..c59d863 100644 --- a/pkgs/freebsd/devel/libkernaux/pkg-plist +++ b/pkgs/freebsd/devel/libkernaux/pkg-plist @@ -11,7 +11,6 @@ include/kernaux/asm/x86_64.h include/kernaux/macro.h include/kernaux/macro/packing_end.run include/kernaux/macro/packing_start.run -include/kernaux/mbr.h include/kernaux/pfa.h include/kernaux/runtime.h include/kernaux/version.h diff --git a/src/mbr.c b/src/mbr.c deleted file mode 100644 index c505117..0000000 --- a/src/mbr.c +++ /dev/null @@ -1,41 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "assert.h" - -#include - -#include -#include - -bool KernAux_Mbr_is_valid(const struct KernAux_Mbr *const mbr) -{ - KERNAUX_NOTNULL(mbr); - - return KernAux_Mbr_Info_is_valid(&mbr->info); -} - -bool KernAux_Mbr_Info_is_valid(const struct KernAux_Mbr_Info *const mbr_info) -{ - KERNAUX_NOTNULL(mbr_info); - - if (mbr_info->magic != KERNAUX_MBR_MAGIC) return false; - - for (size_t index = 0; index < KERNAUX_MBR_ENTRIES; ++index) { - if (!KernAux_Mbr_Entry_is_valid(&mbr_info->entries[index])) { - return false; - } - } - - return true; -} - -bool KernAux_Mbr_Entry_is_valid(const struct KernAux_Mbr_Entry *const mbr_entry) -{ - KERNAUX_NOTNULL(mbr_entry); - - // TODO: implement this - (void)mbr_entry; - return true; -} diff --git a/tests/.gitignore b/tests/.gitignore index f7f8dac..83eef67 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,4 +1,3 @@ /test_arch_i386 -/test_mbr /test_pfa /test_pfa_assert diff --git a/tests/Makefile.am b/tests/Makefile.am index e640e34..4865ac2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,18 +16,6 @@ test_arch_i386_SOURCES = \ test_arch_i386.c endif -############ -# test_mbr # -############ - -if WITH_MBR -TESTS += test_mbr -test_mbr_LDADD = $(top_builddir)/libkernaux.la -test_mbr_SOURCES = \ - main.c \ - test_mbr.c -endif - ############ # test_pfa # ############ diff --git a/tests/test_mbr.c b/tests/test_mbr.c deleted file mode 100644 index 5ff45b3..0000000 --- a/tests/test_mbr.c +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -static void create_valid_mbr(struct KernAux_Mbr *mbr); - -void test_main() -{ - struct KernAux_Mbr mbr; - - create_valid_mbr(&mbr); - - assert(KernAux_Mbr_is_valid(&mbr)); - assert(KernAux_Mbr_Info_is_valid(&mbr.info)); - for (size_t index = 0; index < KERNAUX_MBR_ENTRIES; ++index) { - assert(KernAux_Mbr_Entry_is_valid(&mbr.info.entries[index])); - } - - create_valid_mbr(&mbr); - mbr.info.magic = 123; - - assert(!KernAux_Mbr_is_valid(&mbr)); - assert(!KernAux_Mbr_Info_is_valid(&mbr.info)); - for (size_t index = 0; index < KERNAUX_MBR_ENTRIES; ++index) { - assert(KernAux_Mbr_Entry_is_valid(&mbr.info.entries[index])); - } - - // TODO: test partition table -} - -void create_valid_mbr(struct KernAux_Mbr *const mbr) -{ - memset(mbr, 0, sizeof(*mbr)); - - mbr->info.magic = KERNAUX_MBR_MAGIC; - mbr->info.disk_id = 0xCAFEBABE; - // TODO: fill partition table -}