From: Lennart Poettering Date: Wed, 15 Nov 2023 10:14:11 +0000 (+0100) Subject: gpt-auto-generator: add comment + assert() explaining mode of invocation X-Git-Tag: v255-rc2~5^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ca8ac0f9b5479eb98fad6d364303f9d6d38f410c;p=thirdparty%2Fsystemd.git gpt-auto-generator: add comment + assert() explaining mode of invocation We are not invoked in the initrd, and that deserves a comment. --- diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index e4c3aeea8a7..d1f6688f4ca 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -793,6 +793,11 @@ static int enumerate_partitions(dev_t devnum) { _cleanup_free_ char *devname = NULL; int r; + assert(!in_initrd()); + + /* Run on the final root fs (not in the initrd), to mount auxiliary partitions, and hook in rw + * remount and growfs of the root partition */ + r = block_get_whole_disk(devnum, &devnum); if (r < 0) return log_debug_errno(r, "Failed to get whole block device for " DEVNUM_FORMAT_STR ": %m",