From 7cec2164e3bdb4c02f6ae514bc16e9c7c48be618 Mon Sep 17 00:00:00 2001 From: Jiri Svoboda Date: Wed, 19 Jun 2024 00:04:11 +0200 Subject: [PATCH] Fdisk needs to unmount partition before trying to delete it --- uspace/lib/fdisk/src/fdisk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/uspace/lib/fdisk/src/fdisk.c b/uspace/lib/fdisk/src/fdisk.c index 58c496eef..8c4849761 100644 --- a/uspace/lib/fdisk/src/fdisk.c +++ b/uspace/lib/fdisk/src/fdisk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Jiri Svoboda + * Copyright (c) 2024 Jiri Svoboda * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -809,10 +809,19 @@ error: return rc; } +/** Destroy partition. + * + * @param part Partition + * @return EOK on success or error code + */ errno_t fdisk_part_destroy(fdisk_part_t *part) { errno_t rc; + rc = vol_part_eject(part->dev->fdisk->vol, part->svc_id); + if (rc != EOK) + return EIO; + rc = vbd_part_delete(part->dev->fdisk->vbd, part->part_id); if (rc != EOK) return EIO; -- 2.11.4.GIT