diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 16:36:42 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:45 +0100 |
commit | 583125d58cc604ba8bb3cdca1656c7f973fae69c (patch) | |
tree | 3e203e2b8f6b78fc88ac20c2271a796ed38fdc46 /ubifs-utils/common/defs.h | |
parent | 50f9259befe1b94ee991ae390b7c84b21f4dbb88 (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/common/defs.h')
-rw-r--r-- | ubifs-utils/common/defs.h | 30 |
1 files changed, 0 insertions, 30 deletions
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 <stdlib.h> #include <stdio.h> #include <limits.h> -#include <byteswap.h> #include <errno.h> #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 |