repart: Add debug logging for block_device_partition_add()
This commit is contained in:
committed by
Daan De Meyer
parent
6e232bb565
commit
bd7a152345
@@ -278,6 +278,13 @@ assert_cc(sizeof(long long) == sizeof(intmax_t));
|
||||
CONST_ISPOWEROF2(_x); \
|
||||
}))
|
||||
|
||||
/* Returns the largest power of two that divides x (i.e. x's natural alignment in bytes), or 0 if x is 0. */
|
||||
#define NATURAL_ALIGNMENT(x) \
|
||||
({ \
|
||||
const uint64_t _x = (x); \
|
||||
_x == 0 ? UINT64_C(0) : UINT64_C(1) << __builtin_ctzll(_x); \
|
||||
})
|
||||
|
||||
#define ADD_SAFE(ret, a, b) (!__builtin_add_overflow(a, b, ret))
|
||||
#define INC_SAFE(a, b) __INC_SAFE(UNIQ, a, b)
|
||||
#define __INC_SAFE(q, a, b) \
|
||||
|
||||
@@ -5202,6 +5202,10 @@ static int partition_target_prepare(
|
||||
* keep them alive if we succeed, and the rescan will remove them if possible if
|
||||
* there is an error before writing the partition table.
|
||||
*/
|
||||
log_debug("Adding partition '%s' (nr=%i, offset=%" PRIu64 " [align=%" PRIu64 "], size=%" PRIu64 " [align=%" PRIu64 "])",
|
||||
part_node, nr,
|
||||
p->offset, NATURAL_ALIGNMENT(p->offset),
|
||||
size, NATURAL_ALIGNMENT(size));
|
||||
r = block_device_add_partition(whole_fd, part_node, nr, p->offset, size);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create new partition '%s': %m", part_node);
|
||||
|
||||
Reference in New Issue
Block a user