|
|
1.1 ! root 1: /* ! 2: * libhfs - library for reading and writing Macintosh HFS volumes ! 3: * Copyright (C) 1996-1998 Robert Leslie ! 4: * ! 5: * This program is free software; you can redistribute it and/or modify ! 6: * it under the terms of the GNU General Public License as published by ! 7: * the Free Software Foundation; either version 2 of the License, or ! 8: * (at your option) any later version. ! 9: * ! 10: * This program is distributed in the hope that it will be useful, ! 11: * but WITHOUT ANY WARRANTY; without even the implied warranty of ! 12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 13: * GNU General Public License for more details. ! 14: * ! 15: * You should have received a copy of the GNU General Public License ! 16: * along with this program; if not, write to the Free Software ! 17: * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ! 18: * MA 02110-1301, USA. ! 19: * ! 20: * $Id: hfs.h,v 1.11 1998/11/02 22:09:01 rob Exp $ ! 21: */ ! 22: ! 23: # define HFS_BLOCKSZ 512 ! 24: # define HFS_BLOCKSZ_BITS 9 ! 25: ! 26: # define HFS_MAX_FLEN 31 ! 27: # define HFS_MAX_VLEN 27 ! 28: ! 29: typedef struct _hfsvol_ hfsvol; ! 30: typedef struct _hfsfile_ hfsfile; ! 31: typedef struct _hfsdir_ hfsdir; ! 32: ! 33: typedef struct { ! 34: char name[HFS_MAX_VLEN + 1]; /* name of volume (MacOS Standard Roman) */ ! 35: int flags; /* volume flags */ ! 36: ! 37: unsigned long totbytes; /* total bytes on volume */ ! 38: unsigned long freebytes; /* free bytes on volume */ ! 39: ! 40: unsigned long alblocksz; /* volume allocation block size */ ! 41: unsigned long clumpsz; /* default file clump size */ ! 42: ! 43: unsigned long numfiles; /* number of files in volume */ ! 44: unsigned long numdirs; /* number of directories in volume */ ! 45: ! 46: time_t crdate; /* volume creation date */ ! 47: time_t mddate; /* last volume modification date */ ! 48: time_t bkdate; /* last volume backup date */ ! 49: ! 50: unsigned long blessed; /* CNID of MacOS System Folder */ ! 51: } hfsvolent; ! 52: ! 53: typedef struct { ! 54: char name[HFS_MAX_FLEN + 1]; /* catalog name (MacOS Standard Roman) */ ! 55: int flags; /* bit flags */ ! 56: unsigned long cnid; /* catalog node id (CNID) */ ! 57: unsigned long parid; /* CNID of parent directory */ ! 58: ! 59: time_t crdate; /* date of creation */ ! 60: time_t mddate; /* date of last modification */ ! 61: time_t bkdate; /* date of last backup */ ! 62: ! 63: short fdflags; /* Macintosh Finder flags */ ! 64: ! 65: struct { ! 66: signed short v; /* Finder icon vertical coordinate */ ! 67: signed short h; /* horizontal coordinate */ ! 68: } fdlocation; ! 69: ! 70: union { ! 71: struct { ! 72: unsigned long dsize; /* size of data fork */ ! 73: unsigned long rsize; /* size of resource fork */ ! 74: ! 75: char type[5]; /* file type code (plus null) */ ! 76: char creator[5]; /* file creator code (plus null) */ ! 77: } file; ! 78: ! 79: struct { ! 80: unsigned short valence; /* number of items in directory */ ! 81: ! 82: struct { ! 83: signed short top; /* top edge of folder's rectangle */ ! 84: signed short left; /* left edge */ ! 85: signed short bottom; /* bottom edge */ ! 86: signed short right; /* right edge */ ! 87: } rect; ! 88: } dir; ! 89: } u; ! 90: } hfsdirent; ! 91: ! 92: # define HFS_ISDIR 0x0001 ! 93: # define HFS_ISLOCKED 0x0002 ! 94: ! 95: # define HFS_CNID_ROOTPAR 1 ! 96: # define HFS_CNID_ROOTDIR 2 ! 97: # define HFS_CNID_EXT 3 ! 98: # define HFS_CNID_CAT 4 ! 99: # define HFS_CNID_BADALLOC 5 ! 100: ! 101: # define HFS_FNDR_ISONDESK (1 << 0) ! 102: # define HFS_FNDR_COLOR 0x0e ! 103: # define HFS_FNDR_COLORRESERVED (1 << 4) ! 104: # define HFS_FNDR_REQUIRESSWITCHLAUNCH (1 << 5) ! 105: # define HFS_FNDR_ISSHARED (1 << 6) ! 106: # define HFS_FNDR_HASNOINITS (1 << 7) ! 107: # define HFS_FNDR_HASBEENINITED (1 << 8) ! 108: # define HFS_FNDR_RESERVED (1 << 9) ! 109: # define HFS_FNDR_HASCUSTOMICON (1 << 10) ! 110: # define HFS_FNDR_ISSTATIONERY (1 << 11) ! 111: # define HFS_FNDR_NAMELOCKED (1 << 12) ! 112: # define HFS_FNDR_HASBUNDLE (1 << 13) ! 113: # define HFS_FNDR_ISINVISIBLE (1 << 14) ! 114: # define HFS_FNDR_ISALIAS (1 << 15) ! 115: ! 116: extern const char *hfs_error; ! 117: extern const unsigned char hfs_charorder[]; ! 118: ! 119: # define HFS_MODE_RDONLY 0 ! 120: # define HFS_MODE_RDWR 1 ! 121: # define HFS_MODE_ANY 2 ! 122: ! 123: # define HFS_MODE_MASK 0x0003 ! 124: ! 125: # define HFS_OPT_NOCACHE 0x0100 ! 126: # define HFS_OPT_2048 0x0200 ! 127: # define HFS_OPT_ZERO 0x0400 ! 128: ! 129: # define HFS_SEEK_SET 0 ! 130: # define HFS_SEEK_CUR 1 ! 131: # define HFS_SEEK_END 2 ! 132: ! 133: hfsvol *hfs_mount( int os_fd, int); ! 134: int hfs_flush(hfsvol *); ! 135: void hfs_flushall(void); ! 136: int hfs_umount(hfsvol *); ! 137: void hfs_umountall(void); ! 138: hfsvol *hfs_getvol(const char *); ! 139: void hfs_setvol(hfsvol *); ! 140: ! 141: int hfs_vstat(hfsvol *, hfsvolent *); ! 142: int hfs_vsetattr(hfsvol *, hfsvolent *); ! 143: ! 144: int hfs_chdir(hfsvol *, const char *); ! 145: unsigned long hfs_getcwd(hfsvol *); ! 146: int hfs_setcwd(hfsvol *, unsigned long); ! 147: int hfs_dirinfo(hfsvol *, unsigned long *, char *); ! 148: ! 149: hfsdir *hfs_opendir(hfsvol *, const char *); ! 150: int hfs_readdir(hfsdir *, hfsdirent *); ! 151: int hfs_closedir(hfsdir *); ! 152: ! 153: hfsfile *hfs_create(hfsvol *, const char *, const char *, const char *); ! 154: hfsfile *hfs_open(hfsvol *, const char *); ! 155: int hfs_setfork(hfsfile *, int); ! 156: int hfs_getfork(hfsfile *); ! 157: unsigned long hfs_read(hfsfile *, void *, unsigned long); ! 158: unsigned long hfs_write(hfsfile *, const void *, unsigned long); ! 159: int hfs_truncate(hfsfile *, unsigned long); ! 160: unsigned long hfs_seek(hfsfile *, long, int); ! 161: int hfs_close(hfsfile *); ! 162: ! 163: int hfs_stat(hfsvol *, const char *, hfsdirent *); ! 164: int hfs_fstat(hfsfile *, hfsdirent *); ! 165: int hfs_setattr(hfsvol *, const char *, const hfsdirent *); ! 166: int hfs_fsetattr(hfsfile *, const hfsdirent *); ! 167: ! 168: int hfs_mkdir(hfsvol *, const char *); ! 169: int hfs_rmdir(hfsvol *, const char *); ! 170: ! 171: int hfs_delete(hfsvol *, const char *); ! 172: int hfs_rename(hfsvol *, const char *, const char *); ! 173: ! 174: int hfs_zero(const char *, unsigned int, unsigned long *); ! 175: int hfs_mkpart(const char *, unsigned long); ! 176: int hfs_nparts(const char *); ! 177: ! 178: int hfs_format(const char *, int, int, ! 179: const char *, unsigned int, const unsigned long []); ! 180: int hfs_probe(int fd, long long offset);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.