summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bswap.h28
-rw-r--r--include/config.in33
-rw-r--r--include/ecma_167.h7
-rw-r--r--include/libudffs.h12
-rw-r--r--include/osta_udf.h15
-rw-r--r--include/udf_endian.h104
6 files changed, 49 insertions, 150 deletions
diff --git a/include/bswap.h b/include/bswap.h
index 00627fa..8cfc7ff 100644
--- a/include/bswap.h
+++ b/include/bswap.h
@@ -1,7 +1,7 @@
/*
* bswap.h
*
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
+ * Copyright (c) 2001-2002 Ben Fennema
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -25,23 +25,9 @@
#include "config.h"
-#include <inttypes.h>
+#include <stdint.h>
#include <sys/types.h>
-#ifdef HAVE_SYS_ISA_DEFS_H
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-#define __PDP_ENDIAN 3412
-
-#ifdef _LITTLE_ENDIAN
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-
-#ifdef _BIG_ENDIAN
-#define __BYTE_ORDER __BIG_ENDIAN
-#endif
-#endif
-
#define constant_swab16(x) \
((uint16_t)((((uint16_t)(x) & 0x00FFU) << 8) | \
(((uint16_t)(x) & 0xFF00U) >> 8)))
@@ -135,11 +121,7 @@ static inline uint64_t swab64p(uint64_t *x)
((*(uint64_t *)(x) & 0xFF00000000000000ULL) >> 56)));
}
-#if __BYTE_ORDER == 0
-
-#error "__BYTE_ORDER must be defined"
-
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
#define le16_to_cpu(x) (__builtin_constant_p(x) ? \
constant_swab16(x) : \
@@ -190,7 +172,7 @@ static inline uint64_t swab64p(uint64_t *x)
#define constant_be32_to_cpup(x) (*(uint32_t *)(x))
#define constant_be64_to_cpup(x) (*(uint64_t *)(x))
-#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#else /* WORDS_BIGENDIAN */
#define le16_to_cpu(x) ((uint16_t)(x))
#define le32_to_cpu(x) ((uint32_t)(x))
@@ -241,7 +223,7 @@ static inline uint64_t swab64p(uint64_t *x)
#define constant_be32_to_cpup(x) constant_swab32p((x))
#define constant_be64_to_cpup(x) constant_swab64p((x))
-#endif /* __BYTE_ORDER == 0 */
+#endif /* WORDS_BIGENDIAN */
#define cpu_to_le16(x) le16_to_cpu((x))
#define cpu_to_le32(x) le32_to_cpu((x))
diff --git a/include/config.in b/include/config.in
index c92956c..f43bb67 100644
--- a/include/config.in
+++ b/include/config.in
@@ -1,20 +1,20 @@
/* include/config.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#undef HAVE_READLINE_READLINE_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -30,9 +30,6 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
@@ -66,15 +63,21 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
/* Version number of package */
#undef VERSION
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
diff --git a/include/ecma_167.h b/include/ecma_167.h
index 9ef146c..8459aae 100644
--- a/include/ecma_167.h
+++ b/include/ecma_167.h
@@ -4,8 +4,8 @@
* This file is based on ECMA-167 3rd edition (June 1997)
* http://www.ecma.ch
*
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
- * Copyright (c) 2017 Pali Rohár <pali.rohar@gmail.com>
+ * Copyright (c) 2001-2002 Ben Fennema
+ * Copyright (c) 2017-2018 Pali Rohár <pali.rohar@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@
* ECMA-167r3 defines and structure definitions
*/
-#include <inttypes.h>
+#include <stdint.h>
#ifndef _ECMA_167_H
#define _ECMA_167_H 1
@@ -746,6 +746,7 @@ struct appUseExtAttr
#define EXTATTR_DEV_SPEC 12
#define EXTATTR_IMP_USE 2048
#define EXTATTR_APP_USE 65536
+#define EXTATTR_SUBTYPE 1
/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
diff --git a/include/libudffs.h b/include/libudffs.h
index 3f1abe3..fe88ca9 100644
--- a/include/libudffs.h
+++ b/include/libudffs.h
@@ -1,8 +1,8 @@
/*
* libudffs.h
*
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
- * Copyright (c) 2014-2017 Pali Rohár <pali.rohar@gmail.com>
+ * Copyright (c) 2001-2002 Ben Fennema
+ * Copyright (c) 2014-2018 Pali Rohár <pali.rohar@gmail.com>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -29,9 +29,11 @@
#ifndef __LIBUDFFS_H
#define __LIBUDFFS_H
+#include <stddef.h>
+
#include "ecma_167.h"
#include "osta_udf.h"
-#include "udf_endian.h"
+#include "bswap.h"
#define FLAG_FREED_BITMAP 0x00000001
#define FLAG_FREED_TABLE 0x00000002
@@ -130,6 +132,7 @@ struct udf_disc
struct primaryVolDesc *udf_pvd[2];
struct logicalVolDesc *udf_lvd[2];
struct partitionDesc *udf_pd[2];
+ struct partitionDesc *udf_pd2[2];
struct unallocSpaceDesc *udf_usd[2];
struct impUseVolDesc *udf_iuvd[2];
struct terminatingDesc *udf_td[2];
@@ -231,5 +234,8 @@ extern size_t encode_string(struct udf_disc *, dstring *, const char *, size_t);
/* misc.c */
extern const char *appname;
size_t gen_uuid_from_vol_set_ident(char[17], const dstring *, size_t);
+uint32_t strtou32(const char *, int, int *);
+uint16_t strtou16(const char *, int, int *);
+uint32_t randu32(void);
#endif /* __LIBUDFFS_H */
diff --git a/include/osta_udf.h b/include/osta_udf.h
index 413c816..39d46fe 100644
--- a/include/osta_udf.h
+++ b/include/osta_udf.h
@@ -4,8 +4,8 @@
* This file is based on OSTA UDF(tm) 2.01 (March 15, 2000)
* http://www.osta.org
*
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
- * Copyright (c) 2017 Pali Rohár <pali.rohar@gmail.com>
+ * Copyright (c) 2001-2002 Ben Fennema
+ * Copyright (c) 2017-2018 Pali Rohár <pali.rohar@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,6 +55,7 @@
#define UDF_ID_FREE_EA "*UDF FreeEASpace"
#define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace"
#define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info"
+#define UDF_ID_VAT_LVEXTENSION "*UDF VAT LVExtension"
#define UDF_ID_OS2_EA "*UDF OS/2 EA"
#define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength"
#define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo"
@@ -231,6 +232,16 @@ struct DVDCopyrightImpUse
uint8_t protectionSystemInfo[4];
} __attribute__ ((packed));
+/* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */
+struct LVExtensionEA
+{
+ uint16_t headerChecksum;
+ uint64_t verificationID;
+ uint32_t numFiles;
+ uint32_t numDirs;
+ dstring logicalVolIdent[128];
+} __attribute__ ((packed));
+
/* Application Use Extended Attribute (UDF 2.01 3.3.4.6) */
/* FreeAppEASpace (UDF 2.01 3.3.4.6.1) */
struct freeAppEASpace
diff --git a/include/udf_endian.h b/include/udf_endian.h
deleted file mode 100644
index daa0e3d..0000000
--- a/include/udf_endian.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * udf_endian.h
- *
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef __UDF_ENDIAN_H
-#define __UDF_ENDIAN_H
-
-#include <string.h>
-
-#include "bswap.h"
-
-static inline lb_addr lelb_to_cpu(lb_addr in)
-{
- 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(lb_addr in)
-{
- lb_addr out;
- out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
- out.partitionReferenceNum = cpu_to_le16(in.partitionReferenceNum);
- return out;
-}
-
-static inline timestamp lets_to_cpu(timestamp in)
-{
- 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 long_ad lela_to_cpu(long_ad in)
-{
- 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(long_ad in)
-{
- long_ad out;
- out.extLength = cpu_to_le32(in.extLength);
- out.extLocation = cpu_to_lelb(in.extLocation);
- return out;
-}
-
-static inline extent_ad leea_to_cpu(extent_ad in)
-{
- 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(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 */