summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-11-11 16:36:42 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-11-11 10:32:45 +0100
commit583125d58cc604ba8bb3cdca1656c7f973fae69c (patch)
tree3e203e2b8f6b78fc88ac20c2271a796ed38fdc46 /ubifs-utils/mkfs.ubifs
parent50f9259befe1b94ee991ae390b7c84b21f4dbb88 (diff)
ubifs-utils: Add linux type definitions
Add linux type definitions, because there are many types (eg. u8/u16/u64) used in UBIFS linux kernel libs. Besides move type conversions (eg. cpu_to_le16, cpu_to_le32, etc.) into type definitions header file. This is a preparation for replacing implementation of UBIFS utils with linux kernel libs. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs')
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index 2181595..c2f5a29 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -46,6 +46,7 @@
#include <zstd.h>
#endif
+#include "linux_types.h"
#include "defs.h"
#include "crypto.h"
#include "fscrypt.h"
@@ -1207,12 +1208,14 @@ static int add_xattr(struct ubifs_ino_node *host_ino, struct stat *st,
struct ubifs_ino_node *ino;
struct ubifs_dent_node *xent;
struct qstr nm;
+ char *tmp_name;
union ubifs_key xkey, nkey;
int len, ret;
nm.len = strlen(name);
- nm.name = xmalloc(nm.len + 1);
- memcpy(nm.name, name, nm.len + 1);
+ tmp_name = xmalloc(nm.len + 1);
+ memcpy(tmp_name, name, nm.len + 1);
+ nm.name = tmp_name;
host_ino->xattr_cnt++;
host_ino->xattr_size += CALC_DENT_SIZE(nm.len);
@@ -1240,7 +1243,7 @@ static int add_xattr(struct ubifs_ino_node *host_ino, struct stat *st,
xent->inum = cpu_to_le64(inum);
- ret = add_node(&xkey, nm.name, nm.len, xent, len);
+ ret = add_node(&xkey, tmp_name, nm.len, xent, len);
if (ret)
goto out;