dentry->attributes = FILE_ATTRIBUTE_NORMAL;
}
if (sizeof(ino_t) >= 8)
- dentry->hard_link = (u64)stbuf->st_ino;
+ dentry->link_group_id = (u64)stbuf->st_ino;
else
- dentry->hard_link = (u64)stbuf->st_ino |
+ dentry->link_group_id = (u64)stbuf->st_ino |
((u64)stbuf->st_dev << (sizeof(ino_t) * 8));
/* Set timestamps */
dentry->creation_time = timespec_to_wim_timestamp(&stbuf->st_mtim);
printf("Last Write Time = %s UTC\n", p);
printf("Reparse Tag = 0x%"PRIx32"\n", dentry->reparse_tag);
- printf("Hard Link Group = 0x%"PRIx64"\n", dentry->hard_link);
+ printf("Hard Link Group = 0x%"PRIx64"\n", dentry->link_group_id);
printf("Number of Alternate Data Streams = %hu\n", dentry->num_ads);
printf("Filename = \"");
print_string(dentry->file_name, dentry->file_name_len);
p += 4;
} else {
p = get_u32(p, &dentry->reparse_tag);
- p = get_u64(p, &dentry->hard_link);
+ p = get_u64(p, &dentry->link_group_id);
}
/* By the way, the reparse_reserved field does not actually exist (at
p = put_u32(p, dentry->reparse_tag);
p = put_zeroes(p, 4);
} else {
- u64 hard_link;
+ u64 link_group_id;
p = put_u32(p, 0);
if (dentry->link_group_list.next == &dentry->link_group_list)
- hard_link = 0;
+ link_group_id = 0;
else
- hard_link = dentry->hard_link;
- p = put_u64(p, hard_link);
+ link_group_id = dentry->link_group_id;
+ p = put_u64(p, link_group_id);
}
p = put_u16(p, dentry->num_ads);
p = put_u16(p, dentry->short_name_len);
* Unfortunately, in some WIMs it is NOT the case that all dentries that
* share this field are actually in the same hard link set, although the
* WIMs that wimlib writes maintain this restriction. */
- u64 hard_link;
+ u64 link_group_id;
/* Number of alternate data streams associated with this file. */
u16 num_ads;
size_t pos;
struct link_group *group;
- if (dentry->hard_link == 0) {
+ if (dentry->link_group_id == 0) {
/* Single group--- Add to the list of extra groups (we can't put
* it in the table itself because all the singles have a link
* group ID of 0) */
* though) */
/* Try adding to existing hard link group */
- pos = dentry->hard_link % table->capacity;
+ pos = dentry->link_group_id % table->capacity;
group = table->array[pos];
while (group) {
- if (group->link_group_id == dentry->hard_link) {
+ if (group->link_group_id == dentry->link_group_id) {
list_add(&dentry->link_group_list,
group->dentry_list);
return 0;
group = MALLOC(sizeof(struct link_group));
if (!group)
return WIMLIB_ERR_NOMEM;
- group->link_group_id = dentry->hard_link;
+ group->link_group_id = dentry->link_group_id;
group->next = table->array[pos];
INIT_LIST_HEAD(&dentry->link_group_list);
group->dentry_list = &dentry->link_group_list;
dentry = container_of(cur_head,
struct dentry,
link_group_list);
- dentry->hard_link = id;
+ dentry->link_group_id = id;
cur_head = cur_head->next;
} while (cur_head != cur_group->dentry_list);
cur_group->link_group_id = id;
return true;
}
+#ifdef ENABLE_DEBUG
+static void
+print_dentry_list(const struct dentry *first_dentry)
+{
+ const struct dentry *dentry;
+ do {
+ printf("`%s'\n", dentry->full_path_utf8);
+ } while ((dentry = container_of(dentry->link_group_list.next,
+ struct dentry,
+ link_group_list)) != first_dentry);
+}
+#endif
+
/* Fix up a "true" link group and check for inconsistencies */
static int
fix_true_link_group(struct dentry *first_dentry)
*
* - Assign all the dentries in the link group the most recent timestamp
* among all the corresponding timestamps in the link group, for each of
- * the three categories of time stamps
+ * the three categories of time stamps.
*
* - Make sure the dentry->hash field is valid in all the dentries, if
* possible (this field may be all zeroes, and in the context of a hard
- * link group must be interpreted as implicitly refering to the same stream
- * as another dentry is the hard link group that does *not* have all zeroes
- * for the stream hash).
+ * link group this must be interpreted as implicitly refering to the same
+ * stream as another dentry in the hard link group that does NOT have all
+ * zeroes for this field).
*
* - Make sure dentry->num_ads is the same in all the dentries in the link
- * group. In some cases, it's possible for it to be set to 0 when it must
- * be interpreted as being the same as the number of alternate data streams
- * in another dentry in the hard link group that has a nonzero number of
- * alternate data streams.
+ * group. In some cases, it's possible for it to be set to 0 when it
+ * actually must be interpreted as being the same as the number of
+ * alternate data streams in another dentry in the hard link group that has
+ * a nonzero number of alternate data streams.
*
* - Make sure only the dentry->ads_entries array is only allocated for one
* dentry in the hard link group. This dentry will have
/* If there are no dentries with data streams, we require the nominal
* link group to be a true link group */
- if (list_empty(&dentries_with_data_streams))
+ if (list_empty(&dentries_with_data_streams)) {
+ #ifdef ENABLE_DEBUG
+
+ #endif
return fix_true_link_group(container_of(group->dentry_list,
struct dentry,
link_group_list));
+ }
/* One or more dentries had data streams specified. We check each of
* these dentries for consistency with the others to form a set of true
else
stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_ino = (ino_t)dentry->hard_link;
+ stbuf->st_ino = (ino_t)dentry->link_group_id;
stbuf->st_nlink = dentry_link_group_size(dentry);
stbuf->st_uid = getuid();
num_transferred_fds = 0;
for (u16 i = 0; i < old_lte->num_allocated_fds; i++)
if (old_lte->fds[i] && old_lte->fds[i]->dentry &&
- old_lte->fds[i]->dentry->hard_link == link_group)
+ old_lte->fds[i]->dentry->link_group_id == link_group)
num_transferred_fds++;
DEBUG("Transferring %u file descriptors",
num_transferred_fds);
}
for (u16 i = 0, j = 0; ; i++) {
if (old_lte->fds[i] && old_lte->fds[i]->dentry &&
- old_lte->fds[i]->dentry->hard_link == link_group) {
+ old_lte->fds[i]->dentry->link_group_id == link_group) {
struct wimlib_fd *fd = old_lte->fds[i];
old_lte->fds[i] = NULL;
fd->lte = new_lte;
do {
struct dentry *d;
d = container_of(pos, struct dentry, link_group_list);
- wimlib_assert(d->hard_link == dentry->hard_link);
+ wimlib_assert(d->link_group_id == dentry->link_group_id);
lte_transfer_dentry(new_lte, d);
pos = pos->next;
} while (pos != &dentry->link_group_list);
* XXX*/
wimlib_assert(old_lte->refcnt > link_group_size);
- new_lte = lte_extract_fds(old_lte, dentry->hard_link);
+ new_lte = lte_extract_fds(old_lte, dentry->link_group_id);
if (!new_lte) {
ret = -ENOMEM;
goto out_delete_staging_file;
newdir = new_dentry(basename);
newdir->attributes |= FILE_ATTRIBUTE_DIRECTORY;
newdir->resolved = true;
- newdir->hard_link = next_link_group_id++;
+ newdir->link_group_id = next_link_group_id++;
link_dentry(newdir, parent);
return 0;
}
if (!dentry)
return -ENOMEM;
dentry->resolved = true;
- dentry->hard_link = next_link_group_id++;
+ dentry->link_group_id = next_link_group_id++;
dentry->lte_group_list.type = STREAM_TYPE_NORMAL;
INIT_LIST_HEAD(&dentry->lte_group_list.list);
link_dentry(dentry, parent);
dentry->attributes = FILE_ATTRIBUTE_REPARSE_POINT;
dentry->reparse_tag = WIM_IO_REPARSE_TAG_SYMLINK;
- dentry->hard_link = next_link_group_id++;
+ dentry->link_group_id = next_link_group_id++;
if (dentry_set_symlink(dentry, to, w->lookup_table, <e) != 0)
goto out_free_dentry;
root->last_access_time = le64_to_cpu(ni->last_access_time);
root->security_id = le32_to_cpu(ni->security_id);
root->attributes = le32_to_cpu(attributes);
- root->hard_link = ni->mft_no;
+ root->link_group_id = ni->mft_no;
root->resolved = true;
if (attributes & FILE_ATTR_REPARSE_POINT) {