X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fdentry.c;h=daab2fea4bd16a3f96cc851897a0e6f3d6659976;hp=ae71c1d54d92b0c8a7cd36a94f587d6f2704b17d;hb=b001aca524f15cb0239518537378924725cc5b12;hpb=c6e063fcb2b1ffa76df62ab902a38bf5f604d2e2 diff --git a/src/dentry.c b/src/dentry.c index ae71c1d5..daab2fea 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -27,19 +27,12 @@ * wimlib; if not, see http://www.gnu.org/licenses/. */ -#include -#include -#include -#include - -#include "dentry.h" #include "buffer_io.h" +#include "dentry.h" #include "lookup_table.h" -#include "sha1.h" #include "timestamp.h" #include "wimlib_internal.h" - /* Calculates the unaligned length, in bytes, of an on-disk WIM dentry that has * a file name and short name that take the specified numbers of bytes. This * excludes any alternate data stream entries that may follow the dentry. */ @@ -175,52 +168,6 @@ static u64 dentry_total_length(const struct dentry *dentry) return __dentry_total_length(dentry, dentry->length); } -#ifdef WITH_FUSE -/* Transfers file attributes from a struct inode to a `stat' buffer. - * - * The lookup table entry tells us which stream in the inode we are statting. - * For a named data stream, everything returned is the same as the unnamed data - * stream except possibly the size and block count. */ -int inode_to_stbuf(const struct inode *inode, struct lookup_table_entry *lte, - struct stat *stbuf) -{ - if (inode_is_symlink(inode)) - stbuf->st_mode = S_IFLNK | 0777; - else if (inode_is_directory(inode)) - stbuf->st_mode = S_IFDIR | 0755; - else - stbuf->st_mode = S_IFREG | 0755; - - stbuf->st_ino = (ino_t)inode->ino; - stbuf->st_nlink = inode->link_count; - stbuf->st_uid = getuid(); - stbuf->st_gid = getgid(); - - if (lte) { - if (lte->resource_location == RESOURCE_IN_STAGING_FILE) { - wimlib_assert(lte->staging_file_name); - struct stat native_stat; - if (stat(lte->staging_file_name, &native_stat) != 0) { - DEBUG("Failed to stat `%s': %m", - lte->staging_file_name); - return -errno; - } - stbuf->st_size = native_stat.st_size; - } else { - stbuf->st_size = wim_resource_size(lte); - } - } else { - stbuf->st_size = 0; - } - - stbuf->st_atime = wim_timestamp_to_unix(inode->last_access_time); - stbuf->st_mtime = wim_timestamp_to_unix(inode->last_write_time); - stbuf->st_ctime = wim_timestamp_to_unix(inode->creation_time); - stbuf->st_blocks = (stbuf->st_size + 511) / 512; - return 0; -} -#endif - int for_dentry_in_rbtree(struct rb_node *root, int (*visitor)(struct dentry *, void *), void *arg) @@ -1833,4 +1780,3 @@ u8 *write_dentry_tree(const struct dentry *root, u8 *p) /* Recursively write the rest of the dentry tree. */ return write_dentry_tree_recursive(root, p); } -