main.c (cdd38c5f1ce4398ec58fec95904b75824daab7b5) | main.c (e8ba0b2b64126381643bb50df3556b139a60545a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Boot config tool for initrd image 4 */ 5#include <stdio.h> 6#include <stdlib.h> 7#include <sys/types.h> 8#include <sys/stat.h> --- 385 unchanged lines hidden (view full) --- 394 if (fd < 0) { 395 ret = -errno; 396 pr_err("Failed to open %s: %d\n", path, ret); 397 free(data); 398 return ret; 399 } 400 /* TODO: Ensure the @path is initramfs/initrd image */ 401 if (fstat(fd, &stat) < 0) { | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Boot config tool for initrd image 4 */ 5#include <stdio.h> 6#include <stdlib.h> 7#include <sys/types.h> 8#include <sys/stat.h> --- 385 unchanged lines hidden (view full) --- 394 if (fd < 0) { 395 ret = -errno; 396 pr_err("Failed to open %s: %d\n", path, ret); 397 free(data); 398 return ret; 399 } 400 /* TODO: Ensure the @path is initramfs/initrd image */ 401 if (fstat(fd, &stat) < 0) { |
402 ret = -errno; |
|
402 pr_err("Failed to get the size of %s\n", path); 403 goto out; 404 } 405 406 /* To align up the total size to BOOTCONFIG_ALIGN, get padding size */ 407 total_size = stat.st_size + size + sizeof(u32) * 2 + BOOTCONFIG_MAGIC_LEN; 408 pad = ((total_size + BOOTCONFIG_ALIGN - 1) & (~BOOTCONFIG_ALIGN_MASK)) - total_size; 409 size += pad; --- 98 unchanged lines hidden --- | 403 pr_err("Failed to get the size of %s\n", path); 404 goto out; 405 } 406 407 /* To align up the total size to BOOTCONFIG_ALIGN, get padding size */ 408 total_size = stat.st_size + size + sizeof(u32) * 2 + BOOTCONFIG_MAGIC_LEN; 409 pad = ((total_size + BOOTCONFIG_ALIGN - 1) & (~BOOTCONFIG_ALIGN_MASK)) - total_size; 410 size += pad; --- 98 unchanged lines hidden --- |