linux/fs/udf/ecma_167.h

/*
 * ecma_167.h
 *
 * This file is based on ECMA-167 3rd edition (June 1997)
 * https://www.ecma.ch
 *
 * Copyright (c) 2001-2002  Ben Fennema
 * Copyright (c) 2017-2019  Pali Rohár <[email protected]>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU Public License ("GPL").
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/**
 * @file
 * ECMA-167r3 defines and structure definitions
 */

#include <linux/types.h>

#ifndef _ECMA_167_H
#define _ECMA_167_H

/* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */
dchars;

/* Character set specification (ECMA 167r3 1/7.2.1) */
struct charspec {} __packed;

/* Character Set Type (ECMA 167r3 1/7.2.1.1) */
#define CHARSPEC_TYPE_CS0
#define CHARSPEC_TYPE_CS1
#define CHARSPEC_TYPE_CS2
#define CHARSPEC_TYPE_CS3
#define CHARSPEC_TYPE_CS4
#define CHARSPEC_TYPE_CS5
#define CHARSPEC_TYPE_CS6
#define CHARSPEC_TYPE_CS7
#define CHARSPEC_TYPE_CS8

/* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */
dstring;

/* Timestamp (ECMA 167r3 1/7.3) */
struct timestamp {} __packed;

/* Type and Time Zone (ECMA 167r3 1/7.3.1) */
#define TIMESTAMP_TYPE_MASK
#define TIMESTAMP_TYPE_CUT
#define TIMESTAMP_TYPE_LOCAL
#define TIMESTAMP_TYPE_AGREEMENT
#define TIMESTAMP_TIMEZONE_MASK

/* Entity identifier (ECMA 167r3 1/7.4) */
struct regid {} __packed;

/* Flags (ECMA 167r3 1/7.4.1) */
#define ENTITYID_FLAGS_DIRTY
#define ENTITYID_FLAGS_PROTECTED

/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN
struct volStructDesc {} __packed;

/* Standard Identifier (EMCA 167r2 2/9.1.2) */
#define VSD_STD_ID_NSR02

/* Standard Identifier (ECMA 167r3 2/9.1.2) */
#define VSD_STD_ID_BEA01
#define VSD_STD_ID_BOOT2
#define VSD_STD_ID_CD001
#define VSD_STD_ID_CDW02
#define VSD_STD_ID_NSR03
#define VSD_STD_ID_TEA01

/* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
struct beginningExtendedAreaDesc {} __packed;

/* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
struct terminatingExtendedAreaDesc {} __packed;

/* Boot Descriptor (ECMA 167r3 2/9.4) */
struct bootDesc {} __packed;

/* Flags (ECMA 167r3 2/9.4.12) */
#define BOOT_FLAGS_ERASE

/* Extent Descriptor (ECMA 167r3 3/7.1) */
struct extent_ad {} __packed;

struct kernel_extent_ad {};

/* Descriptor Tag (ECMA 167r3 3/7.2) */
struct tag {} __packed;

/* Tag Identifier (ECMA 167r3 3/7.2.1) */
#define TAG_IDENT_PVD
#define TAG_IDENT_AVDP
#define TAG_IDENT_VDP
#define TAG_IDENT_IUVD
#define TAG_IDENT_PD
#define TAG_IDENT_LVD
#define TAG_IDENT_USD
#define TAG_IDENT_TD
#define TAG_IDENT_LVID

/* NSR Descriptor (ECMA 167r3 3/9.1) */
struct NSRDesc {} __packed;

/* Generic Descriptor */
struct genericDesc {} __packed;

/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
struct primaryVolDesc {} __packed;

/* Flags (ECMA 167r3 3/10.1.21) */
#define PVD_FLAGS_VSID_COMMON

/* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */
struct anchorVolDescPtr {} __packed;

/* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
struct volDescPtr {} __packed;

/* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
struct impUseVolDesc {} __packed;

/* Partition Descriptor (ECMA 167r3 3/10.5) */
struct partitionDesc {} __packed;

/* Partition Flags (ECMA 167r3 3/10.5.3) */
#define PD_PARTITION_FLAGS_ALLOC

/* Partition Contents (ECMA 167r2 3/10.5.3) */
#define PD_PARTITION_CONTENTS_NSR02

/* Partition Contents (ECMA 167r3 3/10.5.5) */
#define PD_PARTITION_CONTENTS_FDC01
#define PD_PARTITION_CONTENTS_CD001
#define PD_PARTITION_CONTENTS_CDW02
#define PD_PARTITION_CONTENTS_NSR03

/* Access Type (ECMA 167r3 3/10.5.7) */
#define PD_ACCESS_TYPE_NONE
#define PD_ACCESS_TYPE_READ_ONLY
#define PD_ACCESS_TYPE_WRITE_ONCE
#define PD_ACCESS_TYPE_REWRITABLE
#define PD_ACCESS_TYPE_OVERWRITABLE

/* Logical Volume Descriptor (ECMA 167r3 3/10.6) */
struct logicalVolDesc {} __packed;

/* Generic Partition Map (ECMA 167r3 3/10.7.1) */
struct genericPartitionMap {} __packed;

/* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
#define GP_PARTITION_MAP_TYPE_UNDEF
#define GP_PARTITION_MAP_TYPE_1
#define GP_PARTITION_MAP_TYPE_2

/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
struct genericPartitionMap1 {} __packed;

/* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
struct genericPartitionMap2 {} __packed;

/* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
struct unallocSpaceDesc {} __packed;

/* Terminating Descriptor (ECMA 167r3 3/10.9) */
struct terminatingDesc {} __packed;

/* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
struct logicalVolIntegrityDesc {} __packed;

/* Integrity Type (ECMA 167r3 3/10.10.3) */
#define LVID_INTEGRITY_TYPE_OPEN
#define LVID_INTEGRITY_TYPE_CLOSE

/* Recorded Address (ECMA 167r3 4/7.1) */
struct lb_addr {} __packed;

/* ... and its in-core analog */
struct kernel_lb_addr {};

/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
struct short_ad {} __packed;

/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
struct long_ad {} __packed;

struct kernel_long_ad {};

/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
struct ext_ad {} __packed;

struct kernel_ext_ad {};

/* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */

/* Tag Identifier (ECMA 167r3 4/7.2.1) */
#define TAG_IDENT_FSD
#define TAG_IDENT_FID
#define TAG_IDENT_AED
#define TAG_IDENT_IE
#define TAG_IDENT_TE
#define TAG_IDENT_FE
#define TAG_IDENT_EAHD
#define TAG_IDENT_USE
#define TAG_IDENT_SBD
#define TAG_IDENT_PIE
#define TAG_IDENT_EFE

/* File Set Descriptor (ECMA 167r3 4/14.1) */
struct fileSetDesc {} __packed;

/* Partition Header Descriptor (ECMA 167r3 4/14.3) */
struct partitionHeaderDesc {} __packed;

/* File Identifier Descriptor (ECMA 167r3 4/14.4) */
struct fileIdentDesc {} __packed;

/* File Characteristics (ECMA 167r3 4/14.4.3) */
#define FID_FILE_CHAR_HIDDEN
#define FID_FILE_CHAR_DIRECTORY
#define FID_FILE_CHAR_DELETED
#define FID_FILE_CHAR_PARENT
#define FID_FILE_CHAR_METADATA

/* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */
struct allocExtDesc {} __packed;

/* ICB Tag (ECMA 167r3 4/14.6) */
struct icbtag {} __packed;

/* Strategy Type (ECMA 167r3 4/14.6.2) */
#define ICBTAG_STRATEGY_TYPE_UNDEF
#define ICBTAG_STRATEGY_TYPE_1
#define ICBTAG_STRATEGY_TYPE_2
#define ICBTAG_STRATEGY_TYPE_3
#define ICBTAG_STRATEGY_TYPE_4

/* File Type (ECMA 167r3 4/14.6.6) */
#define ICBTAG_FILE_TYPE_UNDEF
#define ICBTAG_FILE_TYPE_USE
#define ICBTAG_FILE_TYPE_PIE
#define ICBTAG_FILE_TYPE_IE
#define ICBTAG_FILE_TYPE_DIRECTORY
#define ICBTAG_FILE_TYPE_REGULAR
#define ICBTAG_FILE_TYPE_BLOCK
#define ICBTAG_FILE_TYPE_CHAR
#define ICBTAG_FILE_TYPE_EA
#define ICBTAG_FILE_TYPE_FIFO
#define ICBTAG_FILE_TYPE_SOCKET
#define ICBTAG_FILE_TYPE_TE
#define ICBTAG_FILE_TYPE_SYMLINK
#define ICBTAG_FILE_TYPE_STREAMDIR

/* Flags (ECMA 167r3 4/14.6.8) */
#define ICBTAG_FLAG_AD_MASK
#define ICBTAG_FLAG_AD_SHORT
#define ICBTAG_FLAG_AD_LONG
#define ICBTAG_FLAG_AD_EXTENDED
#define ICBTAG_FLAG_AD_IN_ICB
#define ICBTAG_FLAG_SORTED
#define ICBTAG_FLAG_NONRELOCATABLE
#define ICBTAG_FLAG_ARCHIVE
#define ICBTAG_FLAG_SETUID
#define ICBTAG_FLAG_SETGID
#define ICBTAG_FLAG_STICKY
#define ICBTAG_FLAG_CONTIGUOUS
#define ICBTAG_FLAG_SYSTEM
#define ICBTAG_FLAG_TRANSFORMED
#define ICBTAG_FLAG_MULTIVERSIONS
#define ICBTAG_FLAG_STREAM

/* Indirect Entry (ECMA 167r3 4/14.7) */
struct indirectEntry {} __packed;

/* Terminal Entry (ECMA 167r3 4/14.8) */
struct terminalEntry {} __packed;

/* File Entry (ECMA 167r3 4/14.9) */
struct fileEntry {} __packed;

/* Permissions (ECMA 167r3 4/14.9.5) */
#define FE_PERM_O_EXEC
#define FE_PERM_O_WRITE
#define FE_PERM_O_READ
#define FE_PERM_O_CHATTR
#define FE_PERM_O_DELETE
#define FE_PERM_G_EXEC
#define FE_PERM_G_WRITE
#define FE_PERM_G_READ
#define FE_PERM_G_CHATTR
#define FE_PERM_G_DELETE
#define FE_PERM_U_EXEC
#define FE_PERM_U_WRITE
#define FE_PERM_U_READ
#define FE_PERM_U_CHATTR
#define FE_PERM_U_DELETE

/* Record Format (ECMA 167r3 4/14.9.7) */
#define FE_RECORD_FMT_UNDEF
#define FE_RECORD_FMT_FIXED_PAD
#define FE_RECORD_FMT_FIXED
#define FE_RECORD_FMT_VARIABLE8
#define FE_RECORD_FMT_VARIABLE16
#define FE_RECORD_FMT_VARIABLE16_MSB
#define FE_RECORD_FMT_VARIABLE32
#define FE_RECORD_FMT_PRINT
#define FE_RECORD_FMT_LF
#define FE_RECORD_FMT_CR
#define FE_RECORD_FMT_CRLF
#define FE_RECORD_FMT_LFCR

/* Record Display Attributes (ECMA 167r3 4/14.9.8) */
#define FE_RECORD_DISPLAY_ATTR_UNDEF
#define FE_RECORD_DISPLAY_ATTR_1
#define FE_RECORD_DISPLAY_ATTR_2
#define FE_RECORD_DISPLAY_ATTR_3

/* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */
struct extendedAttrHeaderDesc {} __packed;

/* Generic Format (ECMA 167r3 4/14.10.2) */
struct genericFormat {} __packed;

/* Character Set Information (ECMA 167r3 4/14.10.3) */
struct charSetInfo {} __packed;

/* Alternate Permissions (ECMA 167r3 4/14.10.4) */
struct altPerms {} __packed;

/* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
struct fileTimesExtAttr {} __packed;

/* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
#define FTE_CREATION
#define FTE_DELETION
#define FTE_EFFECTIVE
#define FTE_BACKUP

/* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */
struct infoTimesExtAttr {} __packed;

/* Device Specification (ECMA 167r3 4/14.10.7) */
struct deviceSpec {} __packed;

/* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
struct impUseExtAttr {} __packed;

/* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
struct appUseExtAttr {} __packed;

#define EXTATTR_CHAR_SET
#define EXTATTR_ALT_PERMS
#define EXTATTR_FILE_TIMES
#define EXTATTR_INFO_TIMES
#define EXTATTR_DEV_SPEC
#define EXTATTR_IMP_USE
#define EXTATTR_APP_USE
#define EXTATTR_SUBTYPE

/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
struct unallocSpaceEntry {} __packed;

/* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
struct spaceBitmapDesc {} __packed;

/* Partition Integrity Entry (ECMA 167r3 4/14.13) */
struct partitionIntegrityEntry {} __packed;

/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */

/* Extent Length (ECMA 167r3 4/14.14.1.1) */
#define EXT_LENGTH_MASK
#define EXT_TYPE_MASK
#define EXT_RECORDED_ALLOCATED
#define EXT_NOT_RECORDED_ALLOCATED
#define EXT_NOT_RECORDED_NOT_ALLOCATED
#define EXT_NEXT_EXTENT_ALLOCDESCS

/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */

/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */

/* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */
struct logicalVolHeaderDesc {} __packed;

/* Path Component (ECMA 167r3 4/14.16.1) */
struct pathComponent {} __packed;

/* File Entry (ECMA 167r3 4/14.17) */
struct extendedFileEntry {} __packed;

#endif /* _ECMA_167_H */