From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQHFy-0007Ye-Ky for qemu-devel@nongnu.org; Mon, 01 Feb 2016 11:23:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQHFt-0005Lz-Km for qemu-devel@nongnu.org; Mon, 01 Feb 2016 11:23:14 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:35165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQHFt-0005Lf-6i for qemu-devel@nongnu.org; Mon, 01 Feb 2016 11:23:09 -0500 Received: by mail-wm0-x22b.google.com with SMTP id r129so78635684wmr.0 for ; Mon, 01 Feb 2016 08:23:09 -0800 (PST) References: <1454334712-12360-1-git-send-email-eric.auger@linaro.org> <1454334712-12360-3-git-send-email-eric.auger@linaro.org> From: Eric Auger Message-ID: <56AF8657.6060303@linaro.org> Date: Mon, 1 Feb 2016 17:22:47 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 2/8] device_tree: introduce load_device_tree_from_sysfs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rob Herring Cc: Peter Maydell , thuth@redhat.com, eric.auger@st.com, Thomas Lendacky , Linaro Patches , QEMU Developers , Peter Crosthwaite , alex.williamson@redhat.com, qemu-arm@nongnu.org, Suravee Suthikulanit , Paolo Bonzini , b.reynal@virtualopensystems.com, =?UTF-8?Q?Alex_Benn=c3=a9e?= , Christoffer Dall , David Gibson Hi Rob, On 02/01/2016 05:15 PM, Rob Herring wrote: > On Mon, Feb 1, 2016 at 7:51 AM, Eric Auger wrote: >> This function returns the host device tree blob from sysfs >> (/proc/device-tree). It uses a recursive function inspired >> from dtc read_fstree. >> >> Signed-off-by: Eric Auger >> >> --- >> v5 -> v6: >> - fix some spelling mistakes >> - error_report + exit replaced by error_setg >> - const char *parent_node; >> - use g_strdup_printf instead of g_strjoin >> - add a doc comment for load_device_tree_from_sysfs >> v1 -> v2: >> - do not implement/expose read_fstree and load_device_tree_from_sysfs >> if CONFIG_LINUX is not defined (lstat is not implemeted in mingw) >> - correct indentation in read_fstree >> - use /proc/device-tree symlink instead of /sys/firmware/devicetree/base >> path (kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw) >> - use g_file_get_contents in read_fstree >> - introduce SYSFS_DT_BASEDIR macro and use strlen >> - exit on error in load_device_tree_from_sysfs >> - user error_setg >> >> RFC -> v1: >> - remove runtime dependency on dtc binary and introduce read_fstree >> --- >> device_tree.c | 99 ++++++++++++++++++++++++++++++++++++++++++++ >> include/sysemu/device_tree.h | 8 ++++ >> 2 files changed, 107 insertions(+) >> >> diff --git a/device_tree.c b/device_tree.c >> index a9f5f8e..3797182 100644 >> --- a/device_tree.c >> +++ b/device_tree.c >> @@ -17,6 +17,9 @@ >> #include >> #include >> #include >> +#ifdef CONFIG_LINUX >> +#include >> +#endif >> >> #include "qemu-common.h" >> #include "qemu/error-report.h" >> @@ -117,6 +120,102 @@ fail: >> return NULL; >> } >> >> +#ifdef CONFIG_LINUX >> + >> +#define SYSFS_DT_BASEDIR "/proc/device-tree" > > Use the sysfs path (/sys/firmware/device-tree/ IIRC) as this is just a > symlink to sysfs and /proc is considered the legacy path. I used the sysfs originally but I eventually found: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw which states: "Userspace must not use the /sys/firmware/devicetree/base path directly, but instead should follow /proc/device-tree symlink. It is possible that the absolute path will change in the future, but the symlink is the stable ABI. " Do you confirm this statement is outdated. Thank you in advance Best Regards Eric > > Rob >