+/* Change the hash value of the main or alternate file stream in a hard link
+ * group. This needs to be done if the hash of the corresponding lookup table
+ * entry was changed. */
+static void link_group_set_stream_hash(struct dentry *dentry,
+ unsigned stream_idx,
+ const u8 new_hash[])
+{
+ struct list_head *head, *cur;
+
+ if (stream_idx == 0) {
+ head = &dentry->link_group_list;
+ cur = head;
+ do {
+ dentry = container_of(cur, struct dentry, link_group_list);
+ memcpy(dentry->hash, new_hash, WIM_HASH_SIZE);
+ cur = cur->next;
+ } while (cur != head);
+ } else {
+ /* Dentries in the link group share their alternate stream
+ * entries. */
+ wimlib_assert(stream_idx <= dentry->num_ads);
+ memcpy(dentry->ads_entries[stream_idx - 1].hash, new_hash,
+ WIM_HASH_SIZE);
+ }
+}
+