代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/parted 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From c6c56f6510257a04013f24d63ba6755cadb176bd Mon Sep 17 00:00:00 2001
From: linyan <linyanly.lin@huawei.com>
Date: Fri, 25 Jan 2019 16:13:20 +0000
Subject: [PATCH] Add extra judgment for a partition created success and solve
the problem that parted races with systemd-udevd.
---
libparted/arch/linux.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index ec61b11..8fda092 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2530,6 +2530,25 @@ _blkpg_part_command (PedDevice* dev, struct blkpg_partition* part, int op)
return ioctl (arch_specific->fd, BLKPG, &ioctl_arg) == 0;
}
+static int _add_partition_succ(char *devname)
+{
+ int part_fd = -1;
+ int succ = 0;
+ unsigned size;
+ uint64_t bytes=0;
+
+ part_fd = open(devname, RD_MODE);
+
+ if (part_fd != -1) {
+ if(ioctl(part_fd, BLKGETSIZE64, &bytes) == 0 || ioctl (part_fd, BLKGETSIZE, &size) == 0) {
+ succ = 1;
+ }
+ close(part_fd);
+ }
+
+ return succ;
+}
+
static int
_blkpg_add_partition (PedDisk* disk, const PedPartition *part)
{
@@ -2580,6 +2599,8 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part)
if (!_blkpg_part_command (disk->dev, &linux_part,
BLKPG_ADD_PARTITION)) {
+ if (_add_partition_succ(linux_part.devname))
+ return 1;
return 0;
}
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。