This helper function returns the full device path for the device with the given phandle as a string.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/include/libopenbios/bindings.h | 1 + openbios-devel/libopenbios/bindings.c | 8 ++++++++ 2 files changed, 9 insertions(+)
diff --git a/openbios-devel/include/libopenbios/bindings.h b/openbios-devel/include/libopenbios/bindings.h index de9c775..4ec9789 100644 --- a/openbios-devel/include/libopenbios/bindings.h +++ b/openbios-devel/include/libopenbios/bindings.h @@ -56,6 +56,7 @@ extern ihandle_t open_package( const char *argstr, phandle_t ph ); extern ihandle_t open_dev( const char *spec ); extern void close_package( ihandle_t ih ); extern void close_dev( ihandle_t ih ); +extern char *get_path_from_ph( phandle_t ph );
/* property access */ extern void set_property( phandle_t ph, const char *name, diff --git a/openbios-devel/libopenbios/bindings.c b/openbios-devel/libopenbios/bindings.c index 5323421..4f7a993 100644 --- a/openbios-devel/libopenbios/bindings.c +++ b/openbios-devel/libopenbios/bindings.c @@ -366,6 +366,14 @@ find_dev( const char *path ) return ret; }
+char * +get_path_from_ph( phandle_t ph ) +{ + PUSH(ph); + fword("get-package-path"); + return pop_fstr_copy(); +} + phandle_t dt_iter_begin( void ) {