1N/A/*
1N/A * ISO 9660 filesystem backend for GRUB (GRand Unified Bootloader)
1N/A * including Rock Ridge Extensions support
1N/A *
1N/A * Copyright (C) 1998, 1999 Kousuke Takai <tak@kmc.kyoto-u.ac.jp>
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program; if not, write to the Free Software
1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1N/A */
1N/A/*
1N/A * References:
1N/A * linux/fs/isofs/rock.[ch]
1N/A * mkisofs-1.11.1/diag/isoinfo.c
1N/A * mkisofs-1.11.1/iso9660.h
1N/A * (all are written by Eric Youngdale)
1N/A */
1N/A
1N/A#ifndef _ISO9660_H_
1N/A#define _ISO9660_H_
1N/A
1N/A#define ISO_SECTOR_BITS (11)
1N/A#define ISO_SECTOR_SIZE (1<<ISO_SECTOR_BITS)
1N/A
1N/A#define ISO_REGULAR 1 /* regular file */
1N/A#define ISO_DIRECTORY 2 /* directory */
1N/A#define ISO_OTHER 0 /* other file (with Rock Ridge) */
1N/A
1N/A#define RR_FLAG_PX 0x01 /* have POSIX file attributes */
1N/A#define RR_FLAG_PN 0x02 /* POSIX devices */
1N/A#define RR_FLAG_SL 0x04 /* Symbolic link */
1N/A#define RR_FLAG_NM 0x08 /* have alternate file name */
1N/A#define RR_FLAG_CL 0x10 /* Child link */
1N/A#define RR_FLAG_PL 0x20 /* Parent link */
1N/A#define RR_FLAG_RE 0x40 /* Relocation directory */
1N/A#define RR_FLAG_TF 0x80 /* Timestamps */
1N/A
1N/A/* POSIX file attributes for Rock Ridge extensions */
1N/A#define POSIX_S_IFMT 0xF000
1N/A#define POSIX_S_IFREG 0x8000
1N/A#define POSIX_S_IFDIR 0x4000
1N/A
1N/A/* volume descriptor types */
1N/A#define ISO_VD_PRIMARY 1
1N/A#define ISO_VD_END 255
1N/A
1N/A#define ISO_STANDARD_ID "CD001"
1N/A
1N/A#ifndef ASM_FILE
1N/A
1N/A#ifndef __sun
1N/A#ifndef __BIT_TYPES_DEFINED__
1N/Atypedef int int8_t __attribute__((mode(QI)));
1N/Atypedef unsigned int u_int8_t __attribute__((mode(QI)));
1N/Atypedef int int16_t __attribute__((mode(HI)));
1N/Atypedef unsigned int u_int16_t __attribute__((mode(HI)));
1N/Atypedef int int32_t __attribute__((mode(SI)));
1N/Atypedef unsigned int u_int32_t __attribute__((mode(SI)));
1N/A#endif
1N/A#else
1N/A#ifndef GRUB_UTIL
1N/Atypedef char int8_t;
1N/Atypedef short int16_t;
1N/Atypedef int int32_t;
1N/A#endif /* ! GRUB_UTIL */
1N/Atypedef unsigned char u_int8_t;
1N/Atypedef unsigned short u_int16_t;
1N/Atypedef unsigned int u_int32_t;
1N/A#endif /* __sun */
1N/A
1N/Atypedef union {
1N/A u_int8_t l,b;
1N/A} iso_8bit_t;
1N/A
1N/Astruct __iso_16bit {
1N/A u_int16_t l, b;
1N/A} __attribute__ ((packed));
1N/Atypedef struct __iso_16bit iso_16bit_t;
1N/A
1N/Astruct __iso_32bit {
1N/A u_int32_t l, b;
1N/A} __attribute__ ((packed));
1N/Atypedef struct __iso_32bit iso_32bit_t;
1N/A
1N/Atypedef u_int8_t iso_date_t[7];
1N/A
1N/Astruct iso_directory_record {
1N/A iso_8bit_t length;
1N/A iso_8bit_t ext_attr_length;
1N/A iso_32bit_t extent;
1N/A iso_32bit_t size;
1N/A iso_date_t date;
1N/A iso_8bit_t flags;
1N/A iso_8bit_t file_unit_size;
1N/A iso_8bit_t interleave;
1N/A iso_16bit_t volume_seq_number;
1N/A iso_8bit_t name_len;
1N/A u_int8_t name[1];
1N/A} __attribute__ ((packed));
1N/A
1N/Astruct iso_primary_descriptor {
1N/A iso_8bit_t type;
1N/A u_int8_t id[5];
1N/A iso_8bit_t version;
1N/A u_int8_t _unused1[1];
1N/A u_int8_t system_id[32];
1N/A u_int8_t volume_id[32];
1N/A u_int8_t _unused2[8];
1N/A iso_32bit_t volume_space_size;
1N/A u_int8_t _unused3[32];
1N/A iso_16bit_t volume_set_size;
1N/A iso_16bit_t volume_seq_number;
1N/A iso_16bit_t logical_block_size;
1N/A iso_32bit_t path_table_size;
1N/A u_int8_t type_l_path_table[4];
1N/A u_int8_t opt_type_l_path_table[4];
1N/A u_int8_t type_m_path_table[4];
1N/A u_int8_t opt_type_m_path_table[4];
1N/A struct iso_directory_record root_directory_record;
1N/A u_int8_t volume_set_id[128];
1N/A u_int8_t publisher_id[128];
1N/A u_int8_t preparer_id[128];
1N/A u_int8_t application_id[128];
1N/A u_int8_t copyright_file_id[37];
1N/A u_int8_t abstract_file_id[37];
1N/A u_int8_t bibliographic_file_id[37];
1N/A u_int8_t creation_date[17];
1N/A u_int8_t modification_date[17];
1N/A u_int8_t expiration_date[17];
1N/A u_int8_t effective_date[17];
1N/A iso_8bit_t file_structure_version;
1N/A u_int8_t _unused4[1];
1N/A u_int8_t application_data[512];
1N/A u_int8_t _unused5[653];
1N/A} __attribute__ ((packed));
1N/A
1N/Astruct rock_ridge {
1N/A u_int16_t signature;
1N/A u_int8_t len;
1N/A u_int8_t version;
1N/A union {
1N/A struct SP {
1N/A u_int16_t magic;
1N/A u_int8_t skip;
1N/A } sp;
1N/A struct CE {
1N/A iso_32bit_t extent;
1N/A iso_32bit_t offset;
1N/A iso_32bit_t size;
1N/A } ce;
1N/A struct ER {
1N/A u_int8_t len_id;
1N/A u_int8_t len_des;
1N/A u_int8_t len_src;
1N/A u_int8_t ext_ver;
1N/A u_int8_t data[0];
1N/A } er;
1N/A struct RR {
1N/A iso_8bit_t flags;
1N/A } rr;
1N/A struct PX {
1N/A iso_32bit_t mode;
1N/A iso_32bit_t nlink;
1N/A iso_32bit_t uid;
1N/A iso_32bit_t gid;
1N/A } px;
1N/A struct PN {
1N/A iso_32bit_t dev_high;
1N/A iso_32bit_t dev_low;
1N/A } pn;
1N/A struct SL {
1N/A iso_8bit_t flags;
1N/A struct SL_component {
1N/A iso_8bit_t flags;
1N/A u_int8_t len;
1N/A u_int8_t text[0];
1N/A } link;
1N/A } sl;
1N/A struct NM {
1N/A iso_8bit_t flags;
1N/A u_int8_t name[0];
1N/A } nm;
1N/A struct CL {
1N/A iso_32bit_t location;
1N/A } cl;
1N/A struct PL {
1N/A iso_32bit_t location;
1N/A } pl;
1N/A struct TF {
1N/A iso_8bit_t flags;
1N/A iso_date_t times[0];
1N/A } tf;
1N/A } u;
1N/A} __attribute__ ((packed));
1N/A
1N/Atypedef union RR_ptr {
1N/A struct rock_ridge *rr;
1N/A char *ptr;
1N/A int i;
1N/A} RR_ptr_t;
1N/A
1N/A#define RRMAGIC(c1, c2) ((c1)|(c2) << 8)
1N/A
1N/A#define CHECK2(ptr, c1, c2) \
1N/A (*(unsigned short *)(ptr) == (((c1) | (c2) << 8) & 0xFFFF))
1N/A
1N/A#endif /* !ASM_FILE */
1N/A
1N/A#endif /* _ISO9660_H_ */