aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-04-08 00:56:54 -0400
committerJon Loeliger <jdl@jdl.com>2013-04-22 15:42:14 -0500
commita6d55e039fd22048687fe061b4609e2807efe764 (patch)
treec72c8905edf9ad0b423ea626f05b6207a93f94e2 /util.h
parent5543b88d5e3047b781552eb431bc2e3bdd9ade06 (diff)
downloaddtc-a6d55e039fd22048687fe061b4609e2807efe764.zip
dtc-a6d55e039fd22048687fe061b4609e2807efe764.tar.gz
dtc-a6d55e039fd22048687fe061b4609e2807efe764.tar.bz2
utilfdt_read: pass back up the length of data read
For a follow up commit, we want to be able to scan the buffer that was returned to us. In order to do that safely, we need to know how big the buffer actually is, so create a new set of funcs to pass that back. Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'util.h')
-rw-r--r--util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.h b/util.h
index 3f02cd8..95ae531 100644
--- a/util.h
+++ b/util.h
@@ -85,6 +85,13 @@ char get_escape_char(const char *s, int *i);
char *utilfdt_read(const char *filename);
/**
+ * Like utilfdt_read(), but also passes back the size of the file read.
+ *
+ * @param len If non-NULL, the amount of data we managed to read
+ */
+char *utilfdt_read_len(const char *filename, off_t *len);
+
+/**
* Read a device tree file into a buffer. Does not report errors, but only
* returns them. The value returned can be passed to strerror() to obtain
* an error message for the user.
@@ -95,6 +102,12 @@ char *utilfdt_read(const char *filename);
*/
int utilfdt_read_err(const char *filename, char **buffp);
+/**
+ * Like utilfdt_read_err(), but also passes back the size of the file read.
+ *
+ * @param len If non-NULL, the amount of data we managed to read
+ */
+int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len);
/**
* Write a device tree buffer to a file. This will report any errors on