diff --git a/src/partition.rs b/src/partition.rs index deead6e..aa97ee0 100644 --- a/src/partition.rs +++ b/src/partition.rs @@ -290,4 +290,14 @@ impl Context { v => Err(nix::Error::from_errno(nix::errno::from_i32(-v)).into()), } } + + /// Delete the specified partition + /// # Arguments + /// * `patno` - partition number (0 is the first partition) + pub fn delete_partition(&self, no: usize) -> Result<()> { + match unsafe { fdisk_sys::fdisk_delete_partition(self.ptr, no) } { + 0 => Ok(()), + v => Err(nix::Error::from_errno(nix::errno::from_i32(-v)).into()), + } + } }