| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
|
|
|
| |
This allows file system contexts to be further initialised with
parameters from userspace before a fs is mounted or reconfigured.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
| |
Also make fs mountable, but empty for now.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
| |
This is in preparation for adding support for the implementation of file
systems in Rust.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
| |
This is a primitive widely used on the C side. We'll need it for Binder
and to implement the workqueue-based executor.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
|
| |
Make the file a bit more `checkpatch.pl`-clean by fixing
a couple style issues and replace bad indentation (spaces).
Furthermore, re-sort the `#include`s too and prefer `linux/`
to `asm/`.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
|
|
|
| |
This allows us to write async tcp socket code similar to what we have in
userspace.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
|
| |
This is needed when code sections cannot sleep even in real-time
variants of the kernel. For example, when a callback is called with a
raw spinlock held, the callee cannot use mutexes or spinlocks, they must
use a raw spinlock as well. (This happens in gpio; pl061 will be updated
to use a raw spinlock.)
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
rust: convert `File` to use `ARef`
|
| |
| |
| |
| |
| |
| | |
This is to unify the usage of all ref-counted C structures.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|/
|
|
|
|
| |
This allows us to add network packet filters written in Rust.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
| |
This adds basic abstractions for network namespaces, devices and
buffers.
This is in preparation for adding support for netfilters.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
rust: add a simple Rust mutex implementation
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It doesn't have to be pinned, so its ergonomics are much better than the
one based on the C version. In particular, it doesn't require users to
use any unsafe code.
This is a temporary solution for users can live with the simpler
implementation while we don't have a better way of dealing with pinning.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|/
|
|
|
|
|
|
| |
This patch adds only runtime-checked bindings version of
`memcpy_fromio()` function prefixed with `try_` similarly
to read/write methods of `IoMem<T>` that is `readx` and `try_readx`.
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
|
|
|
|
| |
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
| |
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
|
|
|
|
| |
Also copy the same `EXPORT_SYMBOL_GPL` explanation to `exports.c`.
This also sums up the discussion at https://github.com/Rust-for-Linux/linux/pull/637 about exporting or not the helpers that are not technically required at the moment (thanks @bjorn3 for the note about `rustc` not guaranteeing codegen for non-inline functions).
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
|
|
| |
Export them so that they can be used by modules.
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
|
|
|
|
|
|
|
|
| |
A platform driver is now defined by implementing a trait, very much like
`amba`. There is also a module macro used that can used if a module is
just a platform driver. Lastly, drivers can specify additional data with
each supported id (to be passed back to them on `probe`).
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
rust: iomem: add readx/writex relaxed family of functions
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch adds a set of functions for the `IoMem<T>` type
by reusing existing macros used for generating read/write
methods for that type. The handling of arch-specific cross-compilation
is done entirely on the C's side.
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds initial abstractions including:
- `Clk` wrapper around `struct clk *`.
- Binding of clk_get() method implemented
as a method of `device::RawDevice` trait.
- `EnableClk` that is an invariant of
the `Clk` type that manages usage of
the disable_unprepare() function.
- Routines get_rate() and prepare_enable()
implemented as methods of `Clk` type.
Signed-off-by: Maciej Falkowski <m.falkowski@samsung.com>
|
|
|
|
|
|
| |
We need this in binder for the new security callbacks.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
| |
This is used by the PL061 driver.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
| |
This allows drivers to register with the GPIO subsystem, so that they
can be exposed to clients. It does not include IRQ chip support, which
will come in a subsequent patch.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
rust: add `Revocable` type.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It allows access to objects to be safely revoked at run time.
This is useful, for example, for resources allocated during device
probe; when the device is removed, the driver should stop accessing the
device resources even if other state is kept in memory due to existing
references (i.e., device context data is ref-counted and has a non-zero
refcount after removal of the device).
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
| |
| |
| |
| |
| |
| | |
This is used by the PL061 gpio driver.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|/
|
|
|
|
| |
This is used by the PL061 driver.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
|
|
| |
We make the guard context an optional ulong. When locking without
disabling interrupts, we store `None` in the context; when disabling
interrupts, we store `Some(x)`, where `x` is the interrupt state before
locking. During unlock we choose which variant to use based on whether
the guard context is `None` or `Some(x)` (this check is short-circuited
by the optimiser in most cases).
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
rust: add `SeqLock`.
|
| |
| |
| |
| |
| |
| | |
Some functions accidently used spaces instead of tabs.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is based on the discussion in:
https://lore.kernel.org/rust-for-linux/YWccYPLUOH7t9JtB@google.com/
It has one modification where the `SeqLock` embeds a lock to serialise
the write-side critical section implicitly.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|/
|
|
|
|
| |
We likely need to create a `Cred` abstraction.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
|
|
|
|
| |
Signed-off-by: Gary Guo <gary@garyguo.net>
|
|
|
|
|
|
|
|
|
|
| |
This is based on what I described in LKML
(https://lore.kernel.org/lkml/YIbQ3dHOpyD%2FyymW@google.com/) back in
April.
This is in preparation for the PL061 driver to be merged.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
| |
This allows drivers to implement the methods in `dev_pm_ops`.
This is in preparation for adding the PL061 GPIO driver, which
implements some power management methods.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
| |
This allows drivers to call functions in security modules that take
objects for which we have abstractions (e.g., files and tasks) as
arguments.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
|
|
| |
This allows users of the `kernel` crate to get tasks (e.g., the current
task), access their properties (e.g., pid, group_leader, etc.), and hold
on to them if desired. When holding on to tasks, the reference count is
automatically incremented and decremented.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
| |
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
| |
`Ref` now has an interface similar to that of `Arc` but is backed by the
kernel's `refcount_t` type.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|
|
|
|
|
|
| |
Device driver data corresponds to per-device context data or state.
It is allocated on `probe()` and de-allocated in `remove()`.
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The use of `#ifdef CONFIG_` statements in .c/.rs files should be
avoided: it makes the code much more unmaintainable over time. See:
https://lore.kernel.org/lkml/YLjWKwhp7akqyR1S@kroah.com/
Use a Rust-C helper instead to leverage automatic `CONFIG` selection
in C kernel headers.
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The use of `#ifdef CONFIG_` statements in .c/.rs files should be
avoided: it makes the code much more unmaintainable over time. See:
https://lore.kernel.org/lkml/YLjWKwhp7akqyR1S@kroah.com/
Use a Rust-C helper instead to leverage automatic `CONFIG` selection
in C kernel headers.
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
|
|
|
|
|
|
|
|
| |
Also fix the guard to not fail spriously on ARM. We just need the types
to be ABI-compatible; we don't need C to be willing to implicitly
convert between them.
Signed-off-by: Geoffrey Thomas <geofft@ldpreload.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some kernel C API functions return a pointer which embeds an optional
`errno`. Callers are supposed to check the returned pointer with
`IS_ERR()` and if this returns `true`, retrieve the `errno` using
`PTR_ERR()`.
Create a Rust helper function to implement the Rust equivalent:
transform a `*mut T` to `Result<*mut T>`.
Co-developed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Co-developed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
|
|
|
|
|
|
|
|
| |
Implementations only need to declare their desire to have the
appropriate fields in `struct file_operations` set, there is no need to
implement a variant of `read` or `write`.
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|
|\
| |
| | |
Add `UserSlicePtrWriter::clear`.
|
| |
| |
| |
| | |
Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
|