OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
fsw_core.h
Go to the documentation of this file.
1
6/*-
7 * Copyright (c) 2020 Vladislav Yaroshchuk <yaroshchuk2000@gmail.com>
8 * Copyright (c) 2006 Christoph Pfisterer
9 * Portions Copyright (c) The Regents of the University of California.
10 * Portions Copyright (c) UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are
14 * met:
15 *
16 * * Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 *
19 * * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the
22 * distribution.
23 *
24 * * Neither the name of Christoph Pfisterer nor the names of the
25 * contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef _FSW_CORE_H_
42#define _FSW_CORE_H_
43
44#include "fsw_base.h"
45
46
48#define FSW_PATH_MAX (4096)
49
51#define FSW_CONCAT3(a,b,c) a##b##c
53#define FSW_FSTYPE_TABLE_NAME(t) FSW_CONCAT3(fsw_,t,_table)
54
56#define FSW_INVALID_BNO (~0U)
57
58
59//
60// Byte-swapping macros
61//
62
63
69
76
77#define FSW_SWAPVALUE_U16(v) ((((fsw_u16)(v) & 0xff00) >> 8) | \
78 (((fsw_u16)(v) & 0x00ff) << 8))
79#define FSW_SWAPVALUE_U32(v) ((((fsw_u32)(v) & 0xff000000UL) >> 24) | \
80 (((fsw_u32)(v) & 0x00ff0000UL) >> 8) | \
81 (((fsw_u32)(v) & 0x0000ff00UL) << 8) | \
82 (((fsw_u32)(v) & 0x000000ffUL) << 24))
83#define FSW_SWAPVALUE_U64(v) ((((fsw_u64)(v) & 0xff00000000000000ULL) >> 56) | \
84 (((fsw_u64)(v) & 0x00ff000000000000ULL) >> 40) | \
85 (((fsw_u64)(v) & 0x0000ff0000000000ULL) >> 24) | \
86 (((fsw_u64)(v) & 0x000000ff00000000ULL) >> 8) | \
87 (((fsw_u64)(v) & 0x00000000ff000000ULL) << 8) | \
88 (((fsw_u64)(v) & 0x0000000000ff0000ULL) << 24) | \
89 (((fsw_u64)(v) & 0x000000000000ff00ULL) << 40) | \
90 (((fsw_u64)(v) & 0x00000000000000ffULL) << 56))
91
92#ifdef FSW_LITTLE_ENDIAN
93
94#define fsw_u16_le_swap(v) (v)
95#define fsw_u16_be_swap(v) FSW_SWAPVALUE_U16(v)
96#define fsw_u32_le_swap(v) (v)
97#define fsw_u32_be_swap(v) FSW_SWAPVALUE_U32(v)
98#define fsw_u64_le_swap(v) (v)
99#define fsw_u64_be_swap(v) FSW_SWAPVALUE_U64(v)
100
101#define fsw_u16_le_sip(var)
102#define fsw_u16_be_sip(var) (var = FSW_SWAPVALUE_U16(var))
103#define fsw_u32_le_sip(var)
104#define fsw_u32_be_sip(var) (var = FSW_SWAPVALUE_U32(var))
105#define fsw_u64_le_sip(var)
106#define fsw_u64_be_sip(var) (var = FSW_SWAPVALUE_U64(var))
107
108#else
109#ifdef FSW_BIG_ENDIAN
110
111#define fsw_u16_le_swap(v) FSW_SWAPVALUE_U16(v)
112#define fsw_u16_be_swap(v) (v)
113#define fsw_u32_le_swap(v) FSW_SWAPVALUE_U32(v)
114#define fsw_u32_be_swap(v) (v)
115#define fsw_u64_le_swap(v) FSW_SWAPVALUE_U64(v)
116#define fsw_u64_be_swap(v) (v)
117
118#define fsw_u16_le_sip(var) (var = FSW_SWAPVALUE_U16(var))
119#define fsw_u16_be_sip(var)
120#define fsw_u32_le_sip(var) (var = FSW_SWAPVALUE_U32(var))
121#define fsw_u32_be_sip(var)
122#define fsw_u64_le_sip(var) (var = FSW_SWAPVALUE_U64(var))
123#define fsw_u64_be_sip(var)
124
125#else
126#fail Neither FSW_BIG_ENDIAN nor FSW_LITTLE_ENDIAN are defined
127#endif
128#endif
129
133//
134// The following evil hack avoids a lot of casts between generic and fstype-specific
135// structures.
136//
137
138#ifndef VOLSTRUCTNAME
139#define VOLSTRUCTNAME fsw_volume
140#else
141struct VOLSTRUCTNAME;
142#endif
143#ifndef DNODESTRUCTNAME
144#define DNODESTRUCTNAME fsw_dnode
145#else
146struct DNODESTRUCTNAME;
147#endif
148
149
153typedef int fsw_status_t;
154
158enum {
167
168
174 int type;
175 int len;
176 int size;
177 void *data;
178};
179
184enum {
191
192#ifdef FSW_LITTLE_ENDIAN
193#define FSW_STRING_TYPE_UTF16_LE FSW_STRING_TYPE_UTF16
194#define FSW_STRING_TYPE_UTF16_BE FSW_STRING_TYPE_UTF16_SWAPPED
195#else
196#define FSW_STRING_TYPE_UTF16_LE FSW_STRING_TYPE_UTF16_SWAPPED
197#define FSW_STRING_TYPE_UTF16_BE FSW_STRING_TYPE_UTF16
198#endif
199
201#define FSW_STRING_INIT { FSW_STRING_TYPE_EMPTY, 0, 0, NULL }
202
203
204/* forward declarations */
205
206struct fsw_dnode;
207struct fsw_host_table;
208struct fsw_fstype_table;
209
216
238
258
263enum {
270
271enum {
276
288
293enum {
299
311
320
327 void (*store_time_posix)(struct fsw_dnode_stat *sb, int which, fsw_u32 posix_time);
328 void (*store_attr_posix)(struct fsw_dnode_stat *sb, fsw_u16 posix_mode);
329 void *host_data;
330};
331
335enum {
340
346{
348
349 void (*change_blocksize)(struct fsw_volume *vol,
350 fsw_u32 old_phys_blocksize, fsw_u32 old_log_blocksize,
351 fsw_u32 new_phys_blocksize, fsw_u32 new_log_blocksize);
352 fsw_status_t (*read_block)(struct fsw_volume *vol, fsw_u32 phys_bno, void *buffer);
353};
354
360{
364
366 void (*volume_free)(struct VOLSTRUCTNAME *vol);
368
370 void (*dnode_free)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno);
372 struct fsw_dnode_stat *sb);
374 struct fsw_extent *extent);
375
377 struct fsw_string *lookup_name, struct DNODESTRUCTNAME **child_dno);
379 struct fsw_shandle *shand, struct DNODESTRUCTNAME **child_dno);
381 struct fsw_string *link_target);
383};
384
385
390
391fsw_status_t fsw_mount(void *host_data,
392 struct fsw_host_table *host_table,
393 struct fsw_fstype_table *fstype_table,
394 struct fsw_volume **vol_out);
395void fsw_unmount(struct fsw_volume *vol);
397
398void fsw_set_blocksize(struct VOLSTRUCTNAME *vol, fsw_u32 phys_blocksize, fsw_u32 log_blocksize);
399fsw_status_t fsw_block_get(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, fsw_u32 cache_level, void **buffer_out);
400void fsw_block_release(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, void *buffer);
401
409
411fsw_status_t fsw_dnode_create(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *parent_dno, fsw_u32 dnode_id, int type,
412 struct fsw_string *name, struct DNODESTRUCTNAME **dno_out);
414int fsw_dnode_is_root(struct fsw_dnode *dno);
415void fsw_dnode_retain(struct fsw_dnode *dno);
416void fsw_dnode_release(struct fsw_dnode *dno);
417
419fsw_status_t fsw_dnode_stat(struct fsw_dnode *dno, struct fsw_dnode_stat *sb);
420
422 struct fsw_string *lookup_name, struct fsw_dnode **child_dno_out);
424 struct fsw_string *lookup_path, char separator,
425 struct fsw_dnode **child_dno_out);
426fsw_status_t fsw_dnode_dir_read(struct fsw_shandle *shand, struct fsw_dnode **child_dno_out);
427fsw_status_t fsw_dnode_readlink(struct fsw_dnode *dno, struct fsw_string *link_target);
429fsw_status_t fsw_dnode_resolve(struct fsw_dnode *dno, struct fsw_dnode **target_dno_out);
430
431fsw_status_t fsw_dnode_get_path(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_string *out_path);
432fsw_status_t fsw_get_bless_info(struct VOLSTRUCTNAME *vol, int type, struct fsw_string *out_path);
433
441
443void fsw_shandle_close(struct fsw_shandle *shand);
444fsw_status_t fsw_shandle_read(struct fsw_shandle *shand, fsw_u32 *buffer_size_inout, void *buffer);
445
453
454fsw_status_t fsw_alloc_zero(int len, void **ptr_out);
455fsw_status_t fsw_memdup(void **dest_out, void *src, int len);
456
464
465int fsw_strlen(struct fsw_string *s);
466int fsw_strsize(struct fsw_string *s);
467void *fsw_strdata(struct fsw_string *s);
468int fsw_streq(struct fsw_string *s1, struct fsw_string *s2);
469int fsw_streq_cstr(struct fsw_string *s1, const char *s2);
470fsw_status_t fsw_strdup_coerce(struct fsw_string *dest, int type, struct fsw_string *src);
471void fsw_strsplit(struct fsw_string *lookup_name, struct fsw_string *buffer, char separator);
472
473void fsw_strfree(struct fsw_string *s);
474
486#ifndef S_IRWXU
487
488#define S_ISUID 0004000 /* set user id on execution */
489#define S_ISGID 0002000 /* set group id on execution */
490#define S_ISTXT 0001000 /* sticky bit */
491
492#define S_IRWXU 0000700 /* RWX mask for owner */
493#define S_IRUSR 0000400 /* R for owner */
494#define S_IWUSR 0000200 /* W for owner */
495#define S_IXUSR 0000100 /* X for owner */
496
497#define S_IRWXG 0000070 /* RWX mask for group */
498#define S_IRGRP 0000040 /* R for group */
499#define S_IWGRP 0000020 /* W for group */
500#define S_IXGRP 0000010 /* X for group */
501
502#define S_IRWXO 0000007 /* RWX mask for other */
503#define S_IROTH 0000004 /* R for other */
504#define S_IWOTH 0000002 /* W for other */
505#define S_IXOTH 0000001 /* X for other */
506
507#define S_IFMT 0170000 /* type of file mask */
508#define S_IFIFO 0010000 /* named pipe (fifo) */
509#define S_IFCHR 0020000 /* character special */
510#define S_IFDIR 0040000 /* directory */
511#define S_IFBLK 0060000 /* block special */
512#define S_IFREG 0100000 /* regular */
513#define S_IFLNK 0120000 /* symbolic link */
514#define S_IFSOCK 0140000 /* socket */
515#define S_ISVTX 0001000 /* save swapped text even after use */
516#define S_IFWHT 0160000 /* whiteout */
517
518#define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */
519#define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */
520#define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */
521#define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */
522#define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */
523#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
524#define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */
525#define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
526
527#define S_BLKSIZE 512 /* block size used in the stat struct */
528
529#endif
533#endif
cache_type_t type
fsw_status_t fsw_dnode_get_path(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_string *out_path)
int fsw_status_t
Definition fsw_core.h:153
void fsw_strfree(struct fsw_string *s)
Definition fsw_lib.c:310
fsw_u16 fsw_u16_be
Definition fsw_core.h:71
@ FSW_DNODE_TYPE_SYMLINK
Definition fsw_core.h:267
@ FSW_DNODE_TYPE_FILE
Definition fsw_core.h:265
@ FSW_DNODE_TYPE_UNKNOWN
Definition fsw_core.h:264
@ FSW_DNODE_TYPE_DIR
Definition fsw_core.h:266
@ FSW_DNODE_TYPE_SPECIAL
Definition fsw_core.h:268
fsw_u64 fsw_u64_be
Definition fsw_core.h:75
fsw_status_t fsw_dnode_stat(struct fsw_dnode *dno, struct fsw_dnode_stat *sb)
Definition fsw_core.c:502
fsw_u16 fsw_u16_le
Definition fsw_core.h:70
int fsw_streq(struct fsw_string *s1, struct fsw_string *s2)
Definition fsw_lib.c:114
fsw_status_t fsw_dnode_fill(struct fsw_dnode *dno)
Definition fsw_core.c:483
fsw_status_t fsw_block_get(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, fsw_u32 cache_level, void **buffer_out)
Definition fsw_core.c:179
int fsw_strsize(struct fsw_string *s)
Definition fsw_lib.c:89
int fsw_streq_cstr(struct fsw_string *s1, const char *s2)
Definition fsw_lib.c:169
int fsw_dnode_is_root(struct fsw_dnode *dno)
Definition fsw_core.c:350
#define DNODESTRUCTNAME
Definition fsw_core.h:144
fsw_status_t fsw_dnode_create(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *parent_dno, fsw_u32 dnode_id, int type, struct fsw_string *name, struct DNODESTRUCTNAME **dno_out)
fsw_u64 fsw_u64_le
Definition fsw_core.h:74
#define VOLSTRUCTNAME
Definition fsw_core.h:139
fsw_status_t fsw_dnode_dir_read(struct fsw_shandle *shand, struct fsw_dnode **child_dno_out)
Definition fsw_core.c:669
void fsw_shandle_close(struct fsw_shandle *shand)
Definition fsw_core.c:848
int fsw_strlen(struct fsw_string *s)
Definition fsw_lib.c:79
fsw_status_t fsw_dnode_lookup_path(struct fsw_dnode *dno, struct fsw_string *lookup_path, char separator, struct fsw_dnode **child_dno_out)
Definition fsw_core.c:554
@ FSW_EXTENT_TYPE_BUFFER
Definition fsw_core.h:297
@ FSW_EXTENT_TYPE_PHYSBLOCK
Definition fsw_core.h:296
@ FSW_EXTENT_TYPE_SPARSE
Definition fsw_core.h:295
@ FSW_EXTENT_TYPE_INVALID
Definition fsw_core.h:294
void fsw_dnode_mkcomplete(struct DNODESTRUCTNAME *dno)
fsw_status_t fsw_strdup_coerce(struct fsw_string *dest, int type, struct fsw_string *src)
Definition fsw_lib.c:190
fsw_status_t fsw_get_bless_info(struct VOLSTRUCTNAME *vol, int type, struct fsw_string *out_path)
fsw_status_t fsw_memdup(void **dest_out, void *src, int len)
Definition fsw_lib.c:64
@ FSW_UNSUPPORTED
Definition fsw_core.h:162
@ FSW_NOT_FOUND
Definition fsw_core.h:163
@ FSW_SUCCESS
Definition fsw_core.h:159
@ FSW_VOLUME_CORRUPTED
Definition fsw_core.h:164
@ FSW_IO_ERROR
Definition fsw_core.h:161
@ FSW_OUT_OF_MEMORY
Definition fsw_core.h:160
@ FSW_UNKNOWN_ERROR
Definition fsw_core.h:165
fsw_status_t fsw_shandle_read(struct fsw_shandle *shand, fsw_u32 *buffer_size_inout, void *buffer)
Definition fsw_core.c:860
fsw_u32 fsw_u32_le
Definition fsw_core.h:72
fsw_status_t fsw_shandle_open(struct DNODESTRUCTNAME *dno, struct fsw_shandle *shand)
fsw_status_t fsw_volume_stat(struct fsw_volume *vol, struct fsw_volume_stat *sb)
Definition fsw_core.c:125
fsw_status_t fsw_dnode_create_root(struct VOLSTRUCTNAME *vol, fsw_u32 dnode_id, struct DNODESTRUCTNAME **dno_out)
void fsw_set_blocksize(struct VOLSTRUCTNAME *vol, fsw_u32 phys_blocksize, fsw_u32 log_blocksize)
void * fsw_strdata(struct fsw_string *s)
Definition fsw_lib.c:100
void fsw_block_release(struct VOLSTRUCTNAME *vol, fsw_u32 phys_bno, void *buffer)
Definition fsw_core.c:267
fsw_status_t fsw_dnode_lookup(struct fsw_dnode *dno, struct fsw_string *lookup_name, struct fsw_dnode **child_dno_out)
Definition fsw_core.c:529
fsw_status_t fsw_dnode_resolve(struct fsw_dnode *dno, struct fsw_dnode **target_dno_out)
Definition fsw_core.c:764
fsw_status_t fsw_mount(void *host_data, struct fsw_host_table *host_table, struct fsw_fstype_table *fstype_table, struct fsw_volume **vol_out)
Definition fsw_core.c:62
void fsw_unmount(struct fsw_volume *vol)
Definition fsw_core.c:107
void fsw_strsplit(struct fsw_string *lookup_name, struct fsw_string *buffer, char separator)
Definition fsw_lib.c:246
fsw_status_t fsw_alloc_zero(int len, void **ptr_out)
Definition fsw_lib.c:49
fsw_u32 fsw_u32_be
Definition fsw_core.h:73
fsw_status_t fsw_dnode_readlink(struct fsw_dnode *dno, struct fsw_string *link_target)
Definition fsw_core.c:695
void fsw_dnode_release(struct fsw_dnode *dno)
Definition fsw_core.c:442
void fsw_dnode_retain(struct fsw_dnode *dno)
Definition fsw_core.c:430
fsw_status_t fsw_dnode_readlink_data(struct DNODESTRUCTNAME *dno, struct fsw_string *link_target)
@ BLESSED_TYPE_SYSTEM_FILE
Definition fsw_core.h:272
@ BLESSED_TYPE_SYSTEM_FOLDER
Definition fsw_core.h:273
@ BLESSED_TYPE_OSX_FOLDER
Definition fsw_core.h:274
@ FSW_DNODE_STAT_ATIME
Definition fsw_core.h:338
@ FSW_DNODE_STAT_CTIME
Definition fsw_core.h:336
@ FSW_DNODE_STAT_MTIME
Definition fsw_core.h:337
@ FSW_STRING_TYPE_UTF16_SWAPPED
Definition fsw_core.h:189
@ FSW_STRING_TYPE_ISO88591
Definition fsw_core.h:186
@ FSW_STRING_TYPE_EMPTY
Definition fsw_core.h:185
@ FSW_STRING_TYPE_UTF8
Definition fsw_core.h:187
@ FSW_STRING_TYPE_UTF16
Definition fsw_core.h:188
UINT16 fsw_u16
UINT32 fsw_u32
UINT64 fsw_u64
fsw_u32 phys_bno
Physical block number.
Definition fsw_core.h:213
void * data
Block data buffer.
Definition fsw_core.h:214
fsw_u32 refcount
Reference count.
Definition fsw_core.h:211
fsw_u32 cache_level
Level of importance of this block.
Definition fsw_core.h:212
void(* store_attr_posix)(struct fsw_dnode_stat *sb, fsw_u16 posix_mode)
Callbock for storing a Posix-style file mode.
Definition fsw_core.h:328
void(* store_time_posix)(struct fsw_dnode_stat *sb, int which, fsw_u32 posix_time)
Callback for storing a Posix-style timestamp.
Definition fsw_core.h:327
void * host_data
Hook for a host-specific data structure.
Definition fsw_core.h:329
fsw_u64 used_bytes
Bytes actually used by the file on disk.
Definition fsw_core.h:326
struct VOLSTRUCTNAME * vol
The volume this dnode belongs to.
Definition fsw_core.h:247
struct fsw_dnode * prev
Doubly-linked list of all dnodes: next dnode.
Definition fsw_core.h:256
fsw_u32 dnode_id
Unique id number (usually the inode number)
Definition fsw_core.h:251
fsw_u64 size
Data size in bytes.
Definition fsw_core.h:253
struct fsw_dnode * next
Doubly-linked list of all dnodes: previous dnode.
Definition fsw_core.h:255
fsw_u32 complete
Flag to be set on all dnode info was filled.
Definition fsw_core.h:245
fsw_u32 refcount
Reference count.
Definition fsw_core.h:244
struct DNODESTRUCTNAME * parent
Parent directory dnode.
Definition fsw_core.h:248
int type
Type of the dnode - file, dir, symlink, special.
Definition fsw_core.h:252
struct fsw_string name
Name of this item in the parent directory.
Definition fsw_core.h:249
int type
Type of extent specification.
Definition fsw_core.h:282
fsw_u32 log_count
Logical block count.
Definition fsw_core.h:284
fsw_u32 log_start
Starting logical block number.
Definition fsw_core.h:283
void * buffer
Allocated buffer pointer (for FSW_EXTENT_TYPE_BUFFER only)
Definition fsw_core.h:286
fsw_u32 phys_start
Starting physical block number (for FSW_EXTENT_TYPE_PHYSBLOCK only)
Definition fsw_core.h:285
fsw_status_t(* dnode_stat)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_dnode_stat *sb)
Definition fsw_core.h:371
fsw_u32 volume_struct_size
Size for allocating the fsw_volume structure.
Definition fsw_core.h:362
fsw_status_t(* volume_stat)(struct VOLSTRUCTNAME *vol, struct fsw_volume_stat *sb)
Definition fsw_core.h:367
void(* volume_free)(struct VOLSTRUCTNAME *vol)
Definition fsw_core.h:366
void(* dnode_free)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno)
Definition fsw_core.h:370
fsw_status_t(* dir_lookup)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_string *lookup_name, struct DNODESTRUCTNAME **child_dno)
Definition fsw_core.h:376
fsw_u32 dnode_struct_size
Size for allocating the fsw_dnode structure.
Definition fsw_core.h:363
fsw_status_t(* dir_read)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_shandle *shand, struct DNODESTRUCTNAME **child_dno)
Definition fsw_core.h:378
fsw_status_t(* get_extent)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_extent *extent)
Definition fsw_core.h:373
struct fsw_string name
String giving the name of the file system.
Definition fsw_core.h:361
fsw_status_t(* get_bless_info)(struct VOLSTRUCTNAME *vol, fsw_u32 type, struct DNODESTRUCTNAME **dno_out)
Definition fsw_core.h:382
fsw_status_t(* dnode_fill)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno)
Definition fsw_core.h:369
fsw_status_t(* readlink)(struct VOLSTRUCTNAME *vol, struct DNODESTRUCTNAME *dno, struct fsw_string *link_target)
Definition fsw_core.h:380
fsw_status_t(* volume_mount)(struct VOLSTRUCTNAME *vol)
Definition fsw_core.h:365
fsw_status_t(* read_block)(struct fsw_volume *vol, fsw_u32 phys_bno, void *buffer)
Definition fsw_core.h:352
int native_string_type
String type used by the host environment.
Definition fsw_core.h:347
void(* change_blocksize)(struct fsw_volume *vol, fsw_u32 old_phys_blocksize, fsw_u32 old_log_blocksize, fsw_u32 new_phys_blocksize, fsw_u32 new_log_blocksize)
Definition fsw_core.h:349
struct fsw_extent extent
Current extent.
Definition fsw_core.h:309
fsw_u64 pos
Current file pointer in bytes.
Definition fsw_core.h:308
struct fsw_dnode * dnode
The dnode this handle reads data from.
Definition fsw_core.h:306
void * data
Data pointer (may be NULL if type is EMPTY or len is zero)
Definition fsw_core.h:177
int len
Length in characters.
Definition fsw_core.h:175
int size
Total data size in bytes.
Definition fsw_core.h:176
int type
Encoding of the string - empty, ISO-8859-1, UTF8, UTF16.
Definition fsw_core.h:174
fsw_u64 free_bytes
Bytes still available for storing file data.
Definition fsw_core.h:318
fsw_u64 total_bytes
Total size of data area size in bytes.
Definition fsw_core.h:317
fsw_u32 phys_blocksize
Block size for disk access / file system structures.
Definition fsw_core.h:222
struct fsw_blockcache * bcache
Array of block cache entries.
Definition fsw_core.h:230
struct fsw_dnode * dnode_head
List of all dnodes allocated for this volume.
Definition fsw_core.h:228
struct fsw_string label
Volume label.
Definition fsw_core.h:226
fsw_u32 log_blocksize
Block size for logical file data.
Definition fsw_core.h:223
int host_string_type
String type used by the host environment.
Definition fsw_core.h:236
fsw_u32 bcache_size
Number of entries in the block cache array.
Definition fsw_core.h:231
struct fsw_fstype_table * fstype_table
Dispatch table for file system specific functions.
Definition fsw_core.h:235
struct fsw_host_table * host_table
Dispatch table for host-specific functions.
Definition fsw_core.h:234
void * host_data
Hook for a host-specific data structure.
Definition fsw_core.h:233
struct DNODESTRUCTNAME * root
Root directory dnode.
Definition fsw_core.h:225