From 583125d58cc604ba8bb3cdca1656c7f973fae69c Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 16:36:42 +0800 Subject: 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 Signed-off-by: David Oberhollenzer --- ubifs-utils/common/defs.h | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'ubifs-utils/common/defs.h') diff --git a/ubifs-utils/common/defs.h b/ubifs-utils/common/defs.h index cafc94a..dd3b806 100644 --- a/ubifs-utils/common/defs.h +++ b/ubifs-utils/common/defs.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "ubifs.h" @@ -27,37 +26,8 @@ enum { MKFS_PROGRAM_TYPE = 0 }; printf("%s: %s: " fmt "\n", PROGRAM_NAME, __FUNCTION__, ##__VA_ARGS__); \ } while(0) -#define t16(x) ({ \ - uint16_t __b = (x); \ - (__LITTLE_ENDIAN==__BYTE_ORDER) ? __b : bswap_16(__b); \ -}) - -#define t32(x) ({ \ - uint32_t __b = (x); \ - (__LITTLE_ENDIAN==__BYTE_ORDER) ? __b : bswap_32(__b); \ -}) - -#define t64(x) ({ \ - uint64_t __b = (x); \ - (__LITTLE_ENDIAN==__BYTE_ORDER) ? __b : bswap_64(__b); \ -}) - -#define cpu_to_le16(x) ((__le16){t16(x)}) -#define cpu_to_le32(x) ((__le32){t32(x)}) -#define cpu_to_le64(x) ((__le64){t64(x)}) - -#define le16_to_cpu(x) (t16((x))) -#define le32_to_cpu(x) (t32((x))) -#define le64_to_cpu(x) (t64((x))) - #define unlikely(x) (x) -struct qstr -{ - char *name; - size_t len; -}; - /** * fls - find last (most-significant) bit set * @x: the word to search -- cgit v1.2.3