vfs-6.15-rc1.rust

-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCZ90sSwAKCRCRxhvAZXjc
 oqodAP9rJCUOpfqV0Sh25TiyTbG/+62ZquZfUkqivnnpoz/XyAEApPPENf2qzcbz
 aTHx9U7w+lDG+W/CgmTGkOnYvly9Qg4=
 =Xja1
 -----END PGP SIGNATURE-----

Merge tag 'vfs-6.15-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs rust updates from Christian Brauner:
 "This contains minor fixes and improvements to rust file bindings:

   - Optimize rust symbol generation for FileDescriptorReservation

   - Optimize rust symbol generation for SeqFile"

* tag 'vfs-6.15-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  rust: optimize rust symbol generation for SeqFile
  rust: file: optimize rust symbol generation for FileDescriptorReservation
This commit is contained in:
Linus Torvalds 2025-03-24 13:35:36 -07:00
commit 56e7a8b051
2 changed files with 5 additions and 0 deletions

View file

@ -392,6 +392,7 @@ pub struct FileDescriptorReservation {
impl FileDescriptorReservation {
/// Creates a new file descriptor reservation.
#[inline]
pub fn get_unused_fd_flags(flags: u32) -> Result<Self> {
// SAFETY: FFI call, there are no safety requirements on `flags`.
let fd: i32 = unsafe { bindings::get_unused_fd_flags(flags) };
@ -405,6 +406,7 @@ pub fn get_unused_fd_flags(flags: u32) -> Result<Self> {
}
/// Returns the file descriptor number that was reserved.
#[inline]
pub fn reserved_fd(&self) -> u32 {
self.fd
}
@ -413,6 +415,7 @@ pub fn reserved_fd(&self) -> u32 {
///
/// The previously reserved file descriptor is bound to `file`. This method consumes the
/// [`FileDescriptorReservation`], so it will not be usable after this call.
#[inline]
pub fn fd_install(self, file: ARef<File>) {
// SAFETY: `self.fd` was previously returned by `get_unused_fd_flags`. We have not yet used
// the fd, so it is still valid, and `current` still refers to the same task, as this type
@ -433,6 +436,7 @@ pub fn fd_install(self, file: ARef<File>) {
}
impl Drop for FileDescriptorReservation {
#[inline]
fn drop(&mut self) {
// SAFETY: By the type invariants of this type, `self.fd` was previously returned by
// `get_unused_fd_flags`. We have not yet used the fd, so it is still valid, and `current`

View file

@ -30,6 +30,7 @@ pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {
}
/// Used by the [`seq_print`] macro.
#[inline]
pub fn call_printf(&self, args: core::fmt::Arguments<'_>) {
// SAFETY: Passing a void pointer to `Arguments` is valid for `%pA`.
unsafe {