home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / beos / utils / mkisofs-1.000 / mkisofs-1.11-beos / mkisofs.h < prev    next >
C/C++ Source or Header  |  1997-04-09  |  11KB  |  334 lines

  1. /*
  2.  * Header file mkisofs.h - assorted structure definitions and typecasts.
  3.  
  4.    Written by Eric Youngdale (1993).
  5.  
  6.    Copyright 1993 Yggdrasil Computing, Incorporated
  7.  
  8.    This program is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2, or (at your option)
  11.    any later version.
  12.  
  13.    This program is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this program; if not, write to the Free Software
  20.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. /*
  23.  *     $Id: mkisofs.h,v 1.4 1997/03/08 17:29:12 eric Rel $
  24.  */
  25.  
  26. /* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
  27.  
  28. #include <stdio.h>
  29.  
  30. /* This symbol is used to indicate that we do not have things like
  31.    symlinks, devices, and so forth available.  Just files and dirs */
  32.  
  33. #ifdef VMS
  34. #define NON_UNIXFS
  35. #endif
  36.  
  37. #ifdef DJGPP
  38. #define NON_UNIXFS
  39. #endif
  40.  
  41. #ifdef VMS
  42. #include <sys/dir.h>
  43. #define dirent direct
  44. #else
  45. #include <dirent.h>
  46. #endif
  47.  
  48. #include <string.h>
  49. #include <sys/types.h>
  50. #include <sys/stat.h>
  51.  
  52. #ifdef linux
  53. #include <sys/dir.h>
  54. #endif
  55.  
  56. #ifdef ultrix
  57. extern char *strdup();
  58. #endif
  59.  
  60. #ifdef __STDC__
  61. #define DECL(NAME,ARGS) NAME ARGS
  62. #define FDECL1(NAME,TYPE0, ARG0) \
  63.     NAME(TYPE0 ARG0)
  64. #define FDECL2(NAME,TYPE0, ARG0,TYPE1, ARG1) \
  65.     NAME(TYPE0 ARG0, TYPE1 ARG1)
  66. #define FDECL3(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2) \
  67.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2)
  68. #define FDECL4(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3) \
  69.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3)
  70. #define FDECL5(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4) \
  71.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3, TYPE4 ARG4)
  72. #define FDECL6(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4, TYPE5, ARG5) \
  73.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3, TYPE4 ARG4, TYPE5 ARG5)
  74. #else
  75. #define DECL(NAME,ARGS) NAME()
  76. #define FDECL1(NAME,TYPE0, ARG0) NAME(ARG0) TYPE0 ARG0;
  77. #define FDECL2(NAME,TYPE0, ARG0,TYPE1, ARG1) NAME(ARG0, ARG1) TYPE0 ARG0; TYPE1 ARG1;
  78. #define FDECL3(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2) \
  79.     NAME(ARG0, ARG1, ARG2) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2;
  80. #define FDECL4(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3) \
  81.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3;
  82. #define FDECL5(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4) \
  83.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3; TYPE4 ARG4;
  84. #define FDECL6(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4, TYPE5, ARG5) \
  85.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4, ARG5) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3; TYPE4 ARG4; TYPE5 ARG5;
  86. #define const
  87. #endif
  88.  
  89.  
  90. #ifdef __svr4__
  91. #include <stdlib.h>
  92. #else
  93. extern int optind;
  94. extern char *optarg;
  95. /* extern int getopt (int __argc, char **__argv, char *__optstring); */
  96. #endif
  97.  
  98. #include "iso9660.h"
  99. #include "defaults.h"
  100.  
  101. struct directory_entry{
  102.   struct directory_entry * next;
  103.   struct iso_directory_record isorec;
  104.   unsigned int starting_block;
  105.   unsigned int size;
  106.   unsigned int priority;
  107.   char * name;
  108.   char * table;
  109.   char * whole_name;
  110.   struct directory * filedir;
  111.   struct directory_entry * parent_rec;
  112.   unsigned int de_flags;
  113.   ino_t inode;  /* Used in the hash table */
  114.   dev_t dev;  /* Used in the hash table */
  115.   unsigned char * rr_attributes;
  116.   unsigned int rr_attr_size;
  117.   unsigned int total_rr_attr_size;
  118. };
  119.  
  120. struct file_hash{
  121.   struct file_hash * next;
  122.   ino_t inode;  /* Used in the hash table */
  123.   dev_t dev;  /* Used in the hash table */
  124.   unsigned int starting_block;
  125.   unsigned int size;
  126. };
  127.   
  128. /* 
  129.  * This structure describes one complete directory.  It has pointers
  130.  * to other directories in the overall tree so that it is clear where
  131.  * this directory lives in the tree, and it also must contain pointers
  132.  * to the contents of the directory.  Note that subdirectories of this
  133.  * directory exist twice in this stucture.  Once in the subdir chain,
  134.  * and again in the contents chain.
  135.  */
  136. struct directory{
  137.   struct directory * next;  /* Next directory at same level as this one */
  138.   struct directory * subdir; /* First subdirectory in this directory */
  139.   struct directory * parent;
  140.   struct directory_entry * contents;
  141.   struct directory_entry * self;
  142.   char * whole_name;  /* Entire path */
  143.   char * de_name;  /* Entire path */
  144.   unsigned int ce_bytes;  /* Number of bytes of CE entries reqd for this dir */
  145.   unsigned int depth;
  146.   unsigned int size;
  147.   unsigned int extent;
  148.   unsigned short path_index;
  149. };
  150.  
  151. struct deferred{
  152.   struct deferred * next;
  153.   unsigned int starting_block;
  154.   char * name;
  155.   struct directory * filedir;
  156.   unsigned int flags;
  157. };
  158.  
  159. extern int goof;
  160. extern struct directory * root;
  161. extern struct directory * reloc_dir;
  162. extern unsigned int next_extent;
  163. extern unsigned int last_extent;
  164. extern unsigned int last_extent_written;
  165. extern unsigned int session_start;
  166. extern unsigned int path_table_size;
  167. extern unsigned int path_table[4];
  168. extern unsigned int path_blocks;
  169. extern char * path_table_l;
  170. extern char * path_table_m;
  171. extern struct iso_directory_record root_record;
  172.  
  173. extern int use_eltorito;
  174. extern int use_RockRidge;
  175. extern int rationalize;
  176. extern int follow_links;
  177. extern int verbose;
  178. extern int all_files;
  179. extern int generate_tables;
  180. extern int omit_period;
  181. extern int omit_version_number;
  182. extern int transparent_compression;
  183. extern int RR_relocation_depth;
  184. extern int full_iso9660_filenames;
  185.  
  186. /* tree.c */
  187. extern int DECL(stat_filter, (char *, struct stat *));
  188. extern void DECL(sort_n_finish,(struct directory *));
  189. extern void finish_cl_pl_entries();
  190. extern int DECL(scan_directory_tree,(char * path, 
  191.                      struct directory_entry * self,
  192.                      struct iso_directory_record *));
  193. extern void DECL(generate_iso9660_directories,(struct directory *, FILE*));
  194. extern void DECL(dump_tree,(struct directory * node));
  195. extern struct directory_entry * DECL(search_tree_file, (struct 
  196.                 directory * node,char * filename));
  197.  
  198. /* eltorito.c */
  199. extern void DECL(init_boot_catalog, (const char * path ));
  200. extern void DECL(get_torito_desc, (struct eltorito_boot_descriptor * path ));
  201.  
  202. /* write.c */
  203. extern void DECL(assign_directory_addresses,(struct directory * root));
  204. extern int DECL(get_733,(char *));
  205. extern int DECL(isonum_733,(unsigned char *));
  206. extern void DECL(set_723,(char *, unsigned int));
  207. extern void DECL(set_731,(char *, unsigned int));
  208. extern void DECL(set_721,(char *, unsigned int));
  209. extern void DECL(set_733,(char *, unsigned int));
  210. extern void DECL(sort_directory,(struct directory_entry **));
  211. extern void generate_root_record();
  212. extern void DECL(generate_one_directory,(struct directory *, FILE*));
  213. extern void generate_path_tables();
  214. extern int DECL(iso_write,(FILE * outfile));
  215. extern void DECL(memcpy_max, (char *, char *, int));
  216.  
  217.  
  218. /* multi.c */
  219.  
  220. extern FILE * in_image;
  221. extern struct iso_directory_record *
  222.     DECL(merge_isofs,(char * path)); 
  223.  
  224. extern int DECL(free_mdinfo, (struct directory_entry **, int len));
  225.  
  226. extern struct directory_entry ** 
  227.     DECL(read_merging_directory,(struct iso_directory_record *, int*));
  228. extern void 
  229.     DECL(merge_remaining_entries, (struct directory *, 
  230.                        struct directory_entry **, int));
  231.  
  232. /* match.c */
  233. extern int DECL(matches, (char *));
  234. extern void DECL(add_match, (char *));
  235.  
  236. /* files.c */
  237. struct dirent * DECL(readdir_add_files, (char **, char *, DIR *));
  238.  
  239. /* */
  240.  
  241. extern int DECL(iso9660_file_length,(const char* name, 
  242.                    struct directory_entry * sresult, int flag));
  243. extern int DECL(iso9660_date,(char *, time_t));
  244. extern void DECL(add_hash,(struct directory_entry *));
  245. extern struct file_hash * DECL(find_hash,(dev_t, ino_t));
  246. extern void DECL(add_directory_hash,(dev_t, ino_t));
  247. extern struct file_hash * DECL(find_directory_hash,(dev_t, ino_t));
  248. extern void flush_file_hash();
  249. extern int DECL(delete_file_hash,(struct directory_entry *));
  250. extern struct directory_entry * DECL(find_file_hash,(char *));
  251. extern void DECL(add_file_hash,(struct directory_entry *));
  252. extern int DECL(generate_rock_ridge_attributes,(char *, char *,
  253.                       struct directory_entry *, 
  254.                       struct stat *, struct stat *,
  255.                       int  deep_flag));
  256. extern char * DECL(generate_rr_extension_record,(char * id,  char  * descriptor,
  257.                     char * source, int  * size));
  258.  
  259. extern int    DECL(check_prev_session, (struct directory_entry **, int len,
  260.                      struct directory_entry *,
  261.                      struct stat *,
  262.                      struct stat *,
  263.                      struct directory_entry **));
  264.  
  265. extern char * extension_record;
  266. extern int extension_record_extent;
  267. extern int n_data_extents;
  268.  
  269. /* These are a few goodies that can be specified on the command line, and  are
  270.    filled into the root record */
  271.  
  272. extern char * preparer;
  273. extern char * publisher;
  274. extern char * copyright;
  275. extern char * biblio;
  276. extern char * abstract;
  277. extern char * appid;
  278. extern char * volset_id;
  279. extern char * system_id;
  280. extern char * volume_id;
  281. extern char * boot_catalog;
  282. extern char * boot_image;
  283.  
  284. extern void * DECL(e_malloc,(size_t));
  285.  
  286.  
  287. #define SECTOR_SIZE (2048)
  288. #define ROUND_UP(X)    ((X + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1))
  289.  
  290. #define NEED_RE 1
  291. #define NEED_PL  2
  292. #define NEED_CL 4
  293. #define NEED_CE 8
  294. #define NEED_SP 16
  295.  
  296. #define PREV_SESS_DEV (sizeof(dev_t) >= 4 ? 0x7ffffffd : 0x7ffd)
  297. #define TABLE_INODE (sizeof(ino_t) >= 4 ? 0x7ffffffe : 0x7ffe)
  298. #define UNCACHED_INODE (sizeof(ino_t) >= 4 ? 0x7fffffff : 0x7fff)
  299. #define UNCACHED_DEVICE (sizeof(dev_t) >= 4 ? 0x7fffffff : 0x7fff)
  300.  
  301. #ifdef VMS
  302. #define STAT_INODE(X) (X.st_ino[0])
  303. #define PATH_SEPARATOR ']'
  304. #define SPATH_SEPARATOR ""
  305. #else
  306. #define STAT_INODE(X) (X.st_ino)
  307. #define PATH_SEPARATOR '/'
  308. #define SPATH_SEPARATOR "/"
  309. #endif
  310.  
  311. /*
  312.  * When using multi-session, indicates that we can reuse the
  313.  * TRANS.TBL information for this directory entry.  If this flag
  314.  * is set for all entries in a directory, it means we can just
  315.  * reuse the TRANS.TBL and not generate a new one.
  316.  */
  317. #define SAFE_TO_REUSE_TABLE_ENTRY  1
  318. /*
  319.  * Volume sequence number to use in all of the iso directory records.
  320.  */
  321. #define DEF_VSN        1
  322.  
  323. /*
  324.  * Make sure we have a definition for this.  If not, take a very conservative
  325.  * guess.  From what I can tell SunOS is the only one with this trouble.
  326.  */
  327. #ifndef NAME_MAX
  328. #ifdef FILENAME_MAX
  329. #define NAME_MAX    FILENAME_MAX
  330. #else
  331. #define NAME_MAX    128
  332. #endif
  333. #endif
  334.