HelenOS sources
#ifndef UDF_UDF_VOLUME_H_
#define UDF_UDF_VOLUME_H_
#include <stdint.h>
#include <ipc/loc.h>
#include "udf_types.h"
#define UDF_TAG_PVD 0x0001
#define UDF_TAG_AVDP 0x0002
#define UDF_TAG_VDP 0x0003
#define UDF_TAG_IUVD 0x0004
#define UDF_TAG_PD 0x0005
#define UDF_TAG_LVD 0x0006
#define UDF_TAG_USD 0x0007
#define UDF_TAG_TD 0x0008
#define UDF_TAG_LVID 0x0009
#define UDF_AVDP_SECTOR 256
#define VRS_ADDR 32768
#define VRS_TYPE 0
#define VRS_VERSION 1
#define VRS_BEGIN "BEA01"
#define VRS_END "TEA01"
#define VRS_NSR2 "NSR02"
#define VRS_NSR3 "NSR03"
#define VRS_DEPTH 10
#define VRS_ID_LEN 5
typedef struct udf_vrs_descriptor {
uint8_t type;
uint8_t identifier[5];
uint8_t version;
uint8_t data[2041];
} __attribute__((packed)) udf_vrs_descriptor_t;
typedef struct udf_anchor_volume_descriptor {
udf_descriptor_tag_t tag;
udf_extent_t main_extent;
udf_extent_t reserve_extent;
uint8_t reserved[480];
} __attribute__((packed)) udf_anchor_volume_descriptor_t;
typedef struct udf_common_descriptor {
udf_descriptor_tag_t tag;
uint8_t reserved[496];
} __attribute__((packed)) udf_common_descriptor_t;
typedef struct udf_volume_pointer_descriptor {
udf_descriptor_tag_t tag;
uint32_t sequence_number;
udf_extent_t next_sequence;
uint8_t reserved[484];
} __attribute__((packed)) udf_volume_pointer_descriptor_t;
typedef struct udf_primary_volume_descriptor {
udf_descriptor_tag_t tag;
uint32_t sequence_number;
uint32_t primary_volume_descriptor_num;
udf_dstring volume_id[32];
uint16_t max_sequence_number;
uint16_t interchange_level;
uint16_t max_interchange_level;
uint32_t charset_list;
uint32_t max_charset_list;
udf_dstring volume_set_id[128];
udf_charspec_t descriptor_charset;
udf_charspec_t explanatory_charset;
udf_extent_t volume_abstract;
udf_extent_t volume_copyright_notice;
udf_regid_t application_id;
udf_timestamp_t recording_data_and_time;
udf_regid_t implementation_id;
uint8_t implementation_use[64];
uint32_t predecessor_vds_location;
uint16_t flags;
uint8_t reserved[22];
} __attribute__((packed)) udf_primary_volume_descriptor_t;
typedef struct udf_partition_descriptor {
udf_descriptor_tag_t tag;
uint32_t sequence_number;
uint16_t flags;
uint16_t number;
udf_regid_t contents;
uint8_t contents_use[128];
uint32_t access_type;
uint32_t starting_location;
uint32_t length;
udf_regid_t implementation_id;
uint8_t implementation_use[128];
uint8_t reserved[156];
} __attribute__((packed)) udf_partition_descriptor_t;
typedef struct udf_logical_volume_descriptor {
udf_descriptor_tag_t tag;
uint32_t sequence_number;
udf_charspec_t charset;
udf_dstring logical_volume_id[128];
uint32_t logical_block_size;
udf_regid_t domain_id;
uint8_t logical_volume_conents_use[16];
uint32_t map_table_length;
uint32_t number_of_partitions_maps;
udf_regid_t implementation_id;
uint8_t implementation_use[128];
udf_extent_t integrity_sequence_extent;
uint8_t partition_map[0];
} __attribute__((packed)) udf_logical_volume_descriptor_t;
typedef struct udf_volume_descriptor {
union {
udf_common_descriptor_t common;
udf_terminating_descriptor_t terminating;
udf_volume_pointer_descriptor_t pointer;
udf_partition_descriptor_t partition;
udf_logical_volume_descriptor_t logical;
udf_unallocated_space_descriptor_t unallocated;
udf_primary_volume_descriptor_t volume;
};
} __attribute__((packed)) udf_volume_descriptor_t;
typedef struct udf_general_type {
uint8_t partition_map_type;
uint8_t partition_map_length;
} __attribute__((packed)) udf_general_type_t;
typedef struct udf_type1_partition_map {
uint8_t partition_map_type;
uint8_t partition_map_length;
uint16_t volume_sequence_number;
uint16_t partition_number;
} __attribute__((packed)) udf_type1_partition_map_t;
typedef struct udf_type2_partition_map {
uint8_t partition_map_type;
uint8_t partition_map_length;
uint8_t reserved1[2];
udf_regid_t partition_ident;
uint16_t volume_sequence_number;
uint16_t partition_number;
} __attribute__((packed)) udf_type2_partition_map_t;
typedef struct udf_metadata_partition_map {
uint8_t partition_map_type;
uint8_t partition_map_length;
uint8_t reserved1[2];
udf_regid_t partition_ident;
uint16_t volume_sequence_number;
uint16_t partition_number;
uint32_t metadata_fileloc;
uint32_t metadata_mirror_fileloc;
uint32_t metadata_bitmap_fileloc;
uint32_t alloc_unit_size;
uint16_t align_unit_size;
uint8_t flags;
uint8_t reserved2[5];
} __attribute__((packed)) udf_metadata_partition_map_t;
typedef struct udf_partition_header_descriptor {
udf_short_ad_t unallocated_space_table;
udf_short_ad_t unallocated_space_bitmap;
udf_short_ad_t partition_integrity_table;
udf_short_ad_t freed_space_table;
udf_short_ad_t freed_space_bitmap;
uint8_t reserved[88];
} __attribute__((packed)) udf_partition_header_descriptor_t;
extern errno_t udf_volume_recongnition(service_id_t);
extern errno_t udf_get_anchor_volume_descriptor(service_id_t,
udf_anchor_volume_descriptor_t *);
extern errno_t udf_read_volume_descriptor_sequence(service_id_t, udf_extent_t);
extern fs_index_t udf_long_ad_to_pos(udf_instance_t *, udf_long_ad_t *);
#endif
HelenOS homepage, sources at GitHub