Lines Matching defs:gendisk
120 let gendisk = from_err_ptr(unsafe {
153 // SAFETY: `gendisk` is a valid pointer as we initialized it above
154 unsafe { (*gendisk).fops = &TABLE };
157 // SAFETY: `gendisk` points to a valid and initialized instance. We
160 unsafe { &mut (*gendisk).disk_name },
165 // SAFETY: `gendisk` points to a valid and initialized instance of
166 // `struct gendisk`. `set_capacity` takes a lock to synchronize this
168 unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) };
171 // SAFETY: `gendisk` points to a valid and initialized instance of
172 // `struct gendisk`.
174 bindings::device_add_disk(core::ptr::null_mut(), gendisk, core::ptr::null_mut())
180 // INVARIANT: `gendisk` was initialized above.
181 // INVARIANT: `gendisk` was added to the VFS via `device_add_disk` above.
182 // INVARIANT: `gendisk.queue.queue_data` is set to `data` in the call to
186 gendisk,
195 /// - `gendisk` must always point to an initialized and valid `struct gendisk`.
196 /// - `gendisk` was added to the VFS through a call to
198 /// - `self.gendisk.queue.queuedata` is initialized by a call to `ForeignOwnable::into_foreign`.
201 gendisk: *mut bindings::gendisk,
204 // SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a
210 // SAFETY: By type invariant of `Self`, `self.gendisk` points to a valid
211 // and initialized instance of `struct gendisk`, and, `queuedata` was
214 let queue_data = unsafe { (*(*self.gendisk).queue).queuedata };
216 // SAFETY: By type invariant, `self.gendisk` points to a valid and
217 // initialized instance of `struct gendisk`, and it was previously added
219 unsafe { bindings::del_gendisk(self.gendisk) };