[libosinfo PATCH 1/3] os: Add _get_.*_resources_without_inheritance()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Those two private methods have been added and those are part of the
field preparation for having Resources inherited in the same way we do
inherit devices.

https://gitlab.com/libosinfo/osinfo-db/issues/15

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo/Makefile.am         |  1 +
 osinfo/osinfo_os.c         | 41 ++++++++++++++++++++++++++++++++++----
 osinfo/osinfo_os_private.h | 39 ++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 4 deletions(-)
 create mode 100644 osinfo/osinfo_os_private.h

diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 86f6344..d87264d 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -150,6 +150,7 @@ libosinfo_private_header_files =	\
   osinfo_install_script_private.h	\
   osinfo_product_private.h		\
   osinfo_media_private.h		\
+  osinfo_os_private.h			\
   ignore-value.h			\
   $(NULL)
 
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index 2b870c4..4246069 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -27,6 +27,7 @@
 #include <osinfo/osinfo.h>
 #include "osinfo_media_private.h"
 #include "osinfo/osinfo_product_private.h"
+#include "osinfo/osinfo_os_private.h"
 #include <glib/gi18n-lib.h>
 
 G_DEFINE_TYPE(OsinfoOs, osinfo_os, OSINFO_TYPE_PRODUCT);
@@ -529,14 +530,17 @@ void osinfo_os_add_variant(OsinfoOs *os, OsinfoOsVariant *variant)
 }
 
 /**
- * osinfo_os_get_minimum_resources:
+ * osinfo_os_get_minimum_resources_without_inheritance:
  * @os: an operating system
  *
  * Get the list of minimum required resources for the operating system @os.
  *
+ * Mind that this method is *private*!
+ *
  * Returns: (transfer full): A list of resources
  */
-OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os)
+OsinfoResourcesList *
+osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os)
 {
     g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
 
@@ -548,14 +552,30 @@ OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os)
 }
 
 /**
- * osinfo_os_get_recommended_resources:
+ * osinfo_os_get_minimum_resources:
+ * @os: an operating system
+ *
+ * Get the list of minimum required resources for the operating system @os.
+ *
+ * Returns: (transfer full): A list of resources
+ */
+OsinfoResourcesList *osinfo_os_get_minimum_resources(OsinfoOs *os)
+{
+    return osinfo_os_get_minimum_resources_without_inheritance(os);
+}
+
+/**
+ * osinfo_os_get_recommended_resources_without_inheritance:
  * @os: an operating system
  *
  * Get the list of recommended resources for the operating system @os.
  *
+ * Mind that this methos is *private!
+ *
  * Returns: (transfer full): A list of resources
  */
-OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os)
+OsinfoResourcesList *
+osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os)
 {
     g_return_val_if_fail(OSINFO_IS_OS(os), NULL);
 
@@ -567,6 +587,19 @@ OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os)
     return newList;
 }
 
+/**
+ * osinfo_os_get_recommended_resources:
+ * @os: an operating system
+ *
+ * Get the list of recommended resources for the operating system @os.
+ *
+ * Returns: (transfer full): A list of resources
+ */
+OsinfoResourcesList *osinfo_os_get_recommended_resources(OsinfoOs *os)
+{
+    return osinfo_os_get_recommended_resources_without_inheritance(os);
+}
+
 /**
  * osinfo_os_add_minimum_resources:
  * @os: an operating system
diff --git a/osinfo/osinfo_os_private.h b/osinfo/osinfo_os_private.h
new file mode 100644
index 0000000..d8a13b2
--- /dev/null
+++ b/osinfo/osinfo_os_private.h
@@ -0,0 +1,39 @@
+/*
+ * libosinfo: an operating system
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *   Fabiano Fidêncio <fidencio@xxxxxxxxxx>
+ */
+
+#include <osinfo/osinfo_os.h>
+
+#ifndef __OSINFO_OS_PRIVATE_H__
+#define __OSINFO_OS_PRIVATE_H__
+
+OsinfoResourcesList *osinfo_os_get_minimum_resources_without_inheritance(OsinfoOs *os);
+OsinfoResourcesList *osinfo_os_get_recommended_resources_without_inheritance(OsinfoOs *os);
+
+#endif /* __OSINFO_OS_PRIVATE_H__ */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ */
-- 
2.19.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux