summaryrefslogtreecommitdiffstats
path: root/include/iso9660.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /include/iso9660.h
parentInitial commit. (diff)
downloadutil-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz
util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/iso9660.h')
-rw-r--r--include/iso9660.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/iso9660.h b/include/iso9660.h
new file mode 100644
index 0000000..73decd9
--- /dev/null
+++ b/include/iso9660.h
@@ -0,0 +1,58 @@
+#ifndef UTIL_LINUX_ISO_H
+#define UTIL_LINUX_ISO_H
+
+#include <stdbool.h>
+
+#include "c.h"
+
+static inline int isonum_721(unsigned char *p)
+{
+ return ((p[0] & 0xff)
+ | ((p[1] & 0xff) << 8));
+}
+
+static inline int isonum_722(unsigned char *p)
+{
+ return ((p[1] & 0xff)
+ | ((p[0] & 0xff) << 8));
+}
+
+static inline int isonum_723(unsigned char *p, bool check_match)
+{
+ int le = isonum_721(p);
+ int be = isonum_722(p + 2);
+
+ if (check_match && le != be)
+ /* translation is useless */
+ warnx("723error: le=%d be=%d", le, be);
+ return (le);
+}
+
+static inline int isonum_731(unsigned char *p)
+{
+ return ((p[0] & 0xff)
+ | ((p[1] & 0xff) << 8)
+ | ((p[2] & 0xff) << 16)
+ | ((p[3] & 0xff) << 24));
+}
+
+static inline int isonum_732(unsigned char *p)
+{
+ return ((p[3] & 0xff)
+ | ((p[2] & 0xff) << 8)
+ | ((p[1] & 0xff) << 16)
+ | ((p[0] & 0xff) << 24));
+}
+
+static inline int isonum_733(unsigned char *p, bool check_match)
+{
+ int le = isonum_731(p);
+ int be = isonum_732(p + 4);
+
+ if (check_match && le != be)
+ /* translation is useless */
+ warnx("733error: le=%d be=%d", le, be);
+ return(le);
+}
+
+#endif