Lines Matching full:request

3 //! This module provides a wrapper for the C `struct request` type.
19 /// A wrapper around a blk-mq `struct request`. This represents an IO request.
23 /// There are four states for a request that the Rust bindings care about:
25 /// A) Request is owned by block layer (refcount 0)
26 /// B) Request is owned by driver but with zero `ARef`s in existence
28 /// C) Request is owned by driver with exactly one `ARef` in existence
30 /// D) Request is owned by driver with more than one `ARef` in existence
34 /// We need to track A and B to ensure we fail tag to request conversions for
37 /// We need to track C and D to ensure that it is safe to end the request and hand
42 /// `struct request`.
46 /// * `self.0` is a valid `struct request` created by the C portion of the kernel.
47 /// * The private data area associated with this request must be an initialized
53 pub struct Request<T: Operations>(Opaque<bindings::request>, PhantomData<T>); struct
55 impl<T: Operations> Request<T> { implementation
56 /// Create an `ARef<Request>` from a `struct request` pointer.
62 /// * The type invariants for `Request` must hold for the pointee of `ptr`.
63 pub(crate) unsafe fn aref_from_raw(ptr: *mut bindings::request) -> ARef<Self> { in aref_from_raw()
70 /// Notify the block layer that a request is going to be processed now.
74 /// drivers call this function when starting to process a request.
81 // SAFETY: By type invariant, `self.0` is a valid `struct request` and in start_unchecked()
88 /// `Request`.
91 /// C `struct request`. If the operation fails, `this` is returned in the
93 fn try_set_end(this: ARef<Self>) -> Result<*mut bindings::request, ARef<Self>> { in try_set_end() argument
110 /// Notify the block layer that the request has been completed without errors.
113 /// referencing the request.
117 // SAFETY: By type invariant, `this.0` was a valid `struct request`. The in end_ok()
119 // `ARef`s pointing to this request. Therefore it is safe to hand it in end_ok()
127 /// of the request structure.
134 let request_ptr = this.cast::<bindings::request>(); in wrapper_ptr()
145 /// area of the request structure.
148 // the private data associated with this request is initialized and in wrapper_ref()
155 /// A wrapper around data stored in the private area of the C `struct request`.
157 /// The Rust request refcount has the following states:
159 /// - 0: The request is owned by C block layer.
160 /// - 1: The request is owned by Rust abstractions but there are no ARef references to it.
161 /// - 2+: There are `ARef` references to the request.
166 /// Return a reference to the refcount of the request that is embedding
172 /// Return a pointer to the refcount of the request that is embedding the
185 // SAFETY: Exclusive access is thread-safe for `Request`. `Request` has no `&mut
188 unsafe impl<T: Operations> Send for Request<T> {} implementation
190 // SAFETY: Shared access is thread-safe for `Request`. `&self` methods that
192 unsafe impl<T: Operations> Sync for Request<T> {} implementation
220 // SAFETY: All instances of `Request<T>` are reference counted. This
224 unsafe impl<T: Operations> AlwaysRefCounted for Request<T> { implementation
233 panic!("Request refcount zero on clone") in inc_ref()
241 // SAFETY: The type invariant of `Request` guarantees that the private in dec_ref()
250 panic!("Request reached refcount zero in Rust abstractions"); in dec_ref()