]> wimlib.net Git - wimlib/blobdiff - include/wimlib/blob_table.h
inode/blob cleanups
[wimlib] / include / wimlib / blob_table.h
index e273de2531b8fd16280b5737c6421526e32afb75..1adec4ed6db602aa617b2ba91eb6b2cd1496f03e 100644 (file)
@@ -55,16 +55,17 @@ enum blob_location {
 #endif
 };
 
-/* A "blob target" is a stream, and the inode to which that stream belongs, to
- * which a blob needs to be extracted as part of an extraction operation.  Since
- * blobs are single-instanced, a blob may have multiple targets.  */
+/* A "blob extraction target" is a stream, and the inode to which that stream
+ * belongs, to which a blob needs to be extracted as part of an extraction
+ * operation.  Since blobs are single-instanced, a blob may have multiple
+ * extraction targets.  */
 struct blob_extraction_target {
        struct wim_inode *inode;
        struct wim_inode_stream *stream;
 };
 
 /*
- * Descriptor for a blob, which is a known length sequence of binary data.
+ * Descriptor for a "blob", which is a known length sequence of binary data.
  *
  * Within a WIM file, blobs are single instanced and are identified by SHA-1
  * message digest.
@@ -345,13 +346,31 @@ blob_extraction_targets(struct blob_descriptor *blob)
                return blob->blob_extraction_targets;
 }
 
+/*
+ * Declare that the specified blob is located in the specified WIM resource at
+ * the specified offset.  The caller is expected to set blob->size if required.
+ */
 static inline void
 blob_set_is_located_in_wim_resource(struct blob_descriptor *blob,
-                                   struct wim_resource_descriptor *rdesc)
+                                   struct wim_resource_descriptor *rdesc,
+                                   u64 offset_in_res)
 {
        blob->blob_location = BLOB_IN_WIM;
        blob->rdesc = rdesc;
        list_add_tail(&blob->rdesc_node, &rdesc->blob_list);
+       blob->offset_in_res = offset_in_res;
+}
+
+/*
+ * Declare that the specified blob is located in the specified non-solid WIM
+ * resource.  In this case, the blob data is the entire uncompressed resource.
+ */
+static inline void
+blob_set_is_located_in_nonsolid_wim_resource(struct blob_descriptor *blob,
+                                            struct wim_resource_descriptor *rdesc)
+{
+       blob_set_is_located_in_wim_resource(blob, rdesc, 0);
+       blob->size = rdesc->uncompressed_size;
 }
 
 static inline void
@@ -361,6 +380,15 @@ blob_unset_is_located_in_wim_resource(struct blob_descriptor *blob)
        blob->blob_location = BLOB_NONEXISTENT;
 }
 
+static inline void
+blob_set_is_located_in_attached_buffer(struct blob_descriptor *blob,
+                                      void *buffer, size_t size)
+{
+       blob->blob_location = BLOB_IN_ATTACHED_BUFFER;
+       blob->attached_buffer = buffer;
+       blob->size = size;
+}
+
 extern struct blob_descriptor *
 new_blob_from_data_buffer(const void *buffer, size_t size,
                          struct blob_table *blob_table);