1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{caption}
\titleformat{\section}{\normalfont\Large\bfseries}{\thesection}{1em}{}
\definecolor{codegray}{gray}{0.95}
\lstset{
backgroundcolor=\color{codegray},
basicstyle=\ttfamily\small,
breaklines=true,
frame=single,
tabsize=4,
language=C++,
showstringspaces=false
}
\title{Embedded File System (EMBFS) Specification}
\author{Amlal El Mahrouss}
\date{\today}
\begin{document}
\maketitle
\section{Overview}
The \textbf{Embedded File System (EMBFS)} is a compact and minimal filesystem designed for use in embedded environments with limited storage media. This specification describes its key data structures, constants, and layout.
\section{Namespace}
The EMBFS implementation resides under:
\begin{lstlisting}
namespace ocl::embfs
\end{lstlisting}
\section{Supported Logical Block Addressing (LBA) Modes}
Two LBA addressing modes are supported via macro definitions:
\begin{itemize}
\item \texttt{EMBFS\_28BIT\_LBA} — Uses \texttt{uint32\_t}.
\item \texttt{EMBFS\_48BIT\_LBA} — Uses \texttt{uint64\_t}.
\end{itemize}
\section{Fundamental Types}
\begin{longtable}{|l|l|}
\hline
\textbf{Type} & \textbf{Definition} \\
\hline
\texttt{lba\_t} & 28-bit or 48-bit logical block address \\
\texttt{sword\_t} & \texttt{int16\_t} \\
\texttt{sdword\_t} & \texttt{int32\_t} \\
\texttt{utf8\_char\_t} & \texttt{uint8\_t}, used for file names and labels \\
\hline
\end{longtable}
\section{Constants}
\begin{longtable}{|l|l|}
\hline
\textbf{Constant} & \textbf{Description} \\
\hline
\texttt{\_superblock\_name\_len} & Length of superblock name (16 bytes) \\
\texttt{\_superblock\_reserve\_len} & Reserved bytes in superblock (462 bytes) \\
\texttt{\_inode\_name\_len} & Length of inode file name (128 bytes) \\
\texttt{\_inode\_arr\_len} & Number of inodes per partition (12) \\
\texttt{\_inode\_lookup\_len} & Number of direct LBA pointers in inode (8) \\
\hline
\end{longtable}
\section{Superblock Structure}
\textbf{Structure:} \texttt{embfs\_superblock}
\begin{lstlisting}
struct embfs_superblock {
sword_t s_block_mag;
sdword_t s_num_inodes;
sdword_t s_part_size;
sdword_t s_part_used;
sdword_t s_version;
sword_t s_sector_sz;
lba_t s_inode_start;
lba_t s_inode_end;
utf8_char_t s_name[16];
utf8_char_t s_reserved[462];
};
\end{lstlisting}
\textbf{Description:}
\begin{itemize}
\item \texttt{s\_block\_mag} — Magic number identifying the filesystem
\item \texttt{s\_num\_inodes} — Total number of inodes
\item \texttt{s\_part\_size} — Total size of the partition (in sectors)
\item \texttt{s\_part\_used} — Used size of the partition
\item \texttt{s\_version} — Filesystem version
\item \texttt{s\_sector\_sz} — Sector size (in bytes)
\item \texttt{s\_inode\_start}, \texttt{s\_inode\_end} — LBA range where inodes are stored
\item \texttt{s\_name} — Filesystem label
\item \texttt{s\_reserved} — Reserved for future use
\end{itemize}
\section{Inode Structure}
\textbf{Structure:} \texttt{embfs\_inode}
\begin{lstlisting}
struct embfs_inode {
utf8_char_t i_name[128];
sword_t i_size_virt, i_size_phys;
lba_t i_offset[8];
sword_t i_checksum, i_flags_perms;
lba_t i_acl_creat, i_acl_edit, i_acl_delet;
};
\end{lstlisting}
\textbf{Description:}
\begin{itemize}
\item \texttt{i\_name} — UTF-8 encoded file name
\item \texttt{i\_size\_virt} — Virtual file size (logical size)
\item \texttt{i\_size\_phys} — Physical size in sectors
\item \texttt{i\_offset} — Array of direct LBA pointers
\item \texttt{i\_checksum} — CRC32 checksum of file contents
\item \texttt{i\_flags\_perms} — Flags and permissions field
\item \texttt{i\_acl\_creat}, \texttt{i\_acl\_edit}, \texttt{i\_acl\_delet} — ACLs for access control
\end{itemize}
\section{Inode Array Type}
\begin{lstlisting}
typedef embfs_inode embfs_inode_arr_t[12];
\end{lstlisting}
Represents a fixed-size array of 12 inodes within a given partition.
\section{License}
\begin{itemize}
\item Copyright © 2025 Amlal El Mahrouss
\item All rights reserved.
\item For questions or licensing requests, contact: \texttt{amlal@nekernel.org}
\end{itemize}
\end{document}
|