+// SPDX-License-Identifier: GPL-2.0+
/*
*
* ZFS filesystem ported to u-boot by
* Copyright (C) 1999,2000,2001,2002,2003,2004
* Free Software Foundation, Inc.
* Copyright 2004 Sun Microsystems, Inc.
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
+#include <log.h>
#include <malloc.h>
#include <linux/stat.h>
#include <linux/time.h>
#include "zfs_common.h"
#include "div64.h"
-block_dev_desc_t *zfs_dev_desc;
+struct blk_desc *zfs_dev_desc;
/*
* The zfs plug-in routines for GRUB are:
uint64_t crc = salt;
if (table[128] == 0) {
- uint64_t *ct;
+ uint64_t *ct = NULL;
int i, j;
for (i = 0; i < 256; i++) {
for (ct = table + i, *ct = i, j = 8; j > 0; j--)
while (bseen < array_len) {
struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array;
- int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
+ int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
return 0;
while (bseen < array_len) {
struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array;
- int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
+ int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
/* Don't use errno because this error is to be ignored. */
}
printf("unknown ZAP type\n");
+ free(zapbuf);
return ZFS_ERR_BAD_FS;
}
return ret;
}
printf("unknown ZAP type\n");
+ free(zapbuf);
return 0;
}
ubbest = malloc(sizeof(*ubbest));
if (!ubbest) {
+ free(ub_array);
zfs_unmount(data);
return 0;
}
if (err) {
printf("couldn't zio_read object directory\n");
zfs_unmount(data);
+ free(osp);
free(ubbest);
return 0;
}
hdrsize = SA_HDR_SIZE(((sa_hdr_phys_t *) sahdrp));
file->size = *(uint64_t *) ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET);
+ if ((data->dnode.dn.dn_bonuslen == 0) &&
+ (data->dnode.dn.dn_flags & DNODE_FLAG_SPILL_BLKPTR))
+ free(sahdrp);
} else {
file->size = zfs_to_cpu64(((znode_phys_t *) DN_BONUS(&data->dnode.dn))->zp_size, data->dnode.endian);
}
data->file_start = blkid * blksz;
data->file_end = data->file_start + blksz;
- movesize = MIN(length, data->file_end - (int) file->offset - red);
+ movesize = min(length, data->file_end - (int)file->offset - red);
memmove(buf, data->file_buf + file->offset + red
- data->file_start, movesize);