summaryrefslogtreecommitdiffstats
path: root/fs/udf/udfend.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/udf/udfend.h
downloadlinux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.gz
linux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.bz2
linux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.zip
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/udf/udfend.h')
-rw-r--r--fs/udf/udfend.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/fs/udf/udfend.h b/fs/udf/udfend.h
new file mode 100644
index 000000000000..17d378879561
--- /dev/null
+++ b/fs/udf/udfend.h
@@ -0,0 +1,81 @@
+#ifndef __UDF_ENDIAN_H
+#define __UDF_ENDIAN_H
+
+#include <asm/byteorder.h>
+#include <linux/string.h>
+
+static inline kernel_lb_addr lelb_to_cpu(lb_addr in)
+{
+ kernel_lb_addr out;
+ out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
+ out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
+ return out;
+}
+
+static inline lb_addr cpu_to_lelb(kernel_lb_addr in)
+{
+ lb_addr out;
+ out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
+ out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
+ return out;
+}
+
+static inline kernel_timestamp lets_to_cpu(timestamp in)
+{
+ kernel_timestamp out;
+ memcpy(&out, &in, sizeof(timestamp));
+ out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone);
+ out.year = le16_to_cpu(in.year);
+ return out;
+}
+
+static inline short_ad lesa_to_cpu(short_ad in)
+{
+ short_ad out;
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extPosition = le32_to_cpu(in.extPosition);
+ return out;
+}
+
+static inline short_ad cpu_to_lesa(short_ad in)
+{
+ short_ad out;
+ out.extLength = cpu_to_le32(in.extLength);
+ out.extPosition = cpu_to_le32(in.extPosition);
+ return out;
+}
+
+static inline kernel_long_ad lela_to_cpu(long_ad in)
+{
+ kernel_long_ad out;
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extLocation = lelb_to_cpu(in.extLocation);
+ return out;
+}
+
+static inline long_ad cpu_to_lela(kernel_long_ad in)
+{
+ long_ad out;
+ out.extLength = cpu_to_le32(in.extLength);
+ out.extLocation = cpu_to_lelb(in.extLocation);
+ return out;
+}
+
+static inline kernel_extent_ad leea_to_cpu(extent_ad in)
+{
+ kernel_extent_ad out;
+ out.extLength = le32_to_cpu(in.extLength);
+ out.extLocation = le32_to_cpu(in.extLocation);
+ return out;
+}
+
+static inline timestamp cpu_to_lets(kernel_timestamp in)
+{
+ timestamp out;
+ memcpy(&out, &in, sizeof(timestamp));
+ out.typeAndTimezone = cpu_to_le16(in.typeAndTimezone);
+ out.year = cpu_to_le16(in.year);
+ return out;
+}
+
+#endif /* __UDF_ENDIAN_H */