-
Notifications
You must be signed in to change notification settings - Fork 430
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
vfs abstractions and tarfs #1037
base: rust-next
Are you sure you want to change the base?
Commits on Oct 18, 2023
-
xattr: make the xattr array itself const
As it is currently declared, the xattr_handler structs are const but the array containing their pointers is not. This patch makes it so that fs modules can place them in .rodata, which makes it harder for accidental/malicious modifications at runtime. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a3fe8d8 - Browse repository at this point
Copy the full SHA a3fe8d8View commit details -
This allows modules to be initialised in-place in pinned memory, which enables the usage of pinned types (e.g., mutexes, spinlocks, driver registrations, etc.) in modules without any extra allocations. Drivers that don't need this may continue to implement `Module` without any changes. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 484ec70 - Browse repository at this point
Copy the full SHA 484ec70View commit details -
samples: rust: add in-place initialisation sample
This is a modified version of rust_minimal that is initialised in-place. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for da1a2b6 - Browse repository at this point
Copy the full SHA da1a2b6View commit details -
rust: add the
container_of
macroThis is the Rust version of the macro with the same name in C. It produces a raw pointer to an outer type from a pointer to an inner field. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 883e433 - Browse repository at this point
Copy the full SHA 883e433View commit details -
rust: init: introduce
Opaque::try_ffi_init
We'll need it, for example, when calling `register_filesystem` to initialise a file system registration. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 14513c0 - Browse repository at this point
Copy the full SHA 14513c0View commit details -
rust: time: introduce
time
moduleIt only contains the bare minimum to implement inode timestamps. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c7d0fb2 - Browse repository at this point
Copy the full SHA c7d0fb2View commit details -
rust: types: add little-endian type
It allows us to read/write data in little-endian format. Compared to just using the correctly-sized integer type, it has the advantage of forcing users to convert to and from little endian format (which will be no-ops in little-endian architectures). Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ca4a93c - Browse repository at this point
Copy the full SHA ca4a93cView commit details -
rust: types: introduce
FromBytes
traitIf a type `T` implements this trait, it's possible to safely get a shared reference to a `T` from a byte slice. This commit also provides a macro that allows the automatic derivation of `FromBytes` for simple structs whose fields all implement `FromBytes` as well. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a44bdcc - Browse repository at this point
Copy the full SHA a44bdccView commit details -
rust: mem_cache: introduce
MemCache
This is just the basics of `kmem_cache` to be used in file systems for inodes. All dead-code annotations will be removed in the next commit. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for caf9b29 - Browse repository at this point
Copy the full SHA caf9b29View commit details -
kbuild: rust: allow modules to allocate memory
The `allocator_api` feature is needed by drivers that allocate memory. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b0bc357 - Browse repository at this point
Copy the full SHA b0bc357View commit details -
rust: fs: add registration/unregistration of file systems
Allow basic registration and unregistration of Rust file system types. Unregistration happens automatically when a registration variable is dropped (e.g., when it goes out of scope). File systems registered this way are visible in `/proc/filesystems` but cannot be mounted yet because `init_fs_context` fails. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 528babd - Browse repository at this point
Copy the full SHA 528babdView commit details -
rust: fs: introduce the
module_fs
macroSimplify the declaration of modules that only expose a file system type. They can now do it using the `module_fs` macro. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e909f43 - Browse repository at this point
Copy the full SHA e909f43View commit details -
samples: rust: add initial ro file system sample
Introduce a basic sample that for now only registers the file system and doesn't really provide any functionality beyond having it listed in `/proc/filesystems`. New functionality will be added to the sample in subsequent patches as their abstractions are introduced. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ad07f4b - Browse repository at this point
Copy the full SHA ad07f4bView commit details -
rust: fs: introduce
FileSystem::super_params
Allow Rust file systems to initialise superblocks, which allows them to be mounted (though they are still empty). Some scaffolding code is added to create an empty directory as the root. It is replaced by proper inode creation in a subsequent patch in this series. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 626056a - Browse repository at this point
Copy the full SHA 626056aView commit details -
Allow Rust file systems to handle typed and ref-counted inodes. This is in preparation for creating new inodes (for example, to create the root inode of a new superblock), which comes in the next patch in the series. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a448dc5 - Browse repository at this point
Copy the full SHA a448dc5View commit details -
rust: fs: introduce
FileSystem::init_root
Allow Rust file systems to specify their root directory. Also allow them to create (and do cache lookups of) directory inodes. (More types of inodes are added in subsequent patches in the series.) The `NewINode` type ensures that a new inode is properly initialised before it is marked so. It also facilitates error paths by automatically marking inodes as failed if they're not properly initialised. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b26f77a - Browse repository at this point
Copy the full SHA b26f77aView commit details -
rust: fs: introduce
FileSystem::read_dir
Allow Rust file systems to report the contents of their directory inodes. The reported entries cannot be opened yet. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ac0f637 - Browse repository at this point
Copy the full SHA ac0f637View commit details -
rust: fs: introduce
FileSystem::lookup
Allow Rust file systems to create inodes that are children of a directory inode when they're looked up by name. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 14b32d0 - Browse repository at this point
Copy the full SHA 14b32d0View commit details -
rust: folio: introduce basic support for folios
Allow Rust file systems to handle ref-counted folios. Provide the minimum needed to implement `read_folio` (part of `struct address_space_operations`) in read-only file systems and to read uncached blocks. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5e601b9 - Browse repository at this point
Copy the full SHA 5e601b9View commit details -
rust: fs: introduce
FileSystem::read_folio
Allow Rust file systems to create regular file inodes backed by the page cache. The contents of such files are read into folios via `read_folio`. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c02d2b9 - Browse repository at this point
Copy the full SHA c02d2b9View commit details -
rust: fs: introduce
FileSystem::read_xattr
Allow Rust file systems to expose xattrs associated with inodes. `overlayfs` uses an xattr to indicate that a directory is opaque (i.e., that lower layers should not be looked up). The planned file systems need to support opaque directories, so they must be able to implement this. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ce0acb6 - Browse repository at this point
Copy the full SHA ce0acb6View commit details -
rust: fs: introduce
FileSystem::statfs
Allow Rust file systems to expose their stats. `overlayfs` requires that this be implemented by all file systems that are part of an overlay. The planned file systems need to be overlayed with overlayfs, so they must be able to implement this. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3f94966 - Browse repository at this point
Copy the full SHA 3f94966View commit details -
rust: fs: introduce more inode types
Allow Rust file system modules to create inodes that are symlinks, pipes, sockets, char devices and block devices (in addition to the already-supported directories and regular files). Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6032d93 - Browse repository at this point
Copy the full SHA 6032d93View commit details -
rust: fs: add per-superblock data
Allow Rust file systems to associate [typed] data to super blocks when they're created. Since we only have a pointer-sized field in which to store the state, it must implement the `ForeignOwnable` trait. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1cf6e5e - Browse repository at this point
Copy the full SHA 1cf6e5eView commit details -
rust: fs: add basic support for fs buffer heads
Introduce the abstractions that will be used by modules to handle buffer heads, which will be used to access cached blocks from block devices. All dead-code annotations are removed in the next commit in the series. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 516d0e4 - Browse repository at this point
Copy the full SHA 516d0e4View commit details -
rust: fs: allow file systems backed by a block device
Allow Rust file systems that are backed by block devices (in addition to in-memory ones). Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0605dba - Browse repository at this point
Copy the full SHA 0605dbaView commit details -
rust: fs: allow per-inode data
Allow Rust file systems to attach extra [typed] data to each inode. If no data is needed, use the regular inode kmem_cache, otherwise we create a new one. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b40e37b - Browse repository at this point
Copy the full SHA b40e37bView commit details -
rust: fs: export file type from mode constants
Allow Rust file system modules to use these constants if needed. Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 80fda66 - Browse repository at this point
Copy the full SHA 80fda66View commit details -
It is a file system based on tar files and an index appended to them (to facilitate finding fs entries without having to traverse the whole tar file). Signed-off-by: Wedson Almeida Filho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7189177 - Browse repository at this point
Copy the full SHA 7189177View commit details