}
/* Transfers file attributes from a struct dentry to a `stat' buffer. */
-void dentry_to_stbuf(const struct dentry *dentry, struct stat *stbuf,
- const struct lookup_table *table)
+int dentry_to_stbuf(const struct dentry *dentry, struct stat *stbuf,
+ const struct lookup_table *table)
{
struct lookup_table_entry *lte;
-
-
if (dentry_is_symlink(dentry))
stbuf->st_mode = S_IFLNK | 0777;
else if (dentry_is_directory(dentry))
else
stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_ino = dentry->hard_link;
+ stbuf->st_ino = (ino_t)dentry->hard_link;
+
stbuf->st_nlink = dentry_link_group_size(dentry);
stbuf->st_uid = getuid();
stbuf->st_gid = getgid();
if (table && (lte = __lookup_resource(table, dentry_hash(dentry)))) {
if (lte->staging_file_name) {
struct stat native_stat;
- stat(lte->staging_file_name, &native_stat);
+ if (stat(lte->staging_file_name, &native_stat) != 0)
+ return -errno;
stbuf->st_size = native_stat.st_size;
} else {
stbuf->st_size = lte->resource_entry.original_size;
stbuf->st_mtime = ms_timestamp_to_unix(dentry->last_write_time);
stbuf->st_ctime = ms_timestamp_to_unix(dentry->creation_time);
stbuf->st_blocks = (stbuf->st_size + 511) / 512;
+ return 0;
}
/* Makes all timestamp fields for the dentry be the current time. */
}
}
}
+ struct list_head *next;
+ next = dentry->link_group_list.next;
list_del(&dentry->link_group_list);
+ /*if (next->next == next)*/
+ /*container_of(next, struct dentry, link_group_list)->hard_link = 0;*/
free_dentry(dentry);
}
p = put_u32(p, dentry->reparse_tag);
p = put_zeroes(p, 4);
} else {
+ u64 hard_link;
p = put_u32(p, dentry->reparse_tag);
- p = put_u64(p, dentry->hard_link);
+ if (dentry->link_group_list.next == &dentry->link_group_list)
+ hard_link = 0;
+ else
+ hard_link = dentry->hard_link;
+ p = put_u64(p, hard_link);
}
p = put_u16(p, dentry->num_ads);
p = put_u16(p, dentry->short_name_len);