/// Create a file system directly on a device.
Create a file system directly on a device.
Create a file system directly on a device .
pub fn create_on(&mut self, device: DeviceEntity, what: PartitionCreate) -> Result<(), Error> {
        self.assert_not_creating_table_on(device);
        let (sectors, logical_sector_size, physical_sector_size) = {
            let device_info = &self.components.devices.devices[device];
            (device_info.sectors, device_info.logical_sector_size, device_info.physical_sector_size)
        };
        let offset = match self.components.devices.partitions.get(device) {
            Some(partition) => partition.offset,
            None => 0,
        };
        self.create_partition(
            what,
            device,
            None,
            offset,
            sectors,
            logical_sector_size,
            physical_sector_size,
            |manager| {
                let device_components = &manager.components.devices;
                let device = manager
                    .components
                    .queued_changes
                    .devices
                    .get(device)
                    .or_else(|| device_components.devices.get(device))
                    .expect("device entity without device component");
                device.path.to_path_buf().into()
            },
        );
        self.entities.devices[device] |= EntityFlags::CREATE;
        self.flags |= ManagerFlags::CREATE;
        Ok(())
    }
pub fn create_on ( & mut self , device : DeviceEntity , what : PartitionCreate ) -> Result < ( ) , Error > { self . assert_not_creating_table_on ( device ) ; let ( sectors , logical_sector_size , physical_sector_size ) = { let device_info = & self . components . devices . devices [ device ] ; ( device_info . sectors , device_info . logical_sector_size , device_info . physical_sector_size ) } ; let offset = match self . components . devices . partitions . get ( device ) { Some ( partition ) => partition . offset , None => 0 , } ; self . create_partition ( what , device , None , offset , sectors , logical_sector_size , physical_sector_size , | manager | { let device_components = & manager . components . devices ; let device = manager . components . queued_changes . devices . get ( device ) . or_else ( | | device_components . devices . get ( device ) ) . expect ( " " ) ; device . path . to_path_buf ( ) . into ( ) } , ) ; self . entities . devices [ device ] |= EntityFlags :: CREATE ; self . flags |= ManagerFlags :: CREATE ; Ok ( ( ) ) }
Create a file system directly on a device.
Create a file system directly on a device .
&mut self
device
DeviceEntity
what
PartitionCreate