configure: when detecting linux include directory for kernel compiler use target...
[AROS.git] / rom / filesys / CDVDFS / src / generic.h
blob0d521de6246210019cfe0d58bacb7c6b77a49ee9
1 /* generic.h: */
3 #ifndef _GENERIC_H_
4 #define _GENERIC_H_
6 #include "cdrom.h"
8 typedef uint32_t t_ulong;
9 typedef unsigned short t_ushort;
10 typedef unsigned char t_uchar;
11 typedef int t_bool;
13 typedef struct path_node *t_path_list;
15 typedef enum protocol {
16 PRO_UNKNOWN,
17 PRO_ISO,
18 PRO_HIGH_SIERRA,
19 PRO_ROCK,
20 PRO_HFS,
21 PRO_JOLIET
22 } t_protocol;
24 typedef struct VOLUME {
25 struct CDVDBase *global;
26 CDROM *cd; /* Pointer to CDROM structure */
27 t_protocol protocol; /* Protocol used */
28 const struct handler *handler; /* Pointer to handler struct */
29 void *vol_info; /* Depends on protocol */
30 size_t vol_info_size; /* Size of vol_info structure */
31 t_bool mixed_char_filenames; /* Filenames may contain upper
32 and lower case characters */
33 /* for use by the device handler: */
34 #if 0
35 t_bool valid; /* Is the volume valid? */
36 #endif
37 int locks; /* Number of locks on this vol. */
38 int file_handles; /* Number of file handles on */
39 /* this volume */
40 struct DeviceList *devlist; /* Associated DOS device list */
41 unsigned char buffer[256]; /* Buffer for directory record */
42 } VOLUME;
44 typedef struct CDROM_OBJ {
45 struct CDVDBase *global;
46 t_bool directory_f; /* TRUE iff object is a directory */
47 t_bool symlink_f; /* TRUE iff object is a symbolic link */
48 uint32_t protection; /* Amiga protection bits */
49 VOLUME *volume; /* Pointer to volume node */
50 uint32_t pos; /* Current position (for read & seek) */
51 t_path_list pathlist; /* List containing full path name */
52 void *obj_info; /* Depends on protocol */
53 } CDROM_OBJ;
55 typedef struct CDROM_INFO {
56 t_bool directory_f; /* TRUE if object is a directory */
57 t_bool symlink_f; /* TRUE if object is a symbolic link */
58 int name_length; /* length of file name */
59 char name[256]; /* file name */
60 uint32_t date; /* creation date */
61 uint32_t file_length; /* length of file */
62 uint32_t protection; /* Amiga protection bits */
63 int comment_length; /* length of file comment */
64 char comment[256]; /* file comment */
65 void *suppl_info; /* supplementary information */
66 } CDROM_INFO;
68 /* Codes: M=mandatory,
69 * O=optional (may be NULL)
72 typedef struct handler {
73 /*M*/ void (*close_vol_info)(VOLUME *);
74 /*M*/ CDROM_OBJ *(*open_top_level_directory)(VOLUME *);
75 /*M*/ CDROM_OBJ *(*open_obj_in_directory)(CDROM_OBJ *, char *);
76 /*M*/ CDROM_OBJ *(*find_parent)(CDROM_OBJ *);
77 /*M*/ void (*close_obj)(CDROM_OBJ *);
78 /*M*/ int (*read_from_file)(CDROM_OBJ *, char *, int);
79 /*M*/ t_bool (*cdrom_info)(CDROM_OBJ *, CDROM_INFO *);
80 /*M*/ t_bool (*examine_next)(CDROM_OBJ *, CDROM_INFO *, uint32_t *);
81 /*M*/ void *(*clone_obj_info)(void *);
82 /*M*/ t_bool (*is_top_level_obj)(CDROM_OBJ *);
83 /*M*/ t_bool (*same_objects)(CDROM_OBJ *, CDROM_OBJ *);
84 /*O*/ t_ulong (*creation_date)(VOLUME *);
85 /*M*/ t_ulong (*volume_size)(VOLUME *);
86 /*M*/ void (*volume_id)(VOLUME *, char *, int);
87 /*M*/ t_ulong (*location)(CDROM_OBJ *);
88 /*M*/ t_ulong (*file_length)(CDROM_OBJ *);
89 /*M*/ t_ulong (*block_size)(VOLUME *);
90 } t_handler;
92 #define ISOERR_NO_MEMORY 1 /* out of memory */
93 #define ISOERR_SCSI_ERROR 2 /* scsi command return with err */
94 #define ISOERR_NO_PVD 3 /* prim volume descr not found */
95 #define ISOERR_ILLEGAL_NAME 4 /* illegal path name */
96 #define ISOERR_NO_SUCH_RECORD 5 /* no such record in path table */
97 #define ISOERR_NOT_FOUND 6 /* file not found */
98 #define ISOERR_OFF_BOUNDS 7 /* bad seek operation */
99 #define ISOERR_BAD_ARGUMENTS 8 /* bad arguments */
100 #define ISOERR_IS_SYMLINK 9 /* cannot open symbolic links */
101 #define ISOERR_INTERNAL 10 /* reason unknown */
103 #define SEEK_FROM_START -1 /* values for */
104 #define SEEK_FROM_CURRENT_POS 0 /* the 'Seek_Position' */
105 #define SEEK_FROM_END 1 /* function */
107 extern int iso_errno;
109 t_protocol Which_Protocol
110 (CDROM *p_cdrom, t_bool p_use_rock_ridge, t_bool p_use_joliet,
111 int *p_skip, t_ulong *p_offset, t_ulong *p_svd_offset);
113 VOLUME *Open_Volume(CDROM *p_cdrom, t_bool p_use_rock_ridge, t_bool p_use_joliet);
114 void Close_Volume(VOLUME *p_volume);
116 CDROM_OBJ *Open_Top_Level_Directory(VOLUME *p_volume);
117 CDROM_OBJ *Open_Object(CDROM_OBJ *p_current_dir, char *p_path_name);
118 void Close_Object(CDROM_OBJ *p_object);
120 int Read_From_File(CDROM_OBJ *p_file, char *p_buffer, int p_buffer_length);
122 int CDROM_Info(CDROM_OBJ *p_obj, CDROM_INFO *p_info);
123 t_bool Examine_Next
124 (CDROM_OBJ *p_dir, CDROM_INFO *p_info, uint32_t *p_offset);
126 CDROM_OBJ *Clone_Object(CDROM_OBJ *p_object);
127 CDROM_OBJ *Find_Parent(CDROM_OBJ *p_object);
129 t_bool Is_Top_Level_Object (CDROM_OBJ *p_object);
131 int Seek_Position (CDROM_OBJ *p_object, long p_offset, int p_mode);
133 t_bool Same_Objects (CDROM_OBJ *p_object1, CDROM_OBJ *p_object2);
134 t_ulong Volume_Creation_Date(VOLUME *p_volume);
135 t_ulong Volume_Size (VOLUME *p_volume);
136 t_ulong Block_Size (VOLUME *p_volume);
137 void Volume_ID(VOLUME *p_volume, char *p_buffer, int p_buf_length );
138 t_ulong Location (CDROM_OBJ *p_object);
139 int Full_Path_Name(CDROM_OBJ *p_obj, char *p_buf, int p_buf_length);
141 int Strncasecmp(char *p_str1, char *p_str2, int p_length);
142 #endif /* _GENERIC_H_ */