Lines Matching +full:self +full:- +full:power
1 // SPDX-License-Identifier: GPL-2.0
11 use core::fmt::{self, Write};
24 fn default() -> Self { in default()
25 Self { in default()
36 pub fn new() -> Self { in new()
37 Self::default() in new()
41 pub fn rotational(mut self, rotational: bool) -> Self { in rotational() argument
42 self.rotational = rotational; in rotational()
43 self in rotational()
47 /// and that it is a power of two.
48 fn validate_block_size(size: u32) -> Result { in validate_block_size()
58 /// This method will check that block size is a power of two and between 512
63 pub fn logical_block_size(mut self, block_size: u32) -> Result<Self> { in logical_block_size() argument
64 Self::validate_block_size(block_size)?; in logical_block_size()
65 self.logical_block_size = block_size; in logical_block_size()
66 Ok(self) in logical_block_size()
71 /// This method will check that block size is a power of two and between 512
78 pub fn physical_block_size(mut self, block_size: u32) -> Result<Self> { in physical_block_size() argument
79 Self::validate_block_size(block_size)?; in physical_block_size()
80 self.physical_block_size = block_size; in physical_block_size()
81 Ok(self) in physical_block_size()
85 pub fn capacity_sectors(mut self, capacity: u64) -> Self { in capacity_sectors() argument
86 self.capacity_sectors = capacity; in capacity_sectors()
87 self in capacity_sectors()
92 self, in build()
95 ) -> Result<GenDisk<T>> { in build()
99 lim.logical_block_size = self.logical_block_size; in build()
100 lim.physical_block_size = self.physical_block_size; in build()
101 if self.rotational { in build()
132 // https://github.com/rust-lang/rust/issues/119618 in build()
154 unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) }; in build()
177 /// - `gendisk` must always point to an initialized and valid `struct gendisk`.
178 /// - `gendisk` was added to the VFS through a call to
190 fn drop(&mut self) { in drop() argument
191 // SAFETY: By type invariant, `self.gendisk` points to a valid and in drop()
194 unsafe { bindings::del_gendisk(self.gendisk) }; in drop()