- /* Add each blob referenced by files in the image to a list and
- * preemptively double the number of references to each. This is done
- * to allow implementing the WIMLIB_UNMOUNT_FLAG_NEW_IMAGE semantics.
- */
- INIT_LIST_HEAD(&ctx.orig_blob_list);
- if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
- unsigned i;
- struct wim_inode *inode;
- struct blob_descriptor *blob;
-
- image_for_each_inode(inode, imd) {
- for (i = 0; i < inode->i_num_streams; i++) {
- blob = stream_blob(&inode->i_streams[i],
- wim->blob_table);
- if (blob)
- blob->out_refcnt = 0;
- }
- }
-
- image_for_each_inode(inode, imd) {
- for (i = 0; i < inode->i_num_streams; i++) {
- blob = stream_blob(&inode->i_streams[i],
- wim->blob_table);
- if (blob) {
- if (blob->out_refcnt == 0)
- list_add(&blob->orig_blob_list,
- &ctx.orig_blob_list);
- blob->out_refcnt += inode->i_nlink;
- blob->refcnt += inode->i_nlink;
- }
- }
- }
- }