From: Yu Watanabe Date: Fri, 17 Mar 2023 05:21:56 +0000 (+0900) Subject: bootctl: move verb_kernel_identity() X-Git-Tag: v254-rc1~989^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ab94d98b29ffc42d3840c5b4ffde1acbc106f88e;p=thirdparty%2Fsystemd.git bootctl: move verb_kernel_identity() No functional change, just for making beautify later diffs. --- diff --git a/src/boot/bootctl-uki.c b/src/boot/bootctl-uki.c index 261e687e3f8..c0f263d4341 100644 --- a/src/boot/bootctl-uki.c +++ b/src/boot/bootctl-uki.c @@ -103,30 +103,6 @@ static bool is_uki(struct PeSectionHeader *sections, size_t scount) { find_pe_section(sections, scount, name_initrd, sizeof(name_initrd), NULL); } -int verb_kernel_identify(int argc, char *argv[], void *userdata) { - _cleanup_fclose_ FILE *uki = NULL; - _cleanup_free_ struct PeSectionHeader *sections = NULL; - size_t scount; - int r; - - uki = fopen(argv[1], "re"); - if (!uki) - return log_error_errno(errno, "Failed to open UKI file '%s': %m", argv[1]); - - r = pe_sections(uki, §ions, &scount); - if (r < 0) - return r; - - if (!sections) - puts("unknown"); - else if (is_uki(sections, scount)) - puts("uki"); - else - puts("pe"); - - return EXIT_SUCCESS; -} - static int read_pe_section( FILE *uki, const struct PeSectionHeader *section, @@ -214,6 +190,30 @@ static void inspect_uki(FILE *uki, struct PeSectionHeader *sections, size_t scou (void) inspect_osrel(osrel, osrel_size); } +int verb_kernel_identify(int argc, char *argv[], void *userdata) { + _cleanup_fclose_ FILE *uki = NULL; + _cleanup_free_ struct PeSectionHeader *sections = NULL; + size_t scount; + int r; + + uki = fopen(argv[1], "re"); + if (!uki) + return log_error_errno(errno, "Failed to open UKI file '%s': %m", argv[1]); + + r = pe_sections(uki, §ions, &scount); + if (r < 0) + return r; + + if (!sections) + puts("unknown"); + else if (is_uki(sections, scount)) + puts("uki"); + else + puts("pe"); + + return EXIT_SUCCESS; +} + int verb_kernel_inspect(int argc, char *argv[], void *userdata) { _cleanup_fclose_ FILE *uki = NULL; _cleanup_free_ struct PeSectionHeader *sections = NULL;