X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Finode.h;h=03c9acd8ca05aa22810b1776d234b5073499fd4a;hb=a1a043899627341eb5117a48098d8d92abd43827;hp=8c6aa95fef8cdccb05c16dd759e804000b26b392;hpb=27b30056e4520e9b5b9d0846f438311746345f83;p=wimlib diff --git a/include/wimlib/inode.h b/include/wimlib/inode.h index 8c6aa95f..03c9acd8 100644 --- a/include/wimlib/inode.h +++ b/include/wimlib/inode.h @@ -18,7 +18,7 @@ struct avl_tree_node; /* * WIM inode. * - * As mentioned in the comment above `struct wim_dentry', in the WIM file that + * As mentioned in the comment above `struct wim_dentry', in WIM files there * is no on-disk analogue of a real inode, as most of these fields are * duplicated in the dentries. Instead, a `struct wim_inode' is something we * create ourselves to simplify the handling of hard links. @@ -125,9 +125,10 @@ struct wim_inode { /* Corresponds to 'security_id' in `struct wim_dentry_on_disk': The * index of this inode's security descriptor in the WIM image's table of - * security descriptors, or -1. Note: in verify_inode(), called - * whenever a WIM image is loaded, out-of-bounds indices are set to -1, - * so the extraction code does not need to do bounds checks. */ + * security descriptors, or -1. Note: when a WIM image is loaded, + * wimlib sets out-of-bounds indices and values less than -1 in this + * field to -1. So the extraction code need not do an upper bound check + * after checking for -1 (or equivalently < 0). */ int32_t i_security_id; /* Identity of a reparse point. See @@ -176,11 +177,24 @@ struct wim_inode { #endif }; + /* Used during WIM writing with + * WIMLIB_WRITE_FLAG_SEND_DONE_WITH_FILE_MESSAGES: the number + * of data streams this inode has that have not yet been fully + * read. */ + u32 num_unread_streams; + #ifdef WITH_FUSE - /* Used only during image mount: Table of file descriptors that - * have been opened to this inode. The table is automatically - * freed when the last file descriptor is closed. */ - struct wimfs_fd **i_fds; + struct { + /* Used only during image mount: Table of file + * descriptors that have been opened to this inode. + * This table is freed when the last file descriptor is + * closed. */ + struct wimfs_fd **i_fds; + + /* Lower bound on the index of the next available entry + * in 'i_fds'. */ + u16 i_next_fd; + }; #endif }; @@ -316,8 +330,7 @@ free_inode(struct wim_inode *inode); dentry_full_path(inode_first_dentry(inode)) extern struct wim_ads_entry * -inode_get_ads_entry(struct wim_inode *inode, const tchar *stream_name, - u16 *idx_ret); +inode_get_ads_entry(struct wim_inode *inode, const tchar *stream_name); extern struct wim_ads_entry * inode_add_ads_utf16le(struct wim_inode *inode, @@ -327,7 +340,7 @@ inode_add_ads_utf16le(struct wim_inode *inode, extern struct wim_ads_entry * inode_add_ads(struct wim_inode *dentry, const tchar *stream_name); -extern int +extern struct wim_ads_entry * inode_add_ads_with_data(struct wim_inode *inode, const tchar *name, const void *value, size_t size, struct wim_lookup_table *lookup_table); @@ -340,9 +353,15 @@ inode_set_unnamed_stream(struct wim_inode *inode, const void *data, size_t len, struct wim_lookup_table *lookup_table); extern void -inode_remove_ads(struct wim_inode *inode, u16 idx, +inode_remove_ads(struct wim_inode *inode, struct wim_ads_entry *entry, struct wim_lookup_table *lookup_table); +/* + * Does the specified alternate data stream entry correspond to a named stream? + * + * See inode_needs_dummy_stream() for explanation of why an alternate data + * stream entry might, in fact, not be named... + */ static inline bool ads_entry_is_named_stream(const struct wim_ads_entry *entry) { @@ -481,6 +500,15 @@ inode_stream_name_nbytes(const struct wim_inode *inode, unsigned stream_idx) return inode->i_ads_entries[stream_idx - 1].stream_name_nbytes; } +static inline u32 +inode_stream_idx_to_id(const struct wim_inode *inode, unsigned stream_idx) +{ + if (stream_idx == 0) + return 0; + else + return inode->i_ads_entries[stream_idx - 1].stream_id; +} + extern struct wim_lookup_table_entry * inode_unnamed_stream_resolved(const struct wim_inode *inode, u16 *stream_idx_ret); @@ -499,10 +527,10 @@ inode_unnamed_stream_hash(const struct wim_inode *inode); extern int read_ads_entries(const u8 * restrict p, struct wim_inode * restrict inode, - size_t nbytes_remaining); + size_t *nbytes_remaining_p); -extern int -verify_inode(struct wim_inode *inode, const struct wim_security_data *sd); +extern void +check_inode(struct wim_inode *inode, const struct wim_security_data *sd); extern void inode_ref_streams(struct wim_inode *inode);