]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - tools/binman/etype/blob.py
Merge branch 'next'
[thirdparty/u-boot.git] / tools / binman / etype / blob.py
index 6e63d777eb08247d31767f5af9745a3ca5012796..65ebb2ecf4d83490691ca1e431d13f993732c5b2 100644 (file)
@@ -55,10 +55,10 @@ class Entry_blob(Entry):
         self.ReadBlobContents()
         return True
 
-    def ReadBlobContents(self):
+    def ReadFileContents(self, pathname):
         """Read blob contents into memory
 
-        This function compresses the data before storing if needed.
+        This function compresses the data before returning if needed.
 
         We assume the data is small enough to fit into memory. If this
         is used for large filesystem image that might not be true.
@@ -66,13 +66,23 @@ class Entry_blob(Entry):
         new Entry method which can read in chunks. Then we could copy
         the data in chunks and avoid reading it all at once. For now
         this seems like an unnecessary complication.
+
+        Args:
+            pathname (str): Pathname to read from
+
+        Returns:
+            bytes: Data read
         """
         state.TimingStart('read')
-        indata = tools.ReadFile(self._pathname)
+        indata = tools.ReadFile(pathname)
         state.TimingAccum('read')
         state.TimingStart('compress')
         data = self.CompressData(indata)
         state.TimingAccum('compress')
+        return data
+
+    def ReadBlobContents(self):
+        data = self.ReadFileContents(self._pathname)
         self.SetContents(data)
         return True