patch: make *outfile extern
[platform/upstream/cdrkit.git] / libhfs_iso / hfs.h
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)hfs.h    1.4 01/11/01 joerg */
14 /*
15  * hfsutils - tools for reading and writing Macintosh HFS volumes
16  * Copyright (C) 1996, 1997 Robert Leslie
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31  */
32 #ifndef HFS_H
33 #define HFS_H
34
35 #include <timedefs.h>
36 #include <standard.h>
37
38 #ifdef APPLE_HYB
39 #include "hybrid.h"
40
41 /* don't need device locking for mkhybrid */
42 #ifndef NODEVLOCKS
43 #define NODEVLOCKS
44 #endif /* NODEVLOCKS */
45
46 #endif /* APPLE_HYB */
47
48 # define HFS_BLOCKSZ    512
49 # define HFS_MAX_FLEN   31
50 # define HFS_MAX_VLEN   27
51
52 typedef struct _hfsvol_  hfsvol;
53 typedef struct _hfsfile_ hfsfile;
54 typedef struct _hfsdir_  hfsdir;
55
56 typedef struct {
57   char name[HFS_MAX_VLEN + 1];  /* name of volume */
58   int flags;                    /* volume flags */
59   unsigned long totbytes;       /* total bytes on volume */
60   unsigned long freebytes;      /* free bytes on volume */
61   time_t crdate;                /* volume creation date */
62   time_t mddate;                /* last volume modification date */
63 } hfsvolent;
64
65 /* taken from v3.2.6 */
66 typedef struct {
67   char name[HFS_MAX_FLEN + 1];  /* catalog name (MacOS Standard Roman) */
68   int flags;                    /* bit flags */
69   unsigned long cnid;           /* catalog node id (CNID) */
70   unsigned long parid;          /* CNID of parent directory */
71
72   time_t crdate;                /* date of creation */
73   time_t mddate;                /* date of last modification */
74   time_t bkdate;                /* date of last backup */
75
76   short fdflags;                /* Macintosh Finder flags */
77
78   struct {
79     signed short v;             /* Finder icon vertical coordinate */
80     signed short h;             /* horizontal coordinate */
81   } fdlocation;
82
83   union {
84     struct {
85       unsigned long dsize;      /* size of data fork */
86       unsigned long rsize;      /* size of resource fork */
87
88       char type[5];             /* file type code (plus null) */
89       char creator[5];          /* file creator code (plus null) */
90     } file;
91
92     struct {
93       unsigned short valence;   /* number of items in directory */
94
95       struct {
96         signed short top;       /* top edge of folder's rectangle */
97         signed short left;      /* left edge */
98         signed short bottom;    /* bottom edge */
99         signed short right;     /* right edge */
100       } rect;
101
102       /* mkhybrid extra */
103       signed short view;        /* Folder's view */
104
105       struct {
106         signed short v;         /* Scoll vertical position */
107         signed short h;         /* Scoll horizontal position */
108       } frscroll;
109     } dir;
110   } u;
111 } hfsdirent;
112
113
114 # define HFS_ISDIR              0x01
115 # define HFS_ISLOCKED           0x02
116
117 # define HFS_CNID_ROOTPAR       1
118 # define HFS_CNID_ROOTDIR       2
119 # define HFS_CNID_EXT           3
120 # define HFS_CNID_CAT           4
121 # define HFS_CNID_BADALLOC      5
122
123 # define HFS_FNDR_ISONDESK              (1 <<  0)
124 # define HFS_FNDR_COLOR                 0x0e
125 # define HFS_FNDR_COLORRESERVED         (1 <<  4)
126 # define HFS_FNDR_REQUIRESSWITCHLAUNCH  (1 <<  5)
127 # define HFS_FNDR_ISSHARED              (1 <<  6)
128 # define HFS_FNDR_HASNOINITS            (1 <<  7)
129 # define HFS_FNDR_HASBEENINITED         (1 <<  8)
130 # define HFS_FNDR_RESERVED              (1 <<  9)
131 # define HFS_FNDR_HASCUSTOMICON         (1 << 10)
132 # define HFS_FNDR_ISSTATIONERY          (1 << 11)
133 # define HFS_FNDR_NAMELOCKED            (1 << 12)
134 # define HFS_FNDR_HASBUNDLE             (1 << 13)
135 # define HFS_FNDR_ISINVISIBLE           (1 << 14)
136 # define HFS_FNDR_ISALIAS               (1 << 15)
137
138 extern char *hfs_error;
139 /*extern unsigned char hfs_charorder[];*/
140
141 #ifdef APPLE_HYB
142 hfsvol *hfs_mount(hce_mem *, int, int);
143 #else
144 hfsvol *hfs_mount(char *, int, int);
145 #endif /* APPLE_HYB */
146
147 int hfs_flush(hfsvol *);
148 void hfs_flushall(void);
149 #ifdef APPLE_HYB
150 int hfs_umount(hfsvol *, long, long);
151 #else
152 int hfs_umount(hfsvol *);
153 #endif /* APPLE_HYB */
154 void hfs_umountall(void);
155 hfsvol *hfs_getvol(char *);
156 void hfs_setvol(hfsvol *);
157
158 int hfs_vstat(hfsvol *, hfsvolent *);
159 #ifdef APPLE_HYB
160 int hfs_format(hce_mem *, int, char *);
161 #else
162 int hfs_format(char *, int, char *);
163 #endif /* APPLE_HYB */
164
165 int hfs_chdir(hfsvol *, char *);
166 long hfs_getcwd(hfsvol *);
167 int hfs_setcwd(hfsvol *, long);
168 int hfs_dirinfo(hfsvol *, long *, char *);
169
170 hfsdir *hfs_opendir(hfsvol *, char *);
171 int hfs_readdir(hfsdir *, hfsdirent *);
172 int hfs_closedir(hfsdir *);
173
174 hfsfile *hfs_open(hfsvol *, char *);
175 int hfs_setfork(hfsfile *, int);
176 int hfs_getfork(hfsfile *);
177 long hfs_read(hfsfile *, void *, unsigned long);
178 long hfs_write(hfsfile *, void *, unsigned long);
179 int hfs_truncate(hfsfile *, unsigned long);
180 long hfs_lseek(hfsfile *, long, int);
181 #ifdef APPLE_HYB
182 int hfs_close(hfsfile *, long, long);
183 #else
184 int hfs_close(hfsfile *);
185 #endif /* APPLE_HYB */
186
187 int hfs_stat(hfsvol *, char *, hfsdirent *);
188 int hfs_fstat(hfsfile *, hfsdirent *);
189 int hfs_setattr(hfsvol *, char *, hfsdirent *);
190 int hfs_fsetattr(hfsfile *, hfsdirent *);
191
192 int hfs_mkdir(hfsvol *, char *);
193 int hfs_rmdir(hfsvol *, char *);
194
195 int hfs_create(hfsvol *, char *, char *, char *);
196 int hfs_delete(hfsvol *, char *);
197
198 int hfs_rename(hfsvol *, char *, char *);
199
200 int f_trunc(hfsfile *file);
201
202 #ifdef APPLE_HYB
203 unsigned short hfs_get_drAllocPtr(hfsfile *);
204 int hfs_set_drAllocPtr(hfsfile *, unsigned short, int size);
205 void hfs_vsetbless(hfsvol *, unsigned long);
206 #endif /* APPLE_HYB */
207
208 #endif