Import cdrtools-3.02/mkisofs/diag/isoinfo.c and dependencies.
It doesn't compile, this is the unmodified upstream version.
This commit is contained in:
parent
3d7b378dfa
commit
c2db22734b
9 changed files with 3013 additions and 51 deletions
12
meson.build
12
meson.build
|
@ -3,6 +3,18 @@ project('psp2name', 'd', 'c',
|
|||
)
|
||||
|
||||
pspgamelists = files('data/redump.csv')
|
||||
d_compiler = meson.get_compiler('d')
|
||||
|
||||
#if get_option('buildtype') == 'release'
|
||||
# add_project_arguments('-noboundscheck', language: 'd')
|
||||
#endif
|
||||
if d_compiler.get_id() == 'llvm'
|
||||
add_project_arguments('-d-version=USE_SCG', language: 'd')
|
||||
add_project_arguments('-DUSE_SCG', language: 'c')
|
||||
endif
|
||||
|
||||
libisoinfo_proj = subproject('isoinfo')
|
||||
libisoinfo_dep = libisoinfo_proj.get_variable('libisoinfo_dep')
|
||||
|
||||
subdir('tools')
|
||||
subdir('src')
|
||||
|
|
|
@ -4,70 +4,240 @@ import std.string : toStringz, fromStringz;
|
|||
import std.stdio;
|
||||
import std.exception;
|
||||
import std.conv : to;
|
||||
import std.stdint;
|
||||
|
||||
private enum LibarchiveRet : int {
|
||||
ARCHIVE_EOF = 1, /* Found end of archive. */
|
||||
ARCHIVE_OK = 0, /* Operation was successful. */
|
||||
ARCHIVE_RETRY = (-10), /* Retry might succeed. */
|
||||
ARCHIVE_WARN = (-20), /* Partial success. */
|
||||
/* For example, if write_header "fails", then you can't push data. */
|
||||
ARCHIVE_FAILED = (-25), /* Current operation cannot complete. */
|
||||
/* But if write_header is "fatal," then this archive is dead and useless. */
|
||||
ARCHIVE_FATAL = (-30), /* No more operations are possible. */
|
||||
private const int MAX_ISONAME_V2 = 207; /*254 - 33 - 14 (XA Record)*/
|
||||
private const int MAX_ISONAME = MAX_ISONAME_V2;
|
||||
private const int ISO_MULTIEXTENT = 128; /*Not final entry of a mult. ext. file*/
|
||||
private const SECTOR_SIZE = 2048;
|
||||
/*
|
||||
* Use sector_offset != 0 (-N #) if we have an image file
|
||||
* of a single session and we need to list the directory contents.
|
||||
* This is the session block (sector) number of the start
|
||||
* of the session when it would be on disk.
|
||||
*/
|
||||
private uint sector_offset = 0;
|
||||
|
||||
private int ISODCL(int from, int to) pure {
|
||||
return to - from + 1;
|
||||
}
|
||||
private int ISO_BLOCKS(size_t X) pure {
|
||||
return (cast(int)X / SECTOR_SIZE + ((cast(int)X % SECTOR_SIZE) ? 1 : 0));
|
||||
}
|
||||
private alias off_t = long;
|
||||
|
||||
public class LibarchiveException : Exception {
|
||||
this(LibarchiveRet code, string file = __FILE__, size_t line = __LINE__) {
|
||||
super("libarchive error " ~ to!string(cast(int)code) ~ ": " ~ to!string(code), file, line);
|
||||
extern(C) {
|
||||
struct iso_volume_descriptor {
|
||||
char[ISODCL(1, 1)] type; /* 711 */
|
||||
char[ISODCL(2, 6)] id;
|
||||
char[ISODCL(7, 7)] version_;
|
||||
char[ISODCL(8, 2048)] data;
|
||||
}
|
||||
|
||||
struct iso_directory_record {
|
||||
byte [ISODCL(1, 1)] length; /* 711 */
|
||||
char [ISODCL(2, 2)] ext_attr_length; /* 711 */
|
||||
char [ISODCL(3, 10)] extent; /* 733 */
|
||||
char [ISODCL(11, 18)] size; /* 733 */
|
||||
char [ISODCL(19, 25)] date; /* 7 by 711 */
|
||||
byte [ISODCL(26, 26)] flags;
|
||||
char [ISODCL(27, 27)] file_unit_size; /* 711 */
|
||||
char [ISODCL(28, 28)] interleave; /* 711 */
|
||||
char [ISODCL(29, 32)] volume_sequence_number; /* 723 */
|
||||
byte [ISODCL(33, 33)] name_len; /* 711 */
|
||||
char [MAX_ISONAME+1] name; /* Not really, but we need something here */
|
||||
};
|
||||
|
||||
version(USE_SCG) {
|
||||
int readsecs (uint32_t startsecno, void* buffer, int sectorcount);
|
||||
}
|
||||
}
|
||||
|
||||
extern(C) {
|
||||
struct archive;
|
||||
struct archive_entry;
|
||||
private struct todo {
|
||||
todo* next;
|
||||
todo* prev;
|
||||
string name;
|
||||
int extent;
|
||||
int length;
|
||||
}
|
||||
|
||||
archive* archive_read_new();
|
||||
int archive_read_open_filename(archive*, const(char)* filename, size_t block_size);
|
||||
int archive_read_next_header(archive*, archive_entry**);
|
||||
int archive_read_data_skip(archive*);
|
||||
int archive_read_free(archive*);
|
||||
int archive_read_support_format_iso9660(archive*);
|
||||
int archive_read_support_format_empty(archive*);
|
||||
int archive_read_support_format_mtree(archive*);
|
||||
int archive_read_support_format_raw(archive*);
|
||||
int archive_read_support_format_tar(archive*);
|
||||
int archive_read_support_format_all(archive*);
|
||||
int archive_read_support_compression_none(archive*);
|
||||
int archive_read_support_compression_all(archive*);
|
||||
int archive_read_close(archive*);
|
||||
//int extent; /* Directory extent */
|
||||
//int len; /* Directory size */
|
||||
private void parse_dir(todo* dp, string rootname, int extent, int len) {
|
||||
todo td;
|
||||
int i;
|
||||
iso_directory_record* idr;
|
||||
iso_directory_record didr;
|
||||
//stat dstat;
|
||||
byte[2048] cl_buffer;
|
||||
byte flags = 0;
|
||||
long size = 0;
|
||||
int sextent = 0;
|
||||
int rlen;
|
||||
int blen;
|
||||
int rr_flags = 0;
|
||||
static char* n = null;
|
||||
static int nlen = 0;
|
||||
byte[2048] buffer;
|
||||
|
||||
const(char)* archive_entry_pathname(archive_entry*);
|
||||
while (len > 0) {
|
||||
version(USE_SCG) {
|
||||
readsecs(extent - sector_offset, buffer.ptr, ISO_BLOCKS(buffer.length));
|
||||
}
|
||||
else {
|
||||
lseek(fileno(infile), (cast(off_t)(extent - sector_offset)) << 11, SEEK_SET);
|
||||
read(fileno(infile), buffer, sizeof (buffer));
|
||||
}
|
||||
len -= typeof(buffer).sizeof;
|
||||
extent++;
|
||||
i = 0;
|
||||
/*
|
||||
while (true) {
|
||||
idr = cast(iso_directory_record*)&buffer[i];
|
||||
if (idr->length[0] == 0)
|
||||
break;
|
||||
parse_de(idr);
|
||||
if (use_rock) {
|
||||
rr_flags = dump_rr(idr);
|
||||
|
||||
if (rr_flags & RR_FLAG_CL) {
|
||||
// Need to reparse the child link
|
||||
// but note that we parse "CL/."
|
||||
// so we get no usable file name.
|
||||
idr = (struct iso_directory_record *) cl_buffer;
|
||||
parse_cl_dir(idr, cl_extent);
|
||||
} else if (rr_flags & RR_FLAG_RE)
|
||||
goto cont; // skip rr_moved
|
||||
}
|
||||
if (Xtract &&
|
||||
(idr->flags[0] & 2) != 0 &&
|
||||
idr->name_len[0] == 1 &&
|
||||
idr->name[0] == 0) {
|
||||
// The '.' entry.
|
||||
didr = *idr;
|
||||
dstat = fstat_buf;
|
||||
}
|
||||
blen = strlen(name_buf);
|
||||
|
||||
blen = rlen + blen + 1;
|
||||
if (nlen < blen) {
|
||||
n = ___realloc(n, blen, _("find_stat name"));
|
||||
nlen = blen;
|
||||
}
|
||||
strcatl(n, rootname, name_buf, (char *)0);
|
||||
if (name_buf[0] == '.' && name_buf[1] == '\0')
|
||||
n[rlen] = '\0';
|
||||
|
||||
if ((idr->flags[0] & 2) != 0 &&
|
||||
((rr_flags & RR_FLAG_CL) ||
|
||||
(idr->name_len[0] != 1 ||
|
||||
(idr->name[0] != 0 && idr->name[0] != 1)))) {
|
||||
// This is a plain directory (neither "xxx/."
|
||||
// nor "xxx/..").
|
||||
// Add this directory to the todo list.
|
||||
int dir_loop = 0;
|
||||
int nextent;
|
||||
struct todo *tp = dp;
|
||||
|
||||
nextent = isonum_733((unsigned char *)idr->extent);
|
||||
while (tp) {
|
||||
if (tp->extent == nextent) {
|
||||
dir_loop = 1;
|
||||
break;
|
||||
}
|
||||
tp = tp->prev;
|
||||
}
|
||||
if (dir_loop == 0) {
|
||||
td = (struct todo *) malloc(sizeof (*td));
|
||||
if (td == NULL)
|
||||
comerr(_("No memory.\n"));
|
||||
td->next = NULL;
|
||||
td->prev = dp;
|
||||
td->extent = isonum_733((unsigned char *)idr->extent);
|
||||
td->length = isonum_733((unsigned char *)idr->size);
|
||||
td->name = (char *) malloc(strlen(rootname)
|
||||
+ strlen(name_buf) + 2);
|
||||
if (td->name == NULL)
|
||||
comerr(_("No memory.\n"));
|
||||
strcpy(td->name, rootname);
|
||||
strcat(td->name, name_buf);
|
||||
strcat(td->name, "/");
|
||||
|
||||
*todo_pp = td;
|
||||
todo_pp = &td->next;
|
||||
}
|
||||
} else {
|
||||
if (xtract && strcmp(xtract, n) == 0) {
|
||||
extract_file(STDOUT_FILENO, idr, "stdout");
|
||||
}
|
||||
}
|
||||
if (do_f &&
|
||||
(idr->name_len[0] != 1 ||
|
||||
(idr->name[0] != 0 && idr->name[0] != 1))) {
|
||||
printf("%s\n", n);
|
||||
}
|
||||
if (do_listing || Xtract || do_find) {
|
||||
// In case if a multi-extent file, remember the
|
||||
// start extent number.
|
||||
if ((idr->flags[0] & ISO_MULTIEXTENT) && size == 0)
|
||||
sextent = isonum_733((unsigned char *)idr->extent);
|
||||
|
||||
if (debug ||
|
||||
((idr->flags[0] & ISO_MULTIEXTENT) == 0 && size == 0)) {
|
||||
if (dump_stat(rootname, idr, n,
|
||||
isonum_733((unsigned char *)idr->extent))) {
|
||||
if (Xtract) {
|
||||
if ((idr->flags[0] & 2) != 0 &&
|
||||
idr->name_len[0] != 1 &&
|
||||
idr->name[0] != 1) {
|
||||
char *p = n;
|
||||
if (*p == '/')
|
||||
p++;
|
||||
makedirs(p,
|
||||
S_IRUSR|S_IWUSR|S_IXUSR|
|
||||
S_IRGRP|S_IWGRP|S_IXGRP|
|
||||
S_IROTH|S_IWOTH|S_IXOTH,
|
||||
FALSE);
|
||||
} else {
|
||||
if (myuid != 0 &&
|
||||
S_ISDIR(fstat_buf.st_mode)) {
|
||||
fstat_buf.st_mode |= S_IWUSR;
|
||||
}
|
||||
extract(rootname, idr, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Xtract && find_stat(rootname, idr, n, sextent)) {
|
||||
// Extract all multi extent files here...
|
||||
extract(rootname, idr, n);
|
||||
}
|
||||
size += fstat_buf.st_size;
|
||||
if ((flags & ISO_MULTIEXTENT) &&
|
||||
(idr->flags[0] & ISO_MULTIEXTENT) == 0) {
|
||||
fstat_buf.st_size = size;
|
||||
if (!debug)
|
||||
idr->flags[0] |= ISO_MULTIEXTENT;
|
||||
dump_stat(rootname, idr, n, sextent);
|
||||
if (!debug)
|
||||
idr->flags[0] &= ~ISO_MULTIEXTENT;
|
||||
}
|
||||
flags = idr->flags[0];
|
||||
if ((idr->flags[0] & ISO_MULTIEXTENT) == 0)
|
||||
size = 0;
|
||||
}
|
||||
cont:
|
||||
i += buffer[i];
|
||||
if (i > 2048 - offsetof(struct iso_directory_record, name[0])) break;
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
public string iso_to_serial (string path) {
|
||||
archive* arc = archive_read_new();
|
||||
scope(exit) archive_read_free(arc);
|
||||
|
||||
// open umd_data.bin
|
||||
// open UMD_DATA.BIN
|
||||
// examples:
|
||||
// NPEG-00003|8F33052F02B34E56|0001|G
|
||||
// NPJH-50465|0D506D389F2AA444|0001|G
|
||||
// ULJM-05530|5A2E0CF722EF6299|0001|G
|
||||
archive_read_support_format_iso9660(arc);
|
||||
archive_read_support_format_empty(arc);
|
||||
archive_read_support_format_raw(arc);
|
||||
//archive_read_support_format_tar(arc);
|
||||
archive_read_support_compression_none(arc);
|
||||
|
||||
const LibarchiveRet r = cast(LibarchiveRet)archive_read_open_filename(arc, path.toStringz, 10240);
|
||||
if (r != LibarchiveRet.ARCHIVE_OK)
|
||||
throw new LibarchiveException(r);
|
||||
archive_entry* entry;
|
||||
writefln("reading content of %s...", path);
|
||||
while (archive_read_next_header(arc, &entry) == LibarchiveRet.ARCHIVE_OK) {
|
||||
writefln("path: \"%s\"", archive_entry_pathname(entry).fromStringz);
|
||||
archive_read_data_skip(arc);
|
||||
}
|
||||
|
||||
return "UCES-00356"; //Tekken Dark Resurrection
|
||||
//return "NPJH-50465"; //Hatsune Miku (missing from redump list)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
libarchive_dep = dependency('libarchive')
|
||||
iso9660_dep = dependency('libiso9660')
|
||||
sqlite_dep = dependency('sqlite3')
|
||||
|
||||
sqlitedb_target = custom_target('sqlitedb_target',
|
||||
|
@ -27,5 +27,5 @@ executable(meson.project_name(),
|
|||
'gamesdb.d',
|
||||
'isotoserial.d',
|
||||
install: true,
|
||||
dependencies: [libarchive_dep, sqlite_dep]
|
||||
dependencies: [iso9660_dep, sqlite_dep, libisoinfo_dep]
|
||||
)
|
||||
|
|
20
subprojects/isoinfo/meson.build
Normal file
20
subprojects/isoinfo/meson.build
Normal file
|
@ -0,0 +1,20 @@
|
|||
project('isoinfo', 'c',
|
||||
version: '3.0.2',
|
||||
default_options: ['c_std=c99']
|
||||
)
|
||||
|
||||
c_compiler = meson.get_compiler('c')
|
||||
|
||||
cdrdeflt_dep = c_compiler.find_library('cdrdeflt')
|
||||
public_inc = include_directories('include')
|
||||
|
||||
libisoinfo = static_library(meson.project_name(),
|
||||
'src/isoinfo.c',
|
||||
dependencies: [cdrdeflt_dep],
|
||||
install: false,
|
||||
)
|
||||
|
||||
libisoinfo_dep = declare_dependency(
|
||||
include_directories: public_inc,
|
||||
link_with: libisoinfo
|
||||
)
|
26
subprojects/isoinfo/src/cdrdeflt/cdrdeflt.h
Normal file
26
subprojects/isoinfo/src/cdrdeflt/cdrdeflt.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* @(#)cdrdeflt.h 1.4 08/10/25 Copyright 1998-2008 J. Schilling */
|
||||
/*
|
||||
* The cdrecord defaults (/etc/default/cdrecord) interface
|
||||
*
|
||||
* Copyright (c) 1998-2008 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* See the file CDDL.Schily.txt in this distribution for details.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file CDDL.Schily.txt from this distribution.
|
||||
*/
|
||||
|
||||
#ifndef _CDRDEFLT_H
|
||||
#define _CDRDEFLT_H
|
||||
/*
|
||||
* defaults.c
|
||||
*/
|
||||
extern void cdr_defaults __PR((char **devp, int *speedp, long *fsp, long *bufsizep, char **drvoptp));
|
||||
|
||||
#endif /* _CDRDEFLT_H */
|
376
subprojects/isoinfo/src/iso9660.h
Normal file
376
subprojects/isoinfo/src/iso9660.h
Normal file
|
@ -0,0 +1,376 @@
|
|||
/* @(#)iso9660.h 1.22 11/06/04 joerg */
|
||||
/*
|
||||
* Header file iso9660.h - assorted structure definitions and typecasts.
|
||||
* specific to iso9660 filesystem.
|
||||
*
|
||||
* Written by Eric Youngdale (1993).
|
||||
*
|
||||
* Copyright 1993 Yggdrasil Computing, Incorporated
|
||||
* Copyright (c) 1999,2000-2007 J. Schilling
|
||||
*
|
||||
* 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, 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 _ISOFS_FS_H
|
||||
#define _ISOFS_FS_H
|
||||
|
||||
/*
|
||||
* The isofs filesystem constants/structures
|
||||
*/
|
||||
|
||||
/* This part borrowed from the bsd386 isofs */
|
||||
#define ISODCL(from, to) (to - from + 1)
|
||||
|
||||
struct iso_volume_descriptor {
|
||||
char type [ISODCL(1, 1)]; /* 711 */
|
||||
char id [ISODCL(2, 6)];
|
||||
char version [ISODCL(7, 7)];
|
||||
char data [ISODCL(8, 2048)];
|
||||
};
|
||||
|
||||
/* volume descriptor types */
|
||||
#define ISO_VD_PRIMARY 1
|
||||
#define ISO_VD_SUPPLEMENTARY 2 /* Used by Joliet */
|
||||
#define ISO_VD_END 255
|
||||
|
||||
#define ISO_STANDARD_ID "CD001"
|
||||
|
||||
#define EL_TORITO_ID "EL TORITO SPECIFICATION"
|
||||
#define EL_TORITO_ARCH_x86 0
|
||||
#define EL_TORITO_ARCH_PPC 1
|
||||
#define EL_TORITO_ARCH_MAC 2
|
||||
#define EL_TORITO_ARCH_EFI 0xEF
|
||||
|
||||
#define EL_TORITO_BOOTABLE 0x88
|
||||
#define EL_TORITO_NOT_BOOTABLE 0
|
||||
|
||||
#define EL_TORITO_MEDIA_NOEMUL 0
|
||||
#define EL_TORITO_MEDIA_12FLOP 1
|
||||
#define EL_TORITO_MEDIA_144FLOP 2
|
||||
#define EL_TORITO_MEDIA_288FLOP 3
|
||||
#define EL_TORITO_MEDIA_HD 4
|
||||
|
||||
struct iso_primary_descriptor {
|
||||
char type [ISODCL(1, 1)]; /* 711 */
|
||||
char id [ISODCL(2, 6)];
|
||||
char version [ISODCL(7, 7)]; /* 711 */
|
||||
char unused1 [ISODCL(8, 8)];
|
||||
char system_id [ISODCL(9, 40)]; /* achars */
|
||||
char volume_id [ISODCL(41, 72)]; /* dchars */
|
||||
char unused2 [ISODCL(73, 80)];
|
||||
char volume_space_size [ISODCL(81, 88)]; /* 733 */
|
||||
char escape_sequences [ISODCL(89, 120)];
|
||||
char volume_set_size [ISODCL(121, 124)]; /* 723 */
|
||||
char volume_sequence_number [ISODCL(125, 128)]; /* 723 */
|
||||
char logical_block_size [ISODCL(129, 132)]; /* 723 */
|
||||
char path_table_size [ISODCL(133, 140)]; /* 733 */
|
||||
char type_l_path_table [ISODCL(141, 144)]; /* 731 */
|
||||
char opt_type_l_path_table [ISODCL(145, 148)]; /* 731 */
|
||||
char type_m_path_table [ISODCL(149, 152)]; /* 732 */
|
||||
char opt_type_m_path_table [ISODCL(153, 156)]; /* 732 */
|
||||
char root_directory_record [ISODCL(157, 190)]; /* 9.1 */
|
||||
char volume_set_id [ISODCL(191, 318)]; /* dchars */
|
||||
char publisher_id [ISODCL(319, 446)]; /* achars */
|
||||
char preparer_id [ISODCL(447, 574)]; /* achars */
|
||||
char application_id [ISODCL(575, 702)]; /* achars */
|
||||
char copyright_file_id [ISODCL(703, 739)]; /* 7.5 dchars */
|
||||
char abstract_file_id [ISODCL(740, 776)]; /* 7.5 dchars */
|
||||
char bibliographic_file_id [ISODCL(777, 813)]; /* 7.5 dchars */
|
||||
char creation_date [ISODCL(814, 830)]; /* 8.4.26.1 */
|
||||
char modification_date [ISODCL(831, 847)]; /* 8.4.26.1 */
|
||||
char expiration_date [ISODCL(848, 864)]; /* 8.4.26.1 */
|
||||
char effective_date [ISODCL(865, 881)]; /* 8.4.26.1 */
|
||||
char file_structure_version [ISODCL(882, 882)]; /* 711 */
|
||||
char unused4 [ISODCL(883, 883)];
|
||||
char application_data [ISODCL(884, 1395)];
|
||||
char unused5 [ISODCL(1396, 2048)];
|
||||
};
|
||||
|
||||
/*
|
||||
* Supplementary or enhanced volume descriptor
|
||||
*/
|
||||
struct iso_enhanced_descriptor {
|
||||
char type [ISODCL(1, 1)]; /* 711 */
|
||||
char id [ISODCL(2, 6)];
|
||||
char version [ISODCL(7, 7)]; /* 711 */
|
||||
char flags [ISODCL(8, 8)];
|
||||
char system_id [ISODCL(9, 40)]; /* achars */
|
||||
char volume_id [ISODCL(41, 72)]; /* dchars */
|
||||
char unused2 [ISODCL(73, 80)];
|
||||
char volume_space_size [ISODCL(81, 88)]; /* 733 */
|
||||
char escape_sequences [ISODCL(89, 120)];
|
||||
char volume_set_size [ISODCL(121, 124)]; /* 723 */
|
||||
char volume_sequence_number [ISODCL(125, 128)]; /* 723 */
|
||||
char logical_block_size [ISODCL(129, 132)]; /* 723 */
|
||||
char path_table_size [ISODCL(133, 140)]; /* 733 */
|
||||
char type_l_path_table [ISODCL(141, 144)]; /* 731 */
|
||||
char opt_type_l_path_table [ISODCL(145, 148)]; /* 731 */
|
||||
char type_m_path_table [ISODCL(149, 152)]; /* 732 */
|
||||
char opt_type_m_path_table [ISODCL(153, 156)]; /* 732 */
|
||||
char root_directory_record [ISODCL(157, 190)]; /* 9.1 */
|
||||
char volume_set_id [ISODCL(191, 318)]; /* dchars */
|
||||
char publisher_id [ISODCL(319, 446)]; /* achars */
|
||||
char preparer_id [ISODCL(447, 574)]; /* achars */
|
||||
char application_id [ISODCL(575, 702)]; /* achars */
|
||||
char copyright_file_id [ISODCL(703, 739)]; /* 7.5 dchars */
|
||||
char abstract_file_id [ISODCL(740, 776)]; /* 7.5 dchars */
|
||||
char bibliographic_file_id [ISODCL(777, 813)]; /* 7.5 dchars */
|
||||
char creation_date [ISODCL(814, 830)]; /* 8.4.26.1 */
|
||||
char modification_date [ISODCL(831, 847)]; /* 8.4.26.1 */
|
||||
char expiration_date [ISODCL(848, 864)]; /* 8.4.26.1 */
|
||||
char effective_date [ISODCL(865, 881)]; /* 8.4.26.1 */
|
||||
char file_structure_version [ISODCL(882, 882)]; /* 711 */
|
||||
char unused4 [ISODCL(883, 883)];
|
||||
char application_data [ISODCL(884, 1395)];
|
||||
char unused5 [ISODCL(1396, 2048)];
|
||||
};
|
||||
|
||||
/* El Torito Boot Record Volume Descriptor */
|
||||
struct eltorito_boot_descriptor {
|
||||
char type [ISODCL(1, 1)]; /* 711 */
|
||||
char id [ISODCL(2, 6)];
|
||||
char version [ISODCL(7, 7)]; /* 711 */
|
||||
char system_id [ISODCL(8, 39)];
|
||||
char unused2 [ISODCL(40, 71)];
|
||||
char bootcat_ptr [ISODCL(72, 75)];
|
||||
char unused5 [ISODCL(76, 2048)];
|
||||
};
|
||||
|
||||
/* Validation entry for El Torito */
|
||||
/*
|
||||
* headerid must be 1
|
||||
* id is the manufacturer ID
|
||||
* cksum to make the sum of all shorts in this record 0
|
||||
*/
|
||||
struct eltorito_validation_entry {
|
||||
char headerid [ISODCL(1, 1)]; /* 711 */
|
||||
char arch [ISODCL(2, 2)];
|
||||
char pad1 [ISODCL(3, 4)]; /* 721 */
|
||||
char id [ISODCL(5, 28)]; /* CD devel/man*/
|
||||
char cksum [ISODCL(29, 30)];
|
||||
char key1 [ISODCL(31, 31)];
|
||||
char key2 [ISODCL(32, 32)];
|
||||
};
|
||||
|
||||
/* El Torito initial/default entry in boot catalog */
|
||||
struct eltorito_defaultboot_entry {
|
||||
char boot_id [ISODCL(1, 1)]; /* 711 */
|
||||
char boot_media [ISODCL(2, 2)];
|
||||
char loadseg [ISODCL(3, 4)]; /* 721 */
|
||||
char sys_type [ISODCL(5, 5)];
|
||||
char pad1 [ISODCL(6, 6)];
|
||||
char nsect [ISODCL(7, 8)];
|
||||
char bootoff [ISODCL(9, 12)];
|
||||
char pad2 [ISODCL(13, 32)];
|
||||
};
|
||||
|
||||
/* El Torito section header entry in boot catalog */
|
||||
struct eltorito_sectionheader_entry {
|
||||
#define EL_TORITO_SHDR_ID_SHDR 0x90
|
||||
#define EL_TORITO_SHDR_ID_LAST_SHDR 0x91
|
||||
char header_id [ISODCL(1, 1)]; /* 711 */
|
||||
char platform_id [ISODCL(2, 2)];
|
||||
char entry_count [ISODCL(3, 4)]; /* 721 */
|
||||
char id [ISODCL(5, 32)];
|
||||
};
|
||||
|
||||
/* El Torito section entry in boot catalog */
|
||||
struct eltorito_section_entry {
|
||||
char boot_id [ISODCL(1, 1)]; /* 711 */
|
||||
char boot_media [ISODCL(2, 2)];
|
||||
char loadseg [ISODCL(3, 4)]; /* 721 */
|
||||
char sys_type [ISODCL(5, 5)];
|
||||
char pad1 [ISODCL(6, 6)];
|
||||
char nsect [ISODCL(7, 8)];
|
||||
char bootoff [ISODCL(9, 12)];
|
||||
char sel_criteria [ISODCL(13, 13)];
|
||||
char vendor_sel_criteria [ISODCL(14, 32)];
|
||||
};
|
||||
|
||||
/*
|
||||
* XXX JS: The next two structures have odd lengths!
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* We use this to help us look up the parent inode numbers. */
|
||||
|
||||
struct iso_path_table {
|
||||
unsigned char name_len[2]; /* 721 */
|
||||
char extent[4]; /* 731 */
|
||||
char parent[2]; /* 721 */
|
||||
char name[1];
|
||||
};
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* We currently do not support CD-ROM-XA entension records, but we must honor
|
||||
* the needed space for ISO-9660:1999 (Version 2).
|
||||
*
|
||||
* XXX If we ever will start to support XA records, we will need to take care
|
||||
* XXX that the the maximum ISO-9660 name length will be reduced by another
|
||||
* XXX 14 bytes resulting in a new total of 179 Bytes.
|
||||
*/
|
||||
#define LEN_ISONAME 31
|
||||
#define MAX_ISONAME_V1 37
|
||||
#define MAX_ISONAME_V2 207 /* 254 - 33 - 14 (XA Record) */
|
||||
#define MAX_ISONAME_V2_RR 193 /* 254 - 33 - 28 (CE Record) */
|
||||
#define MAX_ISONAME_V2_RR_XA 179 /* 254 - 33 - 14 - 28 */
|
||||
#define MAX_ISONAME MAX_ISONAME_V2 /* Used for array space defs */
|
||||
#define MAX_ISODIR 254 /* Must be even and <= 255 */
|
||||
|
||||
struct iso_directory_record {
|
||||
unsigned char length [ISODCL(1, 1)]; /* 711 */
|
||||
char ext_attr_length [ISODCL(2, 2)]; /* 711 */
|
||||
char extent [ISODCL(3, 10)]; /* 733 */
|
||||
char size [ISODCL(11, 18)]; /* 733 */
|
||||
char date [ISODCL(19, 25)]; /* 7 by 711 */
|
||||
unsigned char flags [ISODCL(26, 26)];
|
||||
char file_unit_size [ISODCL(27, 27)]; /* 711 */
|
||||
char interleave [ISODCL(28, 28)]; /* 711 */
|
||||
char volume_sequence_number [ISODCL(29, 32)]; /* 723 */
|
||||
unsigned char name_len [ISODCL(33, 33)]; /* 711 */
|
||||
char name [MAX_ISONAME+1]; /* Not really, but we need something here */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Iso 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 */
|
||||
|
||||
|
||||
struct iso_ext_attr_record {
|
||||
char owner [ISODCL(1, 4)]; /* 723 */
|
||||
char group [ISODCL(5, 8)]; /* 723 */
|
||||
char permissions [ISODCL(9, 10)]; /* 16 bits */
|
||||
char creation_date [ISODCL(11, 27)]; /* 8.4.26.1 */
|
||||
char modification_date [ISODCL(28, 44)]; /* 8.4.26.1 */
|
||||
char expiration_date [ISODCL(45, 61)]; /* 8.4.26.1 */
|
||||
char effective_date [ISODCL(62, 78)]; /* 8.4.26.1 */
|
||||
char record_format [ISODCL(79, 79)]; /* 711 */
|
||||
char record_attributes [ISODCL(80, 80)]; /* 711 */
|
||||
char record_length [ISODCL(81, 84)]; /* 723 */
|
||||
char system_id [ISODCL(85, 116)]; /* achars */
|
||||
char system_use [ISODCL(117, 180)];
|
||||
char ext_attr_version [ISODCL(181, 181)]; /* 711 */
|
||||
char esc_seq_len [ISODCL(182, 182)]; /* 711 */
|
||||
char reserved [ISODCL(183, 246)]; /* for future use */
|
||||
char appl_use_len [ISODCL(247, 250)]; /* 723 */
|
||||
char appl_use[1]; /* really more */
|
||||
/* char esc_seq[]; escape sequences recorded after appl_use */
|
||||
};
|
||||
|
||||
/*
|
||||
* Iso extended attribute permissions.
|
||||
*/
|
||||
#define ISO_GS_READ 0x0001 /* System Group Read */
|
||||
#define ISO_BIT_1 0x0002
|
||||
#define ISO_GS_EXEC 0x0004 /* System Group Execute */
|
||||
#define ISO_BIT_3 0x0008
|
||||
|
||||
#define ISO_O_READ 0x0010 /* Owner Read */
|
||||
#define ISO_BIT_5 0x0020
|
||||
#define ISO_O_EXEC 0x0040 /* Owner Exexute */
|
||||
#define ISO_BIT_7 0x0080
|
||||
|
||||
#define ISO_G_READ 0x0100 /* Group Read */
|
||||
#define ISO_BIT_9 0x0200
|
||||
#define ISO_G_EXEC 0x0400 /* Group Execute */
|
||||
#define ISO_BIT_11 0x0800
|
||||
|
||||
#define ISO_W_READ 0x1000 /* World (other) Read */
|
||||
#define ISO_BIT_13 0x2000
|
||||
#define ISO_W_EXEC 0x4000 /* World (other) Execute */
|
||||
#define ISO_BIT_15 0x8000
|
||||
|
||||
#define ISO_MB_ONE (ISO_BIT_1|ISO_BIT_3|ISO_BIT_5|ISO_BIT_7| \
|
||||
ISO_BIT_9|ISO_BIT_11|ISO_BIT_13|ISO_BIT_15)
|
||||
|
||||
/*
|
||||
* Extended Attributes record according to Yellow Book.
|
||||
*/
|
||||
struct iso_xa_dir_record {
|
||||
char group_id [ISODCL(1, 2)];
|
||||
char user_id [ISODCL(3, 4)];
|
||||
char attributes [ISODCL(5, 6)];
|
||||
char signature [ISODCL(7, 8)];
|
||||
char file_number [ISODCL(9, 9)];
|
||||
char reserved [ISODCL(10, 14)];
|
||||
};
|
||||
|
||||
/*
|
||||
* Definitions for XA attributes
|
||||
*/
|
||||
#define XA_O_READ 0x0001 /* Owner Read */
|
||||
#define XA_O_RES 0x0002 /* Owner Reserved (write ?) */
|
||||
#define XA_O_EXEC 0x0004 /* Owner Execute */
|
||||
#define XA_O_RES2 0x0008 /* Owner Reserved */
|
||||
#define XA_G_READ 0x0010 /* Group Read */
|
||||
#define XA_G_RES 0x0020 /* Group Reserved (write ?) */
|
||||
#define XA_G_EXEC 0x0040 /* Group Execute */
|
||||
#define XA_G_RES2 0x0080 /* Group Reserved */
|
||||
#define XA_W_READ 0x0100 /* World Read */
|
||||
#define XA_W_RES 0x0200 /* World Reserved (write ?) */
|
||||
#define XA_W_EXEC 0x0400 /* World Execute */
|
||||
|
||||
#define XA_FORM1 0x0800 /* File contains Form 1 sector */
|
||||
#define XA_FORM2 0x1000 /* File contains Form 2 sector */
|
||||
#define XA_INTERLEAVED 0x2000 /* File contains interleaved sectors */
|
||||
#define XA_CDDA 0x4000 /* File contains audio data */
|
||||
#define XA_DIR 0x8000 /* This is a directory */
|
||||
|
||||
/*
|
||||
* Definitions for CD-ROM XA-Mode-2-form-1/2 sector sub-headers
|
||||
*/
|
||||
struct xa_subhdr {
|
||||
Uchar file_number; /* Identifies file for block */
|
||||
Uchar channel_number; /* Playback channel selection */
|
||||
Uchar sub_mode; /* See bit definitions below */
|
||||
Uchar coding; /* Coding information */
|
||||
};
|
||||
|
||||
/*
|
||||
* Sub mode bit definitions
|
||||
*/
|
||||
#define XA_SUBH_EOR 0x01 /* End-Of-Record */
|
||||
#define XA_SUBH_VIDEO 0x02 /* Video Block */
|
||||
#define XA_SUBH_AUDIO 0x04 /* Audio Block (not CD-DA) */
|
||||
#define XA_SUBH_DATA 0x08 /* Data Block */
|
||||
#define XA_SUBH_TRIGGER 0x10 /* Trigger Block */
|
||||
#define XA_SUBH_FORM2 0x20 /* 0 == Form1, 1 == Form2 */
|
||||
#define XA_SUBH_REALTIME 0x40 /* Real Time Block */
|
||||
#define XA_SUBH_EOF 0x80 /* End-Of-File */
|
||||
|
||||
#endif /* _ISOFS_FS_H */
|
2284
subprojects/isoinfo/src/isoinfo.c
Normal file
2284
subprojects/isoinfo/src/isoinfo.c
Normal file
File diff suppressed because it is too large
Load diff
54
subprojects/isoinfo/src/rock.h
Normal file
54
subprojects/isoinfo/src/rock.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* @(#)rock.h 1.3 14/04/29 Copyright 2003-2014 J. Schilling */
|
||||
/*
|
||||
* Header file for the Rock Ridge encoder and parser
|
||||
*
|
||||
* Copyright (c) 2003-2014 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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; see the file COPYING. If not, write to the Free Software
|
||||
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defines for SUSP and Rock Ridge signature flags.
|
||||
* The first block is defined by RRIP-1.09.
|
||||
*/
|
||||
#define RR_FLAG_PX 1 /* POSIX attributes */
|
||||
#define RR_FLAG_PN 2 /* POSIX device number */
|
||||
#define RR_FLAG_SL 4 /* Symlink */
|
||||
#define RR_FLAG_NM 8 /* Alternate Name */
|
||||
#define RR_FLAG_CL 16 /* Child link */
|
||||
#define RR_FLAG_PL 32 /* Parent link */
|
||||
#define RR_FLAG_RE 64 /* Relocated Direcotry */
|
||||
#define RR_FLAG_TF 128 /* Time stamp */
|
||||
|
||||
#define RR_FLAG_SF 256 /* Sparse File */
|
||||
|
||||
#define RR_FLAG_SP 1024 /* SUSP record */
|
||||
#define RR_FLAG_AA 2048 /* Apple Signature record */
|
||||
#define RR_FLAG_XA 4096 /* XA signature record */
|
||||
|
||||
#define RR_FLAG_CE 8192 /* SUSP Continuation aerea */
|
||||
#define RR_FLAG_ER 16384 /* Extensions Reference for RR */
|
||||
#define RR_FLAG_RR 32768 /* RR Signature in every file */
|
||||
#define RR_FLAG_ZF 65535 /* Linux compression extension */
|
||||
|
||||
/*
|
||||
* Defines that control the behavior of the Rock Ridge encoder
|
||||
*/
|
||||
#define NEED_RE 1 /* Need Relocated Direcotry */
|
||||
#define NEED_PL 2 /* Need Parent link */
|
||||
#define NEED_CL 4 /* Need Child link */
|
||||
#define NEED_CE 8 /* Need Continuation Area */
|
||||
#define NEED_SP 16 /* Need SUSP record */
|
||||
#define DID_CHDIR 1024 /* Did chdir() to file dir */
|
20
subprojects/isoinfo/src/scsi.h
Normal file
20
subprojects/isoinfo/src/scsi.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* @(#)scsi.h 1.4 16/11/14 Copyright 1997-2016 J. Schilling */
|
||||
/*
|
||||
* Copyright (c) 1997-2016 J. Schilling
|
||||
*/
|
||||
/*@@C@@*/
|
||||
|
||||
#ifndef _SCSI_H
|
||||
#define _SCSI_H
|
||||
|
||||
/*
|
||||
* Implemented inside multi.c in case that USE_SCG has not been defined.
|
||||
*/
|
||||
extern int readsecs __PR((UInt32_t startsecno, void *buffer, int sectorcount));
|
||||
|
||||
#ifdef USE_SCG
|
||||
extern int scsidev_open __PR((char *path));
|
||||
extern int scsidev_close __PR((void));
|
||||
#endif
|
||||
|
||||
#endif /* _SCSI_H */
|
Loading…
Reference in a new issue