-
Notifications
You must be signed in to change notification settings - Fork 8.1k
subsys: fs: Implementation of ext2 file system #55152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9a7610c
fs: ext2: Implementation of basic operations
fzdobylak 5d03d8e
tests: fs: ext2: Mount tests
fzdobylak 8192ee0
fs: ext2: create dir and file operations
fzdobylak 2082cdf
tests: fs: ext2: create file and directory tests
fzdobylak 3b23e0f
tests: fs: Make mount flags test common
fzdobylak 5d6cd72
tests: fs: ext2: Mount flags test
fzdobylak de2590a
fs: ext2: implement fs_stat
fzdobylak 2b94817
tests: fs: ext2: use fs_stat in directory tests
fzdobylak 5346445
fs: ext2: File operations
fzdobylak 9667060
fs: ext2: implement fs_truncate
fzdobylak 8448152
fs: ext2: implement unlink
fzdobylak fb031d1
tests: fs: Move testfs_utils to common directory
fzdobylak e235ced
tests: fs: ext2: Open flags test
fzdobylak 9b1bb0c
fs: ext2: implement rename
fzdobylak 36ce48d
fs: ext2: implement rest of directory operations
fzdobylak 76c20b5
tests: fs: Make common dirops test
fzdobylak 0f132bd
tests: fs: ext2: Add dirops test
fzdobylak a847de5
fs: ext2: impl fs_sync
fzdobylak 16efff0
tests: fs: Make common fs_basic test
fzdobylak 96245e0
tests: fs: ext2: Add basic fs test
fzdobylak 2ff1bec
fs: ext2: create correct file system in mkfs
fzdobylak 40aeca0
tests: fs: ext2: fix after changes in mkfs
fzdobylak c447aef
fs: ext2: fix blocks and inodes handling
fzdobylak 856ac75
tests: fs: ext2: Add ext specific tests
fzdobylak 45e54cf
fs: ext2: Interpret s_errors field in superblocks
fzdobylak 9790185
fs: ext2: Update memory writes
fzdobylak aaa6bc4
samples: subsys: fs: create common fs sample
fzdobylak 24f0112
fs: ext2: update how memory is allocated in ext2
fzdobylak e95373f
fs: ext2: Use disk structs to access data on disk
fzdobylak 5d93403
doc: release: 3.5: Add notes about ext2 fs
fzdobylak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2023 Antmicro <www.antmicro.com> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_FS_EXT2_H_ | ||
#define ZEPHYR_INCLUDE_FS_EXT2_H_ | ||
|
||
#include <stdint.h> | ||
|
||
/** @brief Configuration used to format ext2 file system. | ||
* | ||
* If a field is set to 0 then default value is used. | ||
* (In volume name the first cell of an array must be 0 to use default value.) | ||
* | ||
* @param block_size Requested size of block. | ||
* @param fs_size Requested size of file system. If 0 then whole available memory is used. | ||
* @param bytes_per_inode Requested memory for one inode. It is used to calculate number of inodes | ||
* in created file system. | ||
* @param uuid UUID for created file system. Used when set_uuid is true. | ||
* @param volume_name Name for created file system. | ||
* @param set_uuid If true then UUID from that structure is used in created file system. | ||
* If false then UUID (ver4) is generated. | ||
*/ | ||
struct ext2_cfg { | ||
uint32_t block_size; | ||
uint32_t fs_size; /* Number of blocks that we want to take. */ | ||
uint32_t bytes_per_inode; | ||
uint8_t uuid[16]; | ||
uint8_t volume_name[17]; /* If first byte is 0 then name ext2" is given. */ | ||
bool set_uuid; | ||
}; | ||
|
||
#define FS_EXT2_DECLARE_DEFAULT_CONFIG(name) \ | ||
static struct ext2_cfg name = { \ | ||
.block_size = 1024, \ | ||
.fs_size = 0x800000, \ | ||
.bytes_per_inode = 4096, \ | ||
.volume_name = {'e', 'x', 't', '2', '\0'}, \ | ||
.set_uuid = false, \ | ||
} | ||
|
||
|
||
#endif /* ZEPHYR_INCLUDE_FS_EXT2_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
9 changes: 5 additions & 4 deletions
9
samples/subsys/fs/fat_fs/Kconfig → samples/subsys/fs/fs_sample/Kconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
# | ||
# Copyright (c) 2023 Nordic Semiconductor ASA | ||
# Copyright (c) 2023 Antmicro <www.antmicro.com> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
mainmenu "FAT Filesystem Sample Application" | ||
mainmenu "Filesystems Sample Application" | ||
|
||
config SAMPLE_FATFS_CREATE_SOME_ENTRIES | ||
config FS_SAMPLE_CREATE_SOME_ENTRIES | ||
bool "When no files are found on mounted partition create some" | ||
default y | ||
help | ||
In case when no files could be listed, because there are none, | ||
"some.dir" directory and "other.txt" file will be created | ||
and list will run again to show them. This is useful when | ||
showing how FAT works on non-SD devices like internal flash | ||
or (Q)SPI connected memories, where it is not possible to | ||
showing how file system works on non-SD devices like internal | ||
flash or (Q)SPI connected memories, where it is not possible to | ||
easily add files with use of other device. | ||
|
||
source "Kconfig.zephyr" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
samples/subsys/fs/fs_sample/boards/hifive_unmatched.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2023 Antmicro | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&spi2 { | ||
status = "okay"; | ||
|
||
sdhc0: sdhc@0 { | ||
compatible = "zephyr,sdhc-spi-slot"; | ||
reg = <0>; | ||
status = "okay"; | ||
mmc { | ||
compatible = "zephyr,sdmmc-disk"; | ||
status = "okay"; | ||
}; | ||
spi-max-frequency = <20000000>; | ||
}; | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2023 Antmicro <www.antmicro.com> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_LOG=y | ||
CONFIG_LOG_MODE_IMMEDIATE=y | ||
|
||
CONFIG_MAIN_STACK_SIZE=2048 | ||
|
||
CONFIG_FILE_SYSTEM=y | ||
CONFIG_FILE_SYSTEM_EXT2=y | ||
|
||
# Enable to allow formatting | ||
# CONFIG_FILE_SYSTEM_MKFS=y | ||
# CONFIG_TEST_RANDOM_GENERATOR=y | ||
|
||
CONFIG_DISK_ACCESS=y | ||
CONFIG_DISK_DRIVER_SDMMC=y | ||
|
||
# First block of first partition after GPT | ||
CONFIG_EXT2_DISK_STARTING_SECTOR=2082 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.