2003-08-17 05:31:19 +00:00
|
|
|
|
/*
|
2003-09-01 02:08:59 +00:00
|
|
|
|
$Id: iso9660.h,v 1.14 2003/09/01 02:08:59 rocky Exp $
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
See also iso9660.h by Eric Youngdale (1993).
|
|
|
|
|
|
|
|
|
|
|
|
Copyright 1993 Yggdrasil Computing, Incorporated
|
|
|
|
|
|
Copyright (c) 1999,2000 J. Schilling
|
|
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
*/
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* Header file iso9660.h - assorted structure definitions and typecasts.
|
|
|
|
|
|
specific to iso9660 filesystem.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
#ifndef __CDIO_ISO9660_H__
|
|
|
|
|
|
#define __CDIO_ISO9660_H__
|
|
|
|
|
|
|
2003-08-31 06:59:23 +00:00
|
|
|
|
#include <cdio/cdio.h>
|
2003-08-31 07:39:45 +00:00
|
|
|
|
#include <cdio/xa.h>
|
2003-08-31 06:59:23 +00:00
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
#define MIN_TRACK_SIZE 4*75
|
|
|
|
|
|
#define MIN_ISO_SIZE MIN_TRACK_SIZE
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/*
|
|
|
|
|
|
A ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #>
|
|
|
|
|
|
|
|
|
|
|
|
The maximum needed string length is:
|
|
|
|
|
|
30 chars (filename + ext)
|
|
|
|
|
|
+ 2 chars ('.' + ';')
|
|
|
|
|
|
+ strlen("32767")
|
|
|
|
|
|
+ null byte
|
|
|
|
|
|
================================
|
|
|
|
|
|
= 38 chars
|
|
|
|
|
|
*/
|
2003-08-17 05:31:19 +00:00
|
|
|
|
#define LEN_ISONAME 31
|
|
|
|
|
|
#define MAX_ISONAME 37
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_ISOPATHNAME 255
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* ISO 9660 directory flags.
|
|
|
|
|
|
*/
|
|
|
|
|
|
#define ISO_FILE 0 /* Not really a flag... */
|
|
|
|
|
|
#define ISO_EXISTENCE 1 /* Do not make existence known (hidden) */
|
|
|
|
|
|
#define ISO_DIRECTORY 2 /* This file is a directory */
|
|
|
|
|
|
#define ISO_ASSOCIATED 4 /* This file is an assiciated file */
|
|
|
|
|
|
#define ISO_RECORD 8 /* Record format in extended attr. != 0 */
|
|
|
|
|
|
#define ISO_PROTECTION 16 /* No read/execute perm. in ext. attr. */
|
|
|
|
|
|
#define ISO_DRESERVED1 32 /* Reserved bit 5 */
|
|
|
|
|
|
#define ISO_DRESERVED2 64 /* Reserved bit 6 */
|
|
|
|
|
|
#define ISO_MULTIEXTENT 128 /* Not final entry of a mult. ext. file */
|
|
|
|
|
|
|
|
|
|
|
|
/* Volume descriptor types */
|
|
|
|
|
|
#define ISO_VD_PRIMARY 1
|
|
|
|
|
|
#define ISO_VD_SUPPLEMENTARY 2 /* Used by Joliet */
|
|
|
|
|
|
#define ISO_VD_END 255
|
|
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
#define ISO_PVD_SECTOR 16
|
|
|
|
|
|
#define ISO_EVD_SECTOR 17
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
#define ISO_STANDARD_ID "CD001"
|
2003-08-31 03:35:36 +00:00
|
|
|
|
#define ISO_BLOCKSIZE 2048
|
|
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
enum strncpy_pad_check {
|
|
|
|
|
|
ISO9660_NOCHECK = 0,
|
|
|
|
|
|
ISO9660_7BIT,
|
|
|
|
|
|
ISO9660_ACHARS,
|
|
|
|
|
|
ISO9660_DCHARS
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2003-08-31 05:00:44 +00:00
|
|
|
|
PRAGMA_BEGIN_PACKED
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/* ISO-9660 Primary Volume Descriptor.
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef struct iso9660_pvd {
|
|
|
|
|
|
uint8_t type; /* 711 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char id[5];
|
2003-09-01 02:08:59 +00:00
|
|
|
|
uint8_t version; /* 711 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char unused1[1];
|
2003-09-01 02:08:59 +00:00
|
|
|
|
char system_id[32]; /* achars */
|
|
|
|
|
|
char volume_id[32]; /* dchars */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char unused2[8];
|
2003-09-01 02:08:59 +00:00
|
|
|
|
uint64_t volume_space_size; /* 733 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char escape_sequences[32];
|
2003-09-01 02:08:59 +00:00
|
|
|
|
uint32_t volume_set_size; /* 723 */
|
|
|
|
|
|
uint32_t volume_sequence_number; /* 723 */
|
|
|
|
|
|
uint32_t logical_block_size; /* 723 */
|
|
|
|
|
|
uint64_t path_table_size; /* 733 */
|
|
|
|
|
|
uint32_t type_l_path_table; /* 731 */
|
|
|
|
|
|
uint32_t opt_type_l_path_table; /* 731 */
|
|
|
|
|
|
uint32_t type_m_path_table; /* 732 */
|
|
|
|
|
|
uint32_t opt_type_m_path_table; /* 732 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char root_directory_record[34]; /* 9.1 */
|
2003-09-01 02:08:59 +00:00
|
|
|
|
char volume_set_id[128]; /* dchars */
|
|
|
|
|
|
char publisher_id[128]; /* achars */
|
|
|
|
|
|
char preparer_id[128]; /* achars */
|
|
|
|
|
|
char application_id[128]; /* achars */
|
|
|
|
|
|
char copyright_file_id[37]; /* 7.5 dchars */
|
|
|
|
|
|
char abstract_file_id[37]; /* 7.5 dchars */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char bibliographic_file_id[37]; /* 7.5 dchars */
|
2003-09-01 02:08:59 +00:00
|
|
|
|
char creation_date[17]; /* 8.4.26.1 */
|
|
|
|
|
|
char modification_date[17]; /* 8.4.26.1 */
|
|
|
|
|
|
char expiration_date[17]; /* 8.4.26.1 */
|
|
|
|
|
|
char effective_date[17]; /* 8.4.26.1 */
|
|
|
|
|
|
uint8_t file_structure_version; /* 711 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char unused4[1];
|
|
|
|
|
|
char application_data[512];
|
|
|
|
|
|
char unused5[653];
|
2003-09-01 02:08:59 +00:00
|
|
|
|
} iso9660_pvd_t GNUC_PACKED;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct iso9660_dir iso9660_dir_t;
|
2003-08-31 05:00:44 +00:00
|
|
|
|
|
2003-08-31 09:32:24 +00:00
|
|
|
|
#ifndef EMPTY_ARRAY_SIZE
|
|
|
|
|
|
#define EMPTY_ARRAY_SIZE 0
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/*
|
|
|
|
|
|
* XXX JS: The next structure may have an odd length!
|
|
|
|
|
|
* Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.
|
|
|
|
|
|
* For this reason, we cannot use sizeof (struct iso_path_table) or
|
|
|
|
|
|
* sizeof (struct iso_directory_record) to compute on disk sizes.
|
|
|
|
|
|
* Instead, we use offsetof(..., name) and add the name size.
|
|
|
|
|
|
* See mkisofs.h
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Format of an ISO-9660 directory record */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
struct iso9660_dir {
|
2003-09-01 02:08:59 +00:00
|
|
|
|
uint8_t length; /* 711 */
|
|
|
|
|
|
uint8_t ext_attr_length; /* 711 */
|
|
|
|
|
|
uint64_t extent; /* 733 */
|
|
|
|
|
|
uint64_t size; /* 733 */
|
|
|
|
|
|
uint8_t date[7]; /* 7 by 711 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
uint8_t flags;
|
2003-09-01 02:08:59 +00:00
|
|
|
|
uint8_t file_unit_size; /* 711 */
|
|
|
|
|
|
uint8_t interleave; /* 711 */
|
|
|
|
|
|
uint32_t volume_sequence_number; /* 723 */
|
|
|
|
|
|
uint8_t name_len; /* 711 */
|
2003-08-31 05:00:44 +00:00
|
|
|
|
char name[EMPTY_ARRAY_SIZE];
|
|
|
|
|
|
} GNUC_PACKED;
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
typedef struct iso9660_stat { /* big endian!! */
|
2003-08-31 07:39:45 +00:00
|
|
|
|
enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
|
2003-09-01 02:08:59 +00:00
|
|
|
|
lsn_t lsn; /* start logical sector number */
|
|
|
|
|
|
uint32_t size; /* total size in bytes */
|
|
|
|
|
|
uint32_t secsize; /* number of sectors allocated */
|
|
|
|
|
|
iso9660_xa_t xa; /* XA attributes */
|
|
|
|
|
|
} iso9660_stat_t;
|
2003-08-31 05:00:44 +00:00
|
|
|
|
|
|
|
|
|
|
PRAGMA_END_PACKED
|
2003-08-31 01:01:39 +00:00
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
char *
|
|
|
|
|
|
iso9660_strncpy_pad(char dst[], const char src[], size_t len,
|
|
|
|
|
|
enum strncpy_pad_check _check);
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
iso9660_isdchar (int c);
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
iso9660_isachar (int c);
|
|
|
|
|
|
|
|
|
|
|
|
/* file/dirname's */
|
|
|
|
|
|
bool
|
|
|
|
|
|
iso9660_pathname_valid_p (const char pathname[]);
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
|
iso9660_dirname_valid_p (const char pathname[]);
|
|
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
|
iso9660_pathname_isofy (const char pathname[], uint16_t version);
|
|
|
|
|
|
|
|
|
|
|
|
/* directory tree */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
iso9660_dir_init_new (void *dir, uint32_t self, uint32_t ssize,
|
|
|
|
|
|
uint32_t parent, uint32_t psize);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
iso9660_dir_init_new_su (void *dir, uint32_t self, uint32_t ssize,
|
|
|
|
|
|
const void *ssu_data, unsigned ssu_size,
|
|
|
|
|
|
uint32_t parent, uint32_t psize,
|
|
|
|
|
|
const void *psu_data, unsigned psu_size);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
iso9660_dir_add_entry_su (void *dir, const char name[], uint32_t extent,
|
|
|
|
|
|
uint32_t size, uint8_t flags, const void *su_data,
|
|
|
|
|
|
unsigned su_size);
|
|
|
|
|
|
|
|
|
|
|
|
unsigned
|
|
|
|
|
|
iso9660_dir_calc_record_size (unsigned namelen, unsigned int su_len);
|
|
|
|
|
|
|
2003-08-31 06:59:23 +00:00
|
|
|
|
int
|
2003-08-31 14:26:06 +00:00
|
|
|
|
iso9660_fs_stat (CdIo *obj,const char pathname[], iso9660_stat_t *buf,
|
|
|
|
|
|
bool is_mode2);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
2003-08-31 06:59:23 +00:00
|
|
|
|
void * /* list of char* -- caller must free it */
|
2003-08-31 14:26:06 +00:00
|
|
|
|
iso9660_fs_readdir (CdIo *obj, const char pathname[], bool mode2);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
2003-08-31 01:01:39 +00:00
|
|
|
|
uint8_t
|
2003-08-31 02:51:41 +00:00
|
|
|
|
iso9660_get_dir_len(const iso9660_dir_t *idr);
|
2003-08-31 01:01:39 +00:00
|
|
|
|
|
2003-08-31 01:32:05 +00:00
|
|
|
|
#if FIXME
|
2003-08-31 01:01:39 +00:00
|
|
|
|
uint8_t
|
2003-08-31 02:51:41 +00:00
|
|
|
|
iso9660_get_dir_size(const iso9660_dir_t *idr);
|
2003-08-31 01:01:39 +00:00
|
|
|
|
|
2003-08-31 01:32:05 +00:00
|
|
|
|
lsn_t
|
2003-08-31 05:00:44 +00:00
|
|
|
|
iso9660_get_dir_extent(const iso9660_dir_t *idr);
|
2003-08-31 01:32:05 +00:00
|
|
|
|
#endif
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
uint8_t
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_pvd_type(const iso9660_pvd_t *pvd);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
const char *
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_pvd_id(const iso9660_pvd_t *pvd);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
int
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
int
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ;
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
|
|
|
|
|
int
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
|
2003-08-31 01:01:39 +00:00
|
|
|
|
|
|
|
|
|
|
lsn_t
|
2003-08-31 01:40:00 +00:00
|
|
|
|
iso9660_get_root_lsn(const iso9660_pvd_t *pvd);
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
2003-08-31 06:59:23 +00:00
|
|
|
|
/* pathtable */
|
2003-08-17 05:31:19 +00:00
|
|
|
|
|
2003-08-31 06:59:23 +00:00
|
|
|
|
void
|
|
|
|
|
|
iso9660_pathtable_init (void *pt);
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
|
iso9660_pathtable_get_size (const void *pt);
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
|
iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent,
|
|
|
|
|
|
uint16_t parent);
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
|
iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent,
|
|
|
|
|
|
uint16_t parent);
|
|
|
|
|
|
|
2003-09-01 02:08:59 +00:00
|
|
|
|
/* volume descriptors */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
iso9660_set_pvd (void *pd, const char volume_id[], const char application_id[],
|
|
|
|
|
|
const char publisher_id[], const char preparer_id[],
|
|
|
|
|
|
uint32_t iso_size, const void *root_dir,
|
|
|
|
|
|
uint32_t path_table_l_extent, uint32_t path_table_m_extent,
|
|
|
|
|
|
uint32_t path_table_size);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
iso9660_set_evd (void *pd);
|
|
|
|
|
|
|
2003-08-17 05:31:19 +00:00
|
|
|
|
#endif /* __CDIO_ISO9660_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Local variables:
|
|
|
|
|
|
* c-file-style: "gnu"
|
|
|
|
|
|
* tab-width: 8
|
|
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
|
|
* End:
|
|
|
|
|
|
*/
|