home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / cdrom / mkisofs.105 / source / mkisofs.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  8KB  |  265 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. /* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
  23.  
  24. #include <stdio.h>
  25.  
  26. /* This symbol is used to indicate that we do not have things like
  27.    symlinks, devices, and so forth available.  Just files and dirs */
  28.  
  29. #ifdef VMS
  30. #define NON_UNIXFS
  31. #endif
  32.  
  33. #ifdef DJGPP
  34. #define NON_UNIXFS
  35. #endif
  36.  
  37. #ifdef VMS
  38. #include <sys/dir.h>
  39. #define dirent direct
  40. #else
  41. #include <dirent.h>
  42. #endif
  43.  
  44. #include <string.h>
  45. #include <sys/types.h>
  46. #include <sys/stat.h>
  47.  
  48. #ifdef linux
  49. #include <sys/dir.h>
  50. #endif
  51.  
  52. #ifdef ultrix
  53. extern char *strdup();
  54. #endif
  55.  
  56. #ifdef __STDC__
  57. #define DECL(NAME,ARGS) NAME ARGS
  58. #define FDECL1(NAME,TYPE0, ARG0) \
  59.     NAME(TYPE0 ARG0)
  60. #define FDECL2(NAME,TYPE0, ARG0,TYPE1, ARG1) \
  61.     NAME(TYPE0 ARG0, TYPE1 ARG1)
  62. #define FDECL3(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2) \
  63.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2)
  64. #define FDECL4(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3) \
  65.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3)
  66. #define FDECL5(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4) \
  67.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3, TYPE4 ARG4)
  68. #define FDECL6(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4, TYPE5, ARG5) \
  69.     NAME(TYPE0 ARG0, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3, TYPE4 ARG4, TYPE5 ARG5)
  70. #else
  71. #define DECL(NAME,ARGS) NAME()
  72. #define FDECL1(NAME,TYPE0, ARG0) NAME(ARG0) TYPE0 ARG0;
  73. #define FDECL2(NAME,TYPE0, ARG0,TYPE1, ARG1) NAME(ARG0, ARG1) TYPE0 ARG0; TYPE1 ARG1;
  74. #define FDECL3(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2) \
  75.     NAME(ARG0, ARG1, ARG2) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2;
  76. #define FDECL4(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3) \
  77.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3;
  78. #define FDECL5(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4) \
  79.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3; TYPE4 ARG4;
  80. #define FDECL6(NAME,TYPE0, ARG0,TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3, TYPE4, ARG4, TYPE5, ARG5) \
  81.     NAME(ARG0, ARG1, ARG2, ARG3, ARG4, ARG5) TYPE0 ARG0; TYPE1 ARG1; TYPE2 ARG2; TYPE3 ARG3; TYPE4 ARG4; TYPE5 ARG5;
  82. #define const
  83. #endif
  84.  
  85.  
  86. #ifdef __svr4__
  87. #include <stdlib.h>
  88. #else
  89. extern int optind;
  90. extern char *optarg;
  91. /* extern int getopt (int __argc, char **__argv, char *__optstring); */
  92. #endif
  93.  
  94. #include "iso9660.h"
  95. #include "defaults.h"
  96.  
  97. struct directory_entry{
  98.   struct directory_entry * next;
  99.   struct iso_directory_record isorec;
  100.   unsigned int starting_block;
  101.   unsigned int size;
  102.   unsigned int priority;
  103.   char * name;
  104.   char * table;
  105.   char * whole_name;
  106.   struct directory * filedir;
  107.   struct directory_entry * parent_rec;
  108.   unsigned int flags;
  109.   ino_t inode;  /* Used in the hash table */
  110.   dev_t dev;  /* Used in the hash table */
  111.   unsigned char * rr_attributes;
  112.   unsigned int rr_attr_size;
  113.   unsigned int total_rr_attr_size;
  114. };
  115.  
  116. struct file_hash{
  117.   struct file_hash * next;
  118.   ino_t inode;  /* Used in the hash table */
  119.   dev_t dev;  /* Used in the hash table */
  120.   unsigned int starting_block;
  121.   unsigned int size;
  122. };
  123.   
  124. struct directory{
  125.   struct directory * next;  /* Next directory at same level as this one */
  126.   struct directory * subdir; /* First subdirectory in this directory */
  127.   struct directory * parent;
  128.   struct directory_entry * contents;
  129.   struct directory_entry * self;
  130.   char * whole_name;  /* Entire path */
  131.   char * de_name;  /* Entire path */
  132.   unsigned int ce_bytes;  /* Number of bytes of CE entries reqd for this dir */
  133.   unsigned int depth;
  134.   unsigned int size;
  135.   unsigned int extent;
  136.   unsigned short path_index;
  137. };
  138.  
  139. struct deferred{
  140.   struct deferred * next;
  141.   unsigned int starting_block;
  142.   char * name;
  143.   struct directory * filedir;
  144.   unsigned int flags;
  145. };
  146.  
  147. #ifdef ADD_FILES
  148. struct file_adds {
  149.   char *name;
  150.   struct file_adds *child;
  151.   struct file_adds *next;
  152.   int add_count;
  153.   int used;
  154.   struct dirent de;
  155.   struct {
  156.     char *path;
  157.     char *name;
  158.   } *adds;
  159. };
  160. extern struct file_adds *root_file_adds;
  161.  
  162. #endif
  163.  
  164. extern void DECL(sort_n_finish,(struct directory *));
  165. extern int goof;
  166. extern struct directory * root;
  167. extern struct directory * reloc_dir;
  168. extern unsigned int next_extent;
  169. extern unsigned int last_extent;
  170. extern unsigned int path_table_size;
  171. extern unsigned int path_table[4];
  172. extern unsigned int path_blocks;
  173. extern char * path_table_l;
  174. extern char * path_table_m;
  175. extern struct iso_directory_record root_record;
  176.  
  177. extern int use_RockRidge;
  178. extern int rationalize;
  179. extern int follow_links;
  180. extern int verbose;
  181. extern int all_files;
  182. extern int generate_tables;
  183. extern int omit_period;
  184. extern int omit_version_number;
  185. extern int transparent_compression;
  186. extern int RR_relocation_depth;
  187. extern int full_iso9660_filenames;
  188.  
  189. extern int DECL(scan_directory_tree,(char * path, struct directory_entry * self));
  190. extern void DECL(dump_tree,(struct directory * node));
  191. extern void DECL(assign_directory_addresses,(struct directory * root));
  192.  
  193. extern int DECL(iso9660_file_length,(const char* name, 
  194.                    struct directory_entry * sresult, int flag));
  195. extern int DECL(iso_write,(FILE * outfile));
  196. extern void generate_path_tables();
  197. extern void DECL(generate_iso9660_directories,(struct directory *, FILE*));
  198. extern void DECL(generate_one_directory,(struct directory *, FILE*));
  199. extern void generate_root_record();
  200. extern int DECL(iso9660_date,(char *, time_t));
  201. extern void DECL(add_hash,(struct directory_entry *));
  202. extern struct file_hash * DECL(find_hash,(dev_t, ino_t));
  203. extern void DECL(add_directory_hash,(dev_t, ino_t));
  204. extern struct file_hash * DECL(find_directory_hash,(dev_t, ino_t));
  205. extern void flush_file_hash();
  206. extern int DECL(delete_file_hash,(struct directory_entry *));
  207. extern struct directory_entry * DECL(find_file_hash,(char *));
  208. extern void DECL(add_file_hash,(struct directory_entry *));
  209. extern void finish_cl_pl_entries();
  210. extern int DECL(get_733,(char *));
  211.  
  212. extern void DECL(set_723,(char *, unsigned int));
  213. extern void DECL(set_733,(char *, unsigned int));
  214. extern void DECL(sort_directory,(struct directory_entry **));
  215. extern int DECL(generate_rock_ridge_attributes,(char *, char *,
  216.                       struct directory_entry *, 
  217.                       struct stat *, struct stat *,
  218.                       int  deep_flag));
  219. extern char * DECL(generate_rr_extension_record,(char * id,  char  * descriptor,
  220.                     char * source, int  * size));
  221.  
  222. extern char * extension_record;
  223. extern int extension_record_extent;
  224. extern int n_data_extents;
  225.  
  226. /* These are a few goodies that can be specified on the command line, and  are
  227.    filled into the root record */
  228.  
  229. extern char * preparer;
  230. extern char * publisher;
  231. extern char * copyright;
  232. extern char * biblio;
  233. extern char * abstract;
  234. extern char * appid;
  235. extern char * volset_id;
  236. extern char * system_id;
  237. extern char * volume_id;
  238.  
  239. extern void * DECL(e_malloc,(size_t));
  240.  
  241.  
  242. #define SECTOR_SIZE (2048)
  243. #define ROUND_UP(X)    ((X + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1))
  244.  
  245. #define NEED_RE 1
  246. #define NEED_PL  2
  247. #define NEED_CL 4
  248. #define NEED_CE 8
  249. #define NEED_SP 16
  250.  
  251. #define TABLE_INODE (sizeof(ino_t) >= 4 ? 0x7ffffffe : 0x7ffe)
  252. #define UNCACHED_INODE (sizeof(ino_t) >= 4 ? 0x7fffffff : 0x7fff)
  253. #define UNCACHED_DEVICE (sizeof(dev_t) >= 4 ? 0x7fffffff : 0x7fff)
  254.  
  255. #ifdef VMS
  256. #define STAT_INODE(X) (X.st_ino[0])
  257. #define PATH_SEPARATOR ']'
  258. #define SPATH_SEPARATOR ""
  259. #else
  260. #define STAT_INODE(X) (X.st_ino)
  261. #define PATH_SEPARATOR '/'
  262. #define SPATH_SEPARATOR "/"
  263. #endif
  264.  
  265.