summaryrefslogtreecommitdiffstats
path: root/fs/udf/udfend.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
commit76cb841cb886eef6b3bee341a2266c76578724ad (patch)
treef5892e5ba6cc11949952a6ce4ecbe6d516d6ce58 /fs/udf/udfend.h
parentInitial commit. (diff)
downloadlinux-76cb841cb886eef6b3bee341a2266c76578724ad.tar.xz
linux-76cb841cb886eef6b3bee341a2266c76578724ad.zip
Adding upstream version 4.19.249.upstream/4.19.249upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--fs/udf/udfend.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/fs/udf/udfend.h b/fs/udf/udfend.h
new file mode 100644
index 000000000..a4363ac2c
--- /dev/null
+++ b/fs/udf/udfend.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __UDF_ENDIAN_H
+#define __UDF_ENDIAN_H
+
+#include <asm/byteorder.h>
+#include <linux/string.h>
+
+static inline struct kernel_lb_addr lelb_to_cpu(struct lb_addr in)
+{
+ struct kernel_lb_addr out;
+
+ out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
+ out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
+
+ return out;
+}
+
+static inline struct lb_addr cpu_to_lelb(struct kernel_lb_addr in)
+{
+ struct lb_addr out;
+
+ out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
+ out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
+
+ return out;
+}
+
+static inline struct short_ad lesa_to_cpu(struct short_ad in)
+{
+ struct short_ad out;
+
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extPosition = le32_to_cpu(in.extPosition);
+
+ return out;
+}
+
+static inline struct short_ad cpu_to_lesa(struct short_ad in)
+{
+ struct short_ad out;
+
+ out.extLength = cpu_to_le32(in.extLength);
+ out.extPosition = cpu_to_le32(in.extPosition);
+
+ return out;
+}
+
+static inline struct kernel_long_ad lela_to_cpu(struct long_ad in)
+{
+ struct kernel_long_ad out;
+
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extLocation = lelb_to_cpu(in.extLocation);
+
+ return out;
+}
+
+static inline struct long_ad cpu_to_lela(struct kernel_long_ad in)
+{
+ struct long_ad out;
+
+ out.extLength = cpu_to_le32(in.extLength);
+ out.extLocation = cpu_to_lelb(in.extLocation);
+
+ return out;
+}
+
+static inline struct kernel_extent_ad leea_to_cpu(struct extent_ad in)
+{
+ struct kernel_extent_ad out;
+
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extLocation = le32_to_cpu(in.extLocation);
+
+ return out;
+}
+
+#endif /* __UDF_ENDIAN_H */