]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - fs/ubifs/ubifs.c
part: Drop disk_partition_t typedef
[thirdparty/u-boot.git] / fs / ubifs / ubifs.c
index 4465523d5fbe49ef9beb693ae909e7cdd86fdaa0..742c2f47ebf6ebcd8fac4e90b64ba1e4c4f8336d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This file is part of UBIFS.
  *
@@ -8,15 +9,18 @@
  *
  * Authors: Artem Bityutskiy (Битюцкий Артём)
  *          Adrian Hunter
- *
- * SPDX-License-Identifier:    GPL-2.0
  */
 
 #include <common.h>
+#include <env.h>
+#include <gzip.h>
+#include <malloc.h>
 #include <memalign.h>
 #include "ubifs.h"
+#include <dm/devres.h>
 #include <u-boot/zlib.h>
 
+#include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/lzo.h>
 
@@ -69,24 +73,6 @@ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
 
 
 #ifdef __UBOOT__
-/* from mm/util.c */
-
-/**
- * kmemdup - duplicate region of memory
- *
- * @src: memory region to duplicate
- * @len: memory region length
- * @gfp: GFP mask to use
- */
-void *kmemdup(const void *src, size_t len, gfp_t gfp)
-{
-       void *p;
-
-       p = kmalloc(len, gfp);
-       if (p)
-               memcpy(p, src, len);
-       return p;
-}
 
 struct crypto_comp {
        int compressor;
@@ -126,6 +112,7 @@ crypto_comp_decompress(const struct ubifs_info *c, struct crypto_comp *tfm,
 {
        struct ubifs_compressor *compr = ubifs_compressors[tfm->compressor];
        int err;
+       size_t tmp_len = *dlen;
 
        if (compr->compr_type == UBIFS_COMPR_NONE) {
                memcpy(dst, src, slen);
@@ -133,11 +120,12 @@ crypto_comp_decompress(const struct ubifs_info *c, struct crypto_comp *tfm,
                return 0;
        }
 
-       err = compr->decompress(src, slen, dst, (size_t *)dlen);
+       err = compr->decompress(src, slen, dst, &tmp_len);
        if (err)
                ubifs_err(c, "cannot decompress %d bytes, compressor %s, "
                          "error %d", slen, compr->name, err);
 
+       *dlen = tmp_len;
        return err;
 
        return 0;
@@ -350,7 +338,9 @@ static int ubifs_printdir(struct file *file, void *dirent)
                dbg_gen("feed '%s', ino %llu, new f_pos %#x",
                        dent->name, (unsigned long long)le64_to_cpu(dent->inum),
                        key_hash_flash(c, &dent->key));
+#ifndef __UBOOT__
                ubifs_assert(le64_to_cpu(dent->ch.sqnum) > ubifs_inode(dir)->creat_sqnum);
+#endif
 
                nm.len = le16_to_cpu(dent->nlen);
                over = filldir(c, (char *)dent->name, nm.len,
@@ -432,7 +422,9 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
                dbg_gen("feed '%s', ino %llu, new f_pos %#x",
                        dent->name, (unsigned long long)le64_to_cpu(dent->inum),
                        key_hash_flash(c, &dent->key));
+#ifndef __UBOOT__
                ubifs_assert(le64_to_cpu(dent->ch.sqnum) > ubifs_inode(dir)->creat_sqnum);
+#endif
 
                nm.len = le16_to_cpu(dent->nlen);
                if ((strncmp(dirname, (char *)dent->name, nm.len) == 0) &&
@@ -557,7 +549,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
        return 0;
 }
 
-int ubifs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+int ubifs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
        if (rbdd) {
                debug("UBIFS cannot be used with normal block devices\n");