aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-12-14 13:30:53 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-12-14 13:30:53 +0000
commit061923298fe34e1bf5f32006f8d725a547fc4118 (patch)
tree9c406b57757d8848b93832015782ef59975dbfaf
parent2933f6980b82ed3dcf1289c8f729fb9ac63e52fa (diff)
include/hw/loader.h: Document load_image_size()
Add a documentation comment for load_image_size(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20181130151712.2312-11-peter.maydell@linaro.org
-rw-r--r--include/hw/loader.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/hw/loader.h b/include/hw/loader.h
index 3766559bc2..0a0ad808ea 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -11,6 +11,22 @@
* On error, errno is also set as appropriate.
*/
int64_t get_image_size(const char *filename);
+/**
+ * load_image_size: load an image file into specified buffer
+ * @filename: Path to the image file
+ * @addr: Buffer to load image into
+ * @size: Size of buffer in bytes
+ *
+ * Load an image file from disk into the specified buffer.
+ * If the image is larger than the specified buffer, only
+ * @size bytes are read (this is not considered an error).
+ *
+ * Prefer to use the GLib function g_file_get_contents() rather
+ * than a "get_image_size()/g_malloc()/load_image_size()" sequence.
+ *
+ * Returns the number of bytes read, or -1 on error. On error,
+ * errno is also set as appropriate.
+ */
ssize_t load_image_size(const char *filename, void *addr, size_t size);
/**load_image_targphys_as: