[Crosstoolchain-logs] [device-tree-compiler] 165/357: libfdt: Rename and publish _fdt_check_header()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 96b5fad3a12697b8f2a50dbca944bd44c6f4eec8
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Wed Oct 24 10:28:52 2007 +1000

    libfdt: Rename and publish _fdt_check_header()
    
    It's potentially useful for users of libfdt to sanity check a device
    tree (or, rather, a blob of data which may or may not be a device
    tree) before processing it in more detail with libfdt.
    
    This patch renames the libfdt internal function _fdt_check_header() to
    fdt_check_header() and makes it a published function, so it can now be
    used for this purpose.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 libfdt/fdt.c             |  4 ++--
 libfdt/fdt_ro.c          |  6 +++---
 libfdt/fdt_rw.c          |  2 +-
 libfdt/libfdt.h          | 29 +++++++++++++++++------------
 libfdt/libfdt_internal.h |  1 -
 5 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/libfdt/fdt.c b/libfdt/fdt.c
index a29f1b0..2911b42 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -55,7 +55,7 @@
 
 #include "libfdt_internal.h"
 
-int _fdt_check_header(const void *fdt)
+int fdt_check_header(const void *fdt)
 {
 	if (fdt_magic(fdt) == FDT_MAGIC) {
 		/* Complete tree */
@@ -143,7 +143,7 @@ const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
 
 int fdt_move(const void *fdt, void *buf, int bufsize)
 {
-	int err = _fdt_check_header(fdt);
+	int err = fdt_check_header(fdt);
 
 	if (err)
 		return err;
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index ebd3d01..f39785f 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -58,7 +58,7 @@
 #define CHECK_HEADER(fdt) \
 	{ \
 		int err; \
-		if ((err = _fdt_check_header(fdt)) != 0) \
+		if ((err = fdt_check_header(fdt)) != 0) \
 			return err; \
 	}
 
@@ -193,7 +193,7 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
 	const struct fdt_node_header *nh;
 	int err;
 
-	if ((err = _fdt_check_header(fdt)) != 0)
+	if ((err = fdt_check_header(fdt)) != 0)
 		goto fail;
 
 	err = -FDT_ERR_BADOFFSET;
@@ -222,7 +222,7 @@ const struct fdt_property *fdt_get_property(const void *fdt,
 	int offset, nextoffset;
 	int err;
 
-	if ((err = _fdt_check_header(fdt)) != 0)
+	if ((err = fdt_check_header(fdt)) != 0)
 		goto fail;
 
 	err = -FDT_ERR_BADOFFSET;
diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index ff74e3c..bb7a2b7 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -59,7 +59,7 @@ static int rw_check_header(void *fdt)
 {
 	int err;
 
-	if ((err = _fdt_check_header(fdt)))
+	if ((err = fdt_check_header(fdt)))
 		return err;
 	if (fdt_version(fdt) < 0x11)
 		return -FDT_ERR_BADVERSION;
diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
index 8d15155..e43c0f1 100644
--- a/libfdt/libfdt.h
+++ b/libfdt/libfdt.h
@@ -79,6 +79,22 @@
 
 #define FDT_ERR_MAX		12
 
+/* Low-level functions (you probably don't need these) */
+
+const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
+static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
+{
+	return (void *)fdt_offset_ptr(fdt, offset, checklen);
+}
+
+
+#define fdt_offset_ptr_typed(fdt, offset, var) \
+	((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
+#define fdt_offset_ptr_typed_w(fdt, offset, var) \
+	((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
+
+/* General functions */
+
 #define fdt_get_header(fdt, field) \
 	(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
 #define fdt_magic(fdt) 			(fdt_get_header(fdt, magic))
@@ -95,18 +111,7 @@
 #define fdt_set_header(fdt, field, val) \
 	((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
 
-const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
-static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
-{
-	return (void *)fdt_offset_ptr(fdt, offset, checklen);
-}
-
-
-#define fdt_offset_ptr_typed(fdt, offset, var) \
-	((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
-#define fdt_offset_ptr_typed_w(fdt, offset, var) \
-	((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
-
+int fdt_check_header(const void *fdt);
 int fdt_move(const void *fdt, void *buf, int bufsize);
 
 /* Read-only functions */
diff --git a/libfdt/libfdt_internal.h b/libfdt/libfdt_internal.h
index d2d5e6a..1e60936 100644
--- a/libfdt/libfdt_internal.h
+++ b/libfdt/libfdt_internal.h
@@ -58,7 +58,6 @@
 #define memeq(p, q, n)	(memcmp((p), (q), (n)) == 0)
 #define streq(p, q)	(strcmp((p), (q)) == 0)
 
-int _fdt_check_header(const void *fdt);
 uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset);
 const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
 int _fdt_node_end_offset(void *fdt, int nodeoffset);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list