rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/19] Rust abstractions for VFS
@ 2023-10-18 12:24 Wedson Almeida Filho
  2023-10-18 12:25 ` [RFC PATCH 01/19] rust: fs: add registration/unregistration of file systems Wedson Almeida Filho
                   ` (20 more replies)
  0 siblings, 21 replies; 125+ messages in thread
From: Wedson Almeida Filho @ 2023-10-18 12:24 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Matthew Wilcox
  Cc: Kent Overstreet, Greg Kroah-Hartman, linux-fsdevel,
	rust-for-linux, Wedson Almeida Filho

From: Wedson Almeida Filho <walmeida@microsoft.com>

This series introduces Rust abstractions that allow page-cache-backed read-only
file systems to be written in Rust.

There are two file systems that are built on top of these abstractions: tarfs
and puzzlefs. The former has zero unsafe blocks and is included as a patch in
this series; the latter is described elsewhere [1]. We limit the functionality
to the bare minimum needed to implement them.

Rust file system modules can be declared with the `module_fs` macro and are
required to implement the following functions (which are part of the
`FileSystem` trait):

impl FileSystem for MyFS {
    fn super_params(sb: &NewSuperBlock<Self>) -> Result<SuperParams<Self::Data>>;
    fn init_root(sb: &SuperBlock<Self>) -> Result<ARef<INode<Self>>>;
    fn read_dir(inode: &INode<Self>, emitter: &mut DirEmitter) -> Result;
    fn lookup(parent: &INode<Self>, name: &[u8]) -> Result<ARef<INode<Self>>>;
    fn read_folio(inode: &INode<Self>, folio: LockedFolio<'_>) -> Result;
}

They can optionally implement the following:

fn read_xattr(inode: &INode<Self>, name: &CStr, outbuf: &mut [u8]) -> Result<usize>;
fn statfs(sb: &SuperBlock<Self>) -> Result<Stat>;

They may also choose the type of the data they can attach to superblocks and/or
inodes.

There a couple of issues that are likely to lead to unsoundness that have to do
with the unregistration of file systems. I will send separate emails about
them.

A git tree is available here:
    git://github.com/wedsonaf/linux.git vfs

Web:
    https://github.com/wedsonaf/linux/commits/vfs

[1]: The PuzzleFS container filesystem: https://lwn.net/Articles/945320/

Wedson Almeida Filho (19):
  rust: fs: add registration/unregistration of file systems
  rust: fs: introduce the `module_fs` macro
  samples: rust: add initial ro file system sample
  rust: fs: introduce `FileSystem::super_params`
  rust: fs: introduce `INode<T>`
  rust: fs: introduce `FileSystem::init_root`
  rust: fs: introduce `FileSystem::read_dir`
  rust: fs: introduce `FileSystem::lookup`
  rust: folio: introduce basic support for folios
  rust: fs: introduce `FileSystem::read_folio`
  rust: fs: introduce `FileSystem::read_xattr`
  rust: fs: introduce `FileSystem::statfs`
  rust: fs: introduce more inode types
  rust: fs: add per-superblock data
  rust: fs: add basic support for fs buffer heads
  rust: fs: allow file systems backed by a block device
  rust: fs: allow per-inode data
  rust: fs: export file type from mode constants
  tarfs: introduce tar fs

 fs/Kconfig                        |    1 +
 fs/Makefile                       |    1 +
 fs/tarfs/Kconfig                  |   16 +
 fs/tarfs/Makefile                 |    8 +
 fs/tarfs/defs.rs                  |   80 ++
 fs/tarfs/tar.rs                   |  322 +++++++
 rust/bindings/bindings_helper.h   |   13 +
 rust/bindings/lib.rs              |    6 +
 rust/helpers.c                    |  142 ++++
 rust/kernel/error.rs              |    6 +-
 rust/kernel/folio.rs              |  214 +++++
 rust/kernel/fs.rs                 | 1290 +++++++++++++++++++++++++++++
 rust/kernel/fs/buffer.rs          |   60 ++
 rust/kernel/lib.rs                |    2 +
 rust/kernel/mem_cache.rs          |    2 -
 samples/rust/Kconfig              |   10 +
 samples/rust/Makefile             |    1 +
 samples/rust/rust_rofs.rs         |  154 ++++
 scripts/generate_rust_analyzer.py |    2 +-
 19 files changed, 2324 insertions(+), 6 deletions(-)
 create mode 100644 fs/tarfs/Kconfig
 create mode 100644 fs/tarfs/Makefile
 create mode 100644 fs/tarfs/defs.rs
 create mode 100644 fs/tarfs/tar.rs
 create mode 100644 rust/kernel/folio.rs
 create mode 100644 rust/kernel/fs.rs
 create mode 100644 rust/kernel/fs/buffer.rs
 create mode 100644 samples/rust/rust_rofs.rs


base-commit: b0bc357ef7a98904600826dea3de79c0c67eb0a7
-- 
2.34.1


^ permalink raw reply	[flat|nested] 125+ messages in thread

end of thread, other threads:[~2024-01-25  9:16 UTC | newest]

Thread overview: 125+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 12:24 [RFC PATCH 00/19] Rust abstractions for VFS Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 01/19] rust: fs: add registration/unregistration of file systems Wedson Almeida Filho
2023-10-18 15:38   ` Benno Lossin
2024-01-10 18:32     ` Wedson Almeida Filho
2024-01-25  9:15       ` Benno Lossin
2023-10-18 12:25 ` [RFC PATCH 02/19] rust: fs: introduce the `module_fs` macro Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 03/19] samples: rust: add initial ro file system sample Wedson Almeida Filho
2023-10-28 16:18   ` Alice Ryhl
2024-01-10 18:25     ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 04/19] rust: fs: introduce `FileSystem::super_params` Wedson Almeida Filho
2023-10-18 16:34   ` Benno Lossin
2023-10-28 16:39     ` Alice Ryhl
2023-10-30  8:21       ` Benno Lossin
2023-10-30 21:36         ` Alice Ryhl
2023-10-20 15:04   ` Ariel Miculas (amiculas)
2024-01-03 12:25   ` Andreas Hindborg (Samsung)
2023-10-18 12:25 ` [RFC PATCH 05/19] rust: fs: introduce `INode<T>` Wedson Almeida Filho
2023-10-28 18:00   ` Alice Ryhl
2024-01-03 12:45     ` Andreas Hindborg (Samsung)
2024-01-03 12:54   ` Andreas Hindborg (Samsung)
2024-01-04  5:20     ` Darrick J. Wong
2024-01-04  9:57       ` Andreas Hindborg (Samsung)
2024-01-10  9:45     ` Benno Lossin
2024-01-04  5:14   ` Darrick J. Wong
2024-01-24 18:17     ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 06/19] rust: fs: introduce `FileSystem::init_root` Wedson Almeida Filho
2023-10-19 14:30   ` Benno Lossin
2023-10-20  0:52     ` Boqun Feng
2023-10-21 13:48       ` Benno Lossin
2023-10-21 15:57         ` Boqun Feng
2023-10-21 17:01           ` Matthew Wilcox
2023-10-21 19:33             ` Boqun Feng
2023-10-23  5:29               ` Dave Chinner
2023-10-23 12:55                 ` Wedson Almeida Filho
2023-10-30  2:29                   ` Dave Chinner
2023-10-31 20:49                     ` Wedson Almeida Filho
2023-11-08  4:54                       ` Dave Chinner
2023-11-08  6:15                         ` Wedson Almeida Filho
2023-10-20  0:30   ` Boqun Feng
2023-10-23 12:36     ` Wedson Almeida Filho
2024-01-03 13:29   ` Andreas Hindborg (Samsung)
2024-01-24  4:07     ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 07/19] rust: fs: introduce `FileSystem::read_dir` Wedson Almeida Filho
2023-10-21  8:33   ` Benno Lossin
2024-01-03 14:09   ` Andreas Hindborg (Samsung)
2024-01-21 21:00   ` Askar Safin
2024-01-21 21:51     ` Dave Chinner
2023-10-18 12:25 ` [RFC PATCH 08/19] rust: fs: introduce `FileSystem::lookup` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 09/19] rust: folio: introduce basic support for folios Wedson Almeida Filho
2023-10-18 17:17   ` Matthew Wilcox
2023-10-18 18:32     ` Wedson Almeida Filho
2023-10-18 19:21       ` Matthew Wilcox
2023-10-19 13:25         ` Wedson Almeida Filho
2023-10-20  4:11           ` Matthew Wilcox
2023-10-20 15:17             ` Matthew Wilcox
2023-10-23 12:32               ` Wedson Almeida Filho
2023-10-23 10:48             ` Andreas Hindborg (Samsung)
2023-10-23 14:28               ` Matthew Wilcox
2023-10-24 15:04                 ` Ariel Miculas (amiculas)
2023-10-23 12:29             ` Wedson Almeida Filho
2023-10-21  9:21   ` Benno Lossin
2023-10-18 12:25 ` [RFC PATCH 10/19] rust: fs: introduce `FileSystem::read_folio` Wedson Almeida Filho
2023-11-07 22:18   ` Matthew Wilcox
2023-11-07 22:22     ` Al Viro
2023-11-08  0:35       ` Wedson Almeida Filho
2023-11-08  0:56         ` Al Viro
2023-11-08  2:39           ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 11/19] rust: fs: introduce `FileSystem::read_xattr` Wedson Almeida Filho
2023-10-18 13:06   ` Ariel Miculas (amiculas)
2023-10-19 13:35     ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 12/19] rust: fs: introduce `FileSystem::statfs` Wedson Almeida Filho
2024-01-03 14:13   ` Andreas Hindborg (Samsung)
2024-01-04  5:33   ` Darrick J. Wong
2024-01-24  4:24     ` Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 13/19] rust: fs: introduce more inode types Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 14/19] rust: fs: add per-superblock data Wedson Almeida Filho
2023-10-25 15:51   ` Ariel Miculas (amiculas)
2023-10-26 13:46   ` Ariel Miculas (amiculas)
2024-01-03 14:16   ` Andreas Hindborg (Samsung)
2023-10-18 12:25 ` [RFC PATCH 15/19] rust: fs: add basic support for fs buffer heads Wedson Almeida Filho
2024-01-03 14:17   ` Andreas Hindborg (Samsung)
2023-10-18 12:25 ` [RFC PATCH 16/19] rust: fs: allow file systems backed by a block device Wedson Almeida Filho
2023-10-21 13:39   ` Benno Lossin
2024-01-24  4:14     ` Wedson Almeida Filho
2024-01-03 14:38   ` Andreas Hindborg (Samsung)
2023-10-18 12:25 ` [RFC PATCH 17/19] rust: fs: allow per-inode data Wedson Almeida Filho
2023-10-21 13:57   ` Benno Lossin
2024-01-03 14:39   ` Andreas Hindborg (Samsung)
2023-10-18 12:25 ` [RFC PATCH 18/19] rust: fs: export file type from mode constants Wedson Almeida Filho
2023-10-18 12:25 ` [RFC PATCH 19/19] tarfs: introduce tar fs Wedson Almeida Filho
2023-10-18 16:57   ` Matthew Wilcox
2023-10-18 17:05     ` Wedson Almeida Filho
2023-10-18 17:20       ` Matthew Wilcox
2023-10-18 18:07         ` Wedson Almeida Filho
2024-01-24  5:05   ` Matthew Wilcox
2024-01-24  5:23     ` Matthew Wilcox
2024-01-24 18:26       ` Wedson Almeida Filho
2024-01-24 21:05         ` Dave Chinner
2024-01-24 21:28           ` Matthew Wilcox
2024-01-24  5:34     ` Gao Xiang
2023-10-18 13:40 ` [RFC PATCH 00/19] Rust abstractions for VFS Ariel Miculas (amiculas)
2023-10-18 17:12   ` Wedson Almeida Filho
2023-10-29 20:31 ` Matthew Wilcox
2023-10-31 20:14   ` Wedson Almeida Filho
2024-01-03 18:02     ` Matthew Wilcox
2024-01-03 19:04       ` Wedson Almeida Filho
2024-01-03 19:53         ` Al Viro
2024-01-03 20:38           ` Kent Overstreet
2024-01-04  1:49         ` Matthew Wilcox
2024-01-09 18:25           ` Wedson Almeida Filho
2024-01-09 19:30             ` Matthew Wilcox
2024-01-03 19:14       ` Kent Overstreet
2024-01-03 20:41         ` Al Viro
2024-01-09 19:13           ` Wedson Almeida Filho
2024-01-09 19:25             ` Matthew Wilcox
2024-01-09 19:32               ` Greg Kroah-Hartman
2024-01-10  7:49                 ` Wedson Almeida Filho
2024-01-10  7:57                   ` Greg Kroah-Hartman
2024-01-10 12:56                   ` Matthew Wilcox
2024-01-09 22:19               ` Dave Chinner
2024-01-10 19:19                 ` Kent Overstreet
2024-01-24 13:08                   ` FUJITA Tomonori
2024-01-24 19:49                     ` Kent Overstreet
2024-01-05  0:04       ` David Howells
2024-01-05 15:54         ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).