2 * This file has been modified for the cdrkit suite.
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).
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.
13 /* @(#)hfs.h 1.4 01/11/01 joerg */
15 * hfsutils - tools for reading and writing Macintosh HFS volumes
16 * Copyright (C) 1996, 1997 Robert Leslie
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.
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.
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.
41 /* don't need device locking for mkhybrid */
44 #endif /* NODEVLOCKS */
46 #endif /* APPLE_HYB */
48 # define HFS_BLOCKSZ 512
49 # define HFS_MAX_FLEN 31
50 # define HFS_MAX_VLEN 27
52 typedef struct _hfsvol_ hfsvol;
53 typedef struct _hfsfile_ hfsfile;
54 typedef struct _hfsdir_ hfsdir;
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 */
65 /* taken from v3.2.6 */
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 */
72 time_t crdate; /* date of creation */
73 time_t mddate; /* date of last modification */
74 time_t bkdate; /* date of last backup */
76 short fdflags; /* Macintosh Finder flags */
79 signed short v; /* Finder icon vertical coordinate */
80 signed short h; /* horizontal coordinate */
85 unsigned long dsize; /* size of data fork */
86 unsigned long rsize; /* size of resource fork */
88 char type[5]; /* file type code (plus null) */
89 char creator[5]; /* file creator code (plus null) */
93 unsigned short valence; /* number of items in directory */
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 */
103 signed short view; /* Folder's view */
106 signed short v; /* Scoll vertical position */
107 signed short h; /* Scoll horizontal position */
114 # define HFS_ISDIR 0x01
115 # define HFS_ISLOCKED 0x02
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
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)
138 extern char *hfs_error;
139 /*extern unsigned char hfs_charorder[];*/
142 hfsvol *hfs_mount(hce_mem *, int, int);
144 hfsvol *hfs_mount(char *, int, int);
145 #endif /* APPLE_HYB */
147 int hfs_flush(hfsvol *);
148 void hfs_flushall(void);
150 int hfs_umount(hfsvol *, long, long);
152 int hfs_umount(hfsvol *);
153 #endif /* APPLE_HYB */
154 void hfs_umountall(void);
155 hfsvol *hfs_getvol(char *);
156 void hfs_setvol(hfsvol *);
158 int hfs_vstat(hfsvol *, hfsvolent *);
160 int hfs_format(hce_mem *, int, char *);
162 int hfs_format(char *, int, char *);
163 #endif /* APPLE_HYB */
165 int hfs_chdir(hfsvol *, char *);
166 long hfs_getcwd(hfsvol *);
167 int hfs_setcwd(hfsvol *, long);
168 int hfs_dirinfo(hfsvol *, long *, char *);
170 hfsdir *hfs_opendir(hfsvol *, char *);
171 int hfs_readdir(hfsdir *, hfsdirent *);
172 int hfs_closedir(hfsdir *);
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);
182 int hfs_close(hfsfile *, long, long);
184 int hfs_close(hfsfile *);
185 #endif /* APPLE_HYB */
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 *);
192 int hfs_mkdir(hfsvol *, char *);
193 int hfs_rmdir(hfsvol *, char *);
195 int hfs_create(hfsvol *, char *, char *, char *);
196 int hfs_delete(hfsvol *, char *);
198 int hfs_rename(hfsvol *, char *, char *);
200 int f_trunc(hfsfile *file);
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 */