Commit 056bd2a
committed
Ensure superblock always fits SIMPLEFS_BLOCK_SIZE
In current implementation, the struct superblock used padding via
subtraction to match the SIMPLEFS_BLOCK_SIZE, which could lead
to the need for recalculating the padding when the data structure
changed.
This commit introduces a union that allocates the largest size among
its members to set the struct superblock size, ensuring that it is at
least SIMPLEFS_BLOCK_SIZE. Additionally, it utilizes the
_Static_assert keyword to verify whether the size matches
SIMPLEFS_BLOCK_SIZE.1 parent a59b479 commit 056bd2a
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
0 commit comments