homed: switch from raw BLKRRPART to rereadpt_fd()
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "random-util.h"
|
||||
#include "reread-partition-table.h"
|
||||
#include "resize-fs.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
@@ -2497,7 +2498,7 @@ int home_create_luks(
|
||||
|
||||
if (disk_uuid_path)
|
||||
/* Reread partition table if this is a block device */
|
||||
(void) ioctl(setup->image_fd, BLKRRPART, 0);
|
||||
(void) reread_partition_table_fd(setup->image_fd, /* flags= */ 0);
|
||||
else {
|
||||
assert(setup->temporary_image_path);
|
||||
|
||||
@@ -3469,8 +3470,8 @@ int home_resize_luks(
|
||||
if (r > 0)
|
||||
log_info("Growing of partition completed.");
|
||||
|
||||
if (S_ISBLK(st.st_mode) && ioctl(image_fd, BLKRRPART, 0) < 0)
|
||||
log_debug_errno(errno, "BLKRRPART failed on block device, ignoring: %m");
|
||||
if (S_ISBLK(st.st_mode))
|
||||
(void) reread_partition_table_fd(image_fd, /* flags= */ 0);
|
||||
|
||||
/* Tell LUKS about the new bigger size too */
|
||||
r = sym_crypt_resize(setup->crypt_device, setup->dm_name, new_fs_size / 512U);
|
||||
@@ -3569,8 +3570,8 @@ int home_resize_luks(
|
||||
if (r > 0)
|
||||
log_info("Shrinking of partition completed.");
|
||||
|
||||
if (S_ISBLK(st.st_mode) && ioctl(image_fd, BLKRRPART, 0) < 0)
|
||||
log_debug_errno(errno, "BLKRRPART failed on block device, ignoring: %m");
|
||||
if (S_ISBLK(st.st_mode))
|
||||
(void) reread_partition_table_fd(image_fd, /* flags= */ 0);
|
||||
|
||||
} else { /* → Grow */
|
||||
if (!FLAGS_SET(flags, HOME_SETUP_RESIZE_DONT_SYNC_IDENTITIES)) {
|
||||
|
||||
Reference in New Issue
Block a user