linux_uapi/
manual.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use crate::{__IncompleteArrayField, __u8, __u32};
6use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};
7
8#[repr(C)]
9#[derive(Copy, Clone, FromBytes, Immutable, KnownLayout, IntoBytes)]
10pub struct fscrypt_key_specifier {
11    pub type_: __u32,
12    pub __reserved: __u32,
13    pub u: fscrypt_key_specifier__bindgen_ty_1,
14}
15
16#[repr(C)]
17#[derive(Copy, Clone, FromBytes, Immutable, KnownLayout, IntoBytes)]
18pub union fscrypt_key_specifier__bindgen_ty_1 {
19    pub __reserved: [__u8; 32usize],
20    pub descriptor: fscrypt_descriptor,
21    pub identifier: fscrypt_identifier,
22}
23
24#[repr(C)]
25#[derive(Copy, Clone, Default, FromBytes, Immutable, KnownLayout, IntoBytes)]
26pub struct fscrypt_descriptor {
27    pub value: [__u8; 8usize],
28    pub __bindgen_padding_0: [u8; 24usize],
29}
30
31#[repr(C)]
32#[derive(Copy, Clone, Default, FromBytes, Immutable, KnownLayout, IntoBytes)]
33pub struct fscrypt_identifier {
34    pub value: [__u8; 16usize],
35    pub __bindgen_padding_0: [u8; 16usize],
36}
37
38impl Default for fscrypt_key_specifier__bindgen_ty_1 {
39    fn default() -> Self {
40        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
41        // SAFETY: this is what bindgen would generate
42        unsafe {
43            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
44            s.assume_init()
45        }
46    }
47}
48impl Default for fscrypt_key_specifier {
49    fn default() -> Self {
50        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
51        // SAFETY: this is what bindgen would generate
52        unsafe {
53            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
54            s.assume_init()
55        }
56    }
57}
58
59#[repr(C)]
60#[derive(Clone, FromBytes, Immutable, KnownLayout, IntoBytes)]
61pub struct fscrypt_add_key_arg {
62    pub key_spec: fscrypt_key_specifier,
63    pub raw_size: __u32,
64    pub key_id: __u32,
65    pub __reserved: [__u32; 7usize],
66    pub __flags: __u32,
67    pub raw: __IncompleteArrayField<__u8>,
68}
69impl Default for fscrypt_add_key_arg {
70    fn default() -> Self {
71        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
72        // SAFETY: this is what bindgen would generate
73        unsafe {
74            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
75            s.assume_init()
76        }
77    }
78}
79
80crate::check_same_layout! {
81    crate::statfs64 = crate::statfs {
82        f_type => f_type,
83        f_bsize => f_bsize,
84        f_blocks => f_blocks,
85        f_bfree => f_bfree,
86        f_bavail => f_bavail,
87        f_files => f_files,
88        f_ffree => f_ffree,
89        f_fsid => f_fsid,
90        f_namelen => f_namelen,
91        f_frsize => f_frsize,
92        f_flags => f_flags,
93    }
94}
95
96macro_rules! impl_debug {
97    {} => {};
98    {
99        ,
100        $($token:tt)*
101    } => {
102        impl_debug! { $($token)* }
103    };
104    {
105        $name:ident
106        $($token:tt)*
107    } => {
108        impl std::fmt::Debug for crate::$name {
109            fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
110                fmt.debug_struct(std::any::type_name::<Self>()).finish()
111            }
112        }
113        #[cfg(target_arch = "aarch64")]
114        impl std::fmt::Debug for crate::arch32::$name {
115            fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
116                fmt.debug_struct(std::any::type_name::<Self>()).finish()
117            }
118        }
119        impl_debug! { $($token)* }
120    };
121}
122
123impl_debug! {
124    fuse_open_out__bindgen_ty_1,
125    fuse_in_header__bindgen_ty_1,
126}