[virt-tools-list] [libosinfo] Add osinfo_loader_process_default_path()
Richard W.M. Jones
rjones at redhat.com
Thu Jun 23 12:57:06 UTC 2011
On Thu, Jun 23, 2011 at 02:08:01AM +0300, Zeeshan Ali wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> Add a method that enables applications to load the metadata osinfo
> provides without having to specify any paths.
> ---
> docs/reference/Libosinfo-sections.txt | 1 +
> osinfo/Makefile.am | 3 ++-
> osinfo/libosinfo.syms | 1 +
> osinfo/osinfo_loader.c | 17 +++++++++++++++++
> osinfo/osinfo_loader.h | 1 +
> 5 files changed, 22 insertions(+), 1 deletions(-)
>
> diff --git a/docs/reference/Libosinfo-sections.txt b/docs/reference/Libosinfo-sections.txt
> index 6c3ce95..f5fc2e4 100644
> --- a/docs/reference/Libosinfo-sections.txt
> +++ b/docs/reference/Libosinfo-sections.txt
> @@ -70,6 +70,7 @@ osinfo_loader_new
> osinfo_loader_get_db
> osinfo_loader_process_path
> osinfo_loader_process_uri
> +osinfo_loader_process_default_path
> <SUBSECTION Standard>
> OSINFO_LOADER
> OSINFO_IS_LOADER
> diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
> index 6b94e27..6cb824c 100644
> --- a/osinfo/Makefile.am
> +++ b/osinfo/Makefile.am
> @@ -27,7 +27,8 @@ libosinfo_1_0_la_CFLAGS = \
> -I$(top_srcdir) \
> $(LIBXML_CFLAGS) \
> $(GOBJECT_CFLAGS) \
> - $(GIO_CFLAGS)
> + $(GIO_CFLAGS) \
> + -DDATA_DIR='"$(pkgdatadir)/data/oses"'
>
> libosinfo_1_0_la_LDFLAGS = \
> $(COVERAGE_LDFLAGS) \
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index 2ea5b55..80579b0 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -119,6 +119,7 @@ LIBOSINFO_0.0.1 {
> osinfo_loader_get_type;
> osinfo_loader_process_path;
> osinfo_loader_process_uri;
> + osinfo_loader_process_default_path;
> osinfo_loader_get_db;
> osinfo_deployment_new;
> osinfo_deployment_get_type;
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index ea93a63..fa2cc2d 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -964,6 +964,23 @@ void osinfo_loader_process_uri(OsinfoLoader *loader,
> g_object_unref(file);
> }
>
> +/**
> + * osinfo_loader_process_default_path:
> + * @loader: the loader object
> + * @err: (out): filled with error information upon failure
> + *
> + * Loads data from the default path.
> + */
> +void osinfo_loader_process_default_path(OsinfoLoader *loader,
> + GError **err)
> +{
> + GFile *file = g_file_new_for_path(DATA_DIR);
> + osinfo_loader_process_file(loader,
> + file,
> + err);
> + g_object_unref(file);
> +}
> +
> /*
> * Local variables:
> * indent-tabs-mode: nil
> diff --git a/osinfo/osinfo_loader.h b/osinfo/osinfo_loader.h
> index cc92495..e63cb5b 100644
> --- a/osinfo/osinfo_loader.h
> +++ b/osinfo/osinfo_loader.h
> @@ -71,6 +71,7 @@ OsinfoDb *osinfo_loader_get_db(OsinfoLoader *loader);
>
> void osinfo_loader_process_path(OsinfoLoader *loader, const gchar *path, GError **err);
> void osinfo_loader_process_uri(OsinfoLoader *loader, const gchar *uri, GError **err);
> +void osinfo_loader_process_default_path(OsinfoLoader *loader, GError **err);
>
>
> #endif /* __OSINFO_LOADER_H__ */
Looks sensible, ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
More information about the virt-tools-list
mailing list