Line data Source code
1 0 : /*
2 : * Copyright (c) 2023 Antmicro <www.antmicro.com>
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_FS_EXT2_H_
8 : #define ZEPHYR_INCLUDE_FS_EXT2_H_
9 :
10 : #include <stdint.h>
11 :
12 : /** @brief Configuration used to format ext2 file system.
13 : *
14 : * If a field is set to 0 then default value is used.
15 : * (In volume name the first cell of an array must be 0 to use default value.)
16 : *
17 : * @param block_size Requested size of block.
18 : * @param fs_size Requested size of file system. If 0 then whole available memory is used.
19 : * @param bytes_per_inode Requested memory for one inode. It is used to calculate number of inodes
20 : * in created file system.
21 : * @param uuid UUID for created file system. Used when set_uuid is true.
22 : * @param volume_name Name for created file system.
23 : * @param set_uuid If true then UUID from that structure is used in created file system.
24 : * If false then UUID (ver4) is generated.
25 : */
26 1 : struct ext2_cfg {
27 0 : uint32_t block_size;
28 0 : uint32_t fs_size; /* Number of blocks that we want to take. */
29 0 : uint32_t bytes_per_inode;
30 0 : uint8_t uuid[16];
31 0 : uint8_t volume_name[17]; /* If first byte is 0 then name ext2" is given. */
32 0 : bool set_uuid;
33 : };
34 :
35 0 : #define FS_EXT2_DECLARE_DEFAULT_CONFIG(name) \
36 : static struct ext2_cfg name = { \
37 : .block_size = 1024, \
38 : .fs_size = 0x800000, \
39 : .bytes_per_inode = 4096, \
40 : .volume_name = {'e', 'x', 't', '2', '\0'}, \
41 : .set_uuid = false, \
42 : }
43 :
44 :
45 : #endif /* ZEPHYR_INCLUDE_FS_EXT2_H_ */
|