124 fsw_hfsplus_vol_mount, fsw_hfsplus_vol_free, fsw_hfsplus_vol_stat,
125 fsw_hfsplus_dno_fill, fsw_hfsplus_dno_free, fsw_hfsplus_dno_stat,
126 fsw_hfsplus_get_ext, fsw_hfsplus_dir_get, fsw_hfsplus_dir_read,
127 fsw_hfsplus_readlink, fsw_hfsplus_get_bless_info
154fsw_hfsplus_posix_time(
fsw_u32 t);
289fsw_hfsplus_ucblatin_tolower(
fsw_u16 c);
368fsw_hfsplus_itoa(
fsw_u32 num,
char** dest,
int* len);
380fsw_hfsplus_sconcat(
const char *
const s1,
int len1,
const char *
const s2,
int len2,
char **dest);
400 if (!status && buflen != len)
429 (*btp)->bt_root = fsw_u32_be_swap(hdr_rec.
rootNode);
430 (*btp)->bt_ndsz = fsw_u16_be_swap(hdr_rec.
nodeSize);
484 goto label_read_fail;
493 goto label_read_fail;
545 status = fsw_hfsplus_fswstr2unistr(&(sk.
nodeName), &(d->
g.
name));
550 status = fsw_hfsplus_bt_search(v->
catf,
558 status = fsw_hfsplus_dnid2dnode(v, d->
parent_id, &parent);
563 fsw_hfsplus_dnode_complete(rec, parent, d);
579fsw_hfsplus_posix_time(
fsw_u32 t)
582 return (t > 2082844800) ? t - 2082844800 : 0;
615 child = (
fsw_u32 *)fsw_hfsplus_bt_rec_skip_key(k);
616 return fsw_u32_be_swap(*child);
644 (
fsw_u8 *)fsw_hfsplus_btnode_get_rec(btnode, bt->
bt_ndsz, 0))
652 rec = (lo + hi) >> 1;
653 tk = fsw_hfsplus_btnode_get_rec(btnode, bt->
bt_ndsz, rec);
678 tk = fsw_hfsplus_btnode_get_rec(btnode, bt->
bt_ndsz, hi);
679 node = fsw_hfsplus_bt_idx_get_child(tk);
690 return (a < b) ? -1 : (a > b) ? 1 : 0;
694fsw_hfsplus_ucblatin_tolower(
fsw_u16 c)
698 if (c == 0x00C6 || c == 0x00D0 || c == 0x00D8 || c == 0x00DE ||
699 (c >= 0x0041 && c <= 0x005A))
755 while (t_char == 0 && t_len > 0) {
756 t_char = fsw_hfsplus_ucblatin_tolower(fsw_u16_be_swap(*t_str));
762 while (s_char == 0 && s_len > 0) {
763 s_char = fsw_hfsplus_ucblatin_tolower(*s_str);
769 ret = fsw_hfsplus_int_cmp(t_char, s_char);
770 if (ret || s_char == 0)
794 bc = fsw_u32_be_swap((*er)[i].blockCount);
803 e->
phys_start = fsw_u32_be_swap((*er)[i].startBlock) + off;
853 num_records = fsw_u16_be_swap(btnode->
numRecords);
855 for (i = *rec_num; i < num_records; ++i) {
856 tk = fsw_hfsplus_btnode_get_rec(btnode, bt->
bt_ndsz, i);
862 if (counter++ != *rec_skip) {
866 rec = fsw_hfsplus_bt_rec_skip_key(tk);
882 btnode_next = fsw_u32_be_swap(btnode->
fLink);
883 if (btnode_next == 0) {
887 status = fsw_hfsplus_read(bt, (
fsw_u64) btnode_next * bt->
bt_ndsz,
908 (*d_out)->parent_id = parent_id;
987 status = fsw_hfsplus_dnode_create_minimal(parent->
g.
vol, parent->
g.
dnode_id, dnid, name, d_out);
990 fsw_hfsplus_dnode_complete(rec, parent, *d_out);
1008 status = fsw_hfsplus_fswstr2unistr(&(sk.
nodeName), name);
1024 status = fsw_hfsplus_bt_search(v->
catf,
1026 fsw_hfsplus_cat_cmp,
1035 status = fsw_hfsplus_dnode_create_full(rec, d, name, d_out);
1068 status = fsw_hfsplus_bt_search(v->
catf,
1070 fsw_hfsplus_cat_cmp,
1076 status = fsw_hfsplus_btree_get_rec(v->
catf,
1098 for (i = 0; i < name.
len; i++) {
1104 status = fsw_hfsplus_dnode_create_full(rec, d, &name, d_out);
1113fsw_hfsplus_itoa(
fsw_u32 num,
char** dest,
int*
len)
1126 }
while ((num_copy /= 10) > 0);
1137 (*dest)[i++] = num % 10 +
'0';
1138 }
while ((num /= 10) > 0);
1141 for (i = 0, j = *
len - 1; i < j; i++, j--) {
1143 (*dest)[i] = (*dest)[j];
1150fsw_hfsplus_sconcat(
const char *
const s1,
int len1,
const char *
const s2,
int len2,
char **dest)
1155 status =
fsw_alloc_zero(
sizeof(
char) * (len1 + len2), (
void **) dest);
1160 for (i = 0; i < len1; ++i) {
1164 for (i = 0; i < len2; ++i) {
1165 (*dest)[i + len1] = s2[i];
1178 static const char hlink_prefix[] =
"/\0\0\0\0HFS+ Private Data/iNode";
1179 static const int hlink_prefix_len = 28;
1186 status = fsw_hfsplus_itoa(d->
inode_num, &buf, &buf_len);
1191 status = fsw_hfsplus_sconcat(hlink_prefix, hlink_prefix_len, buf, buf_len, (
char**) &lnk_tgt->
data);
1197 lnk_tgt->
size = (hlink_prefix_len + buf_len) *
sizeof(
char);
1198 lnk_tgt->
len = hlink_prefix_len + buf_len;
1219 status = fsw_hfsplus_bt_search(v->
catf,
1221 fsw_hfsplus_thread_cmp,
1250 status = fsw_hfsplus_fswstr2unistr(&(sk.
nodeName), &name);
1256 status = fsw_hfsplus_bt_search(v->
catf,
1258 fsw_hfsplus_cat_cmp,
1279 status = fsw_hfsplus_dnode_create_minimal(v,
1304 goto free_btnode_thread;
1307 status = fsw_hfsplus_dnid2thread(v, dnid, btnode_thread, &thread);
1312 status = fsw_hfsplus_thread2dnode(v, thread, btnode_dnode, d_out);
1331 switch (bless_type) {
1356 status = fsw_hfsplus_bless_type2dnid(vol, bless_type, &dnid);
1360 status = fsw_hfsplus_dnid2dnode(vol, dnid, dno_out);
#define FSW_MSG_ASSERT(params)
#define FSW_MSG_DEBUG(params)
fsw_status_t fsw_shandle_read(struct fsw_shandle *shand, fsw_u32 *buffer_size_inout, void *buffer_in)
fsw_status_t fsw_block_get(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, fsw_u32 cache_level, void **buffer_out)
fsw_status_t fsw_dnode_create_root(struct fsw_volume *vol, fsw_u32 dnode_id, struct fsw_dnode **dno_out)
void fsw_shandle_close(struct fsw_shandle *shand)
void fsw_set_blocksize(struct fsw_volume *vol, fsw_u32 phys_blocksize, fsw_u32 log_blocksize)
fsw_status_t fsw_shandle_open(struct fsw_dnode *dno, struct fsw_shandle *shand)
void fsw_block_release(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, void *buffer)
fsw_status_t fsw_dnode_readlink_data(struct fsw_dnode *dno, struct fsw_string *link_target)
fsw_status_t fsw_dnode_create(struct fsw_volume *vol, struct fsw_dnode *parent_dno, fsw_u32 dnode_id, int type, struct fsw_string *name, struct fsw_dnode **dno_out)
void fsw_dnode_release(struct fsw_dnode *dno)
void fsw_dnode_retain(struct fsw_dnode *dno)
void fsw_dnode_mkcomplete(struct fsw_dnode *dno)
void fsw_strfree(struct fsw_string *s)
int fsw_strsize(struct fsw_string *s)
#define FSW_FSTYPE_TABLE_NAME(t)
int fsw_strlen(struct fsw_string *s)
@ FSW_EXTENT_TYPE_PHYSBLOCK
fsw_status_t fsw_strdup_coerce(struct fsw_string *dest, int type, struct fsw_string *src)
void * fsw_strdata(struct fsw_string *s)
fsw_status_t fsw_alloc_zero(int len, void **ptr_out)
#define FSW_STRING_TYPE_UTF16_BE
@ BLESSED_TYPE_SYSTEM_FILE
@ BLESSED_TYPE_SYSTEM_FOLDER
@ BLESSED_TYPE_OSX_FOLDER
@ FSW_STRING_TYPE_ISO88591
#define fsw_memcpy(dest, src, size)
#define fsw_alloc(size, ptrptr)
#define kHFSPlusFileThreadRecord
int(* k_cmp_t)(HFSPlusBTKey *, HFSPlusBTKey *)
#define kMasterDirectoryBlock
HFSPlusExtentDescriptor HFSPlusExtentRecord[kHFSPlusExtentDensity]
#define kHFSPlusExtentDensity
#define kHFSPlusHFSPlusCreator
#define kHFSPlusSymlinkType
#define kHFSPlusFolderThreadRecord
#define kHFSPlusFolderRecord
#define kHFSPlusFileRecord
#define kHFSPlusSymlinkCreator
#define kHFSCatalogFileID
#define kHFSPlusHardlinkType
union HFSPlusBSDInfo::@127 special
HFSPlusBSDInfo permissions
HFSPlusExtentRecord extents
fsw_u32 blessedOSXFolderID
fsw_u32 blessedSystemFolderID
fsw_u32 blessedSystemFileID
fsw_u16 unicode[kHFSPlusMaxFileNameChars]
void(* store_attr_posix)(struct fsw_dnode_stat *sb, fsw_u16 posix_mode)
Callbock for storing a Posix-style file mode.
void(* store_time_posix)(struct fsw_dnode_stat *sb, int which, fsw_u32 posix_time)
Callback for storing a Posix-style timestamp.
fsw_u64 used_bytes
Bytes actually used by the file on disk.
struct VOLSTRUCTNAME * vol
The volume this dnode belongs to.
fsw_u32 dnode_id
Unique id number (usually the inode number)
fsw_u64 size
Data size in bytes.
struct DNODESTRUCTNAME * parent
Parent directory dnode.
int type
Type of the dnode - file, dir, symlink, special.
struct fsw_string name
Name of this item in the parent directory.
int type
Type of extent specification.
fsw_u32 log_count
Logical block count.
fsw_u32 log_start
Starting logical block number.
fsw_u32 phys_start
Starting physical block number (for FSW_EXTENT_TYPE_PHYSBLOCK only)
HFSPlusExtentRecord extents
struct fsw_hfsplus_dnode * catf
fsw_u64 pos
Current file pointer in bytes.
void * data
Data pointer (may be NULL if type is EMPTY or len is zero)
int len
Length in characters.
int size
Total data size in bytes.
int type
Encoding of the string - empty, ISO-8859-1, UTF8, UTF16.
fsw_u64 free_bytes
Bytes still available for storing file data.
fsw_u64 total_bytes
Total size of data area size in bytes.
struct fsw_string label
Volume label.
struct DNODESTRUCTNAME * root
Root directory dnode.
HFSPlusCatalogFolder folderRecord
HFSPlusCatalogFile fileRecord