Lines Matching refs:size
134 static int load_xbc_fd(int fd, char **buf, int size)
138 *buf = malloc(size + 1);
142 ret = read(fd, *buf, size);
145 (*buf)[size] = '\0';
150 /* Return the read size or -errno */
180 uint32_t size = 0, csum = 0, rcsum;
202 return pr_errno("Failed to lseek for size", -errno);
204 if (read(fd, &size, sizeof(uint32_t)) < 0)
205 return pr_errno("Failed to read size", -errno);
206 size = le32toh(size);
212 /* Wrong size error */
213 if (stat.st_size < size + 8 + BOOTCONFIG_MAGIC_LEN) {
214 pr_err("bootconfig size is too big\n");
218 if (lseek(fd, stat.st_size - (size + 8 + BOOTCONFIG_MAGIC_LEN),
222 ret = load_xbc_fd(fd, buf, size);
227 rcsum = xbc_calc_checksum(*buf, size);
233 ret = xbc_init(*buf, size, &msg, NULL);
240 return size;
331 int ret = 0, fd, size;
341 size = load_xbc_from_initrd(fd, &buf);
342 if (size < 0) {
343 ret = size;
345 } else if (size > 0) {
349 - size - 8 - BOOTCONFIG_MAGIC_LEN);
366 uint32_t size, csum;
375 size = strlen(buf) + 1;
376 csum = xbc_calc_checksum(buf, size);
379 data = calloc(size + BOOTCONFIG_ALIGN +
383 memcpy(data, buf, size);
386 ret = xbc_init(buf, size, &msg, &pos);
397 printf("\tSize: %u bytes\n", (unsigned int)size);
423 pr_err("Failed to get the size of %s\n", path);
427 /* To align up the total size to BOOTCONFIG_ALIGN, get padding size */
428 total_size = stat.st_size + size + sizeof(uint32_t) * 2 + BOOTCONFIG_MAGIC_LEN;
430 size += pad;
433 p = data + size;
434 *(uint32_t *)p = htole32(size);