File indexing completed on 2024-05-12 04:51:15
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 SPDX-FileCopyrightText: 2002 Szombathelyi Gy �rgy <gyurco@users.sourceforge.net> 0004 */ 0005 0006 #ifndef ISOFS_H 0007 #define ISOFS_H 0008 0009 #include <sys/time.h> 0010 0011 #include "iso_fs.h" 0012 #include "el_torito.h" 0013 0014 typedef long sector_t; 0015 0016 typedef struct _rr_entry { 0017 int len; /* length of structure */ 0018 char *name; /* Name from 'NM' */ 0019 char *sl; /* symbolic link data */ 0020 time_t t_creat; 0021 time_t rr_st_mtime; 0022 time_t rr_st_atime; 0023 time_t rr_st_ctime; 0024 time_t t_backup; 0025 time_t t_expire; 0026 time_t t_effect; 0027 int mode; /* POSIX file modes */ 0028 int nlink; 0029 int uid; 0030 int gid; 0031 int serno; 0032 int dev_major; 0033 int dev_minor; 0034 int pl; /* parent location */ 0035 int cl; /* child location */ 0036 int re; /* relocated */ 0037 char z_algo[2]; /* zizofs algorithm */ 0038 char z_params[2]; /* zizofs parameters */ 0039 int z_size; /* zizofs real_size */ 0040 } rr_entry; 0041 0042 typedef struct _iso_vol_desc { 0043 struct _iso_vol_desc *next; 0044 struct _iso_vol_desc *prev; 0045 struct iso_volume_descriptor data; 0046 } iso_vol_desc; 0047 0048 typedef struct _boot_entry { 0049 struct _boot_entry *next; 0050 struct _boot_entry *prev; 0051 struct _boot_entry *parent; 0052 struct _boot_entry *child; 0053 char data[32]; 0054 } boot_entry; 0055 0056 typedef struct _boot_head { 0057 struct validation_entry ventry; 0058 struct _boot_entry *defentry; 0059 struct _boot_entry *sections; 0060 } boot_head; 0061 0062 /** 0063 * this callback function needs to read 'len' sectors from 'start' into 'buf' 0064 */ 0065 typedef int readfunc(char *buf,sector_t start, int len,void *); 0066 0067 /** 0068 * ProcessDir uses this callback 0069 */ 0070 typedef int dircallback(struct iso_directory_record *,void *); 0071 0072 /** 0073 * Returns the Unix from the ISO9660 9.1.5 (7 bytes) time format 0074 * This function is from the linux kernel. 0075 * Set 'hs' to non-zero if it's a HighSierra volume 0076 */ 0077 time_t isodate_915(char * p, int hs); 0078 0079 /** 0080 * Returns the Unix time from the ISO9660 8.4.26.1 (17 bytes) time format 0081 * BUG: hundredth of seconds are ignored, because time_t has one second 0082 * resolution (I think it's no problem at all) 0083 * Set 'hs' to non-zero if it's a HighSierra volume 0084 */ 0085 time_t isodate_84261(char * p, int hs); 0086 0087 /** 0088 * Creates the linked list of the volume descriptors 0089 * 'sector' is the starting sector number of where the filesystem start 0090 * (starting sector of a session on a CD-ROM) 0091 * If the function fails, returns NULL 0092 * Don't forget to call FreeISO9660 after using the volume descriptor list! 0093 */ 0094 iso_vol_desc *ReadISO9660(readfunc *read,sector_t sector,void *udata); 0095 0096 /** 0097 * Frees the linked list of volume descriptors. 0098 */ 0099 void FreeISO9660(iso_vol_desc *data); 0100 0101 /** 0102 * Iterates over the directory entries. The directory is in 'buf', 0103 * the size of the directory is 'size'. 'callback' is called for each 0104 * directory entry with the parameter 'udata'. 0105 */ 0106 int ProcessDir(readfunc *read,int extent,int size,dircallback *callback,void *udata); 0107 0108 /** 0109 * Parses the System Use area and fills rr_entry with values 0110 */ 0111 int ParseRR(struct iso_directory_record *idr, rr_entry *rrentry); 0112 0113 /** 0114 * Frees the strings in 'rrentry' 0115 */ 0116 void FreeRR(rr_entry *rrentry); 0117 0118 /** 0119 * returns the joliet level from the volume descriptor 0120 */ 0121 int JolietLevel(struct iso_volume_descriptor *ivd); 0122 0123 /** 0124 * Returns the size of the boot image (in 512 byte sectors) 0125 */ 0126 int BootImageSize(readfunc *read,int media,sector_t start,int len,void *udata); 0127 0128 /** 0129 * Frees the boot catalog entries in 'boot'. If you ever called ReadBootTable, 0130 * then don't forget to call FreeBootTable! 0131 */ 0132 void FreeBootTable(boot_head *boot); 0133 0134 /** 0135 * Reads the boot catalog into 'head'. Don't forget to call FreeBootTable! 0136 */ 0137 int ReadBootTable(readfunc *read,sector_t sector, boot_head *head, void *udata); 0138 0139 int str_nappend(char **d, char *s, int n); 0140 0141 #endif