1 /*
2  * libosinfo: Required or recommended resources for an (guest) OS
3  *
4  * Copyright (C) 2009-2020 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <glib-object.h>
22 #include <gio/gio.h>
23 #include <osinfo/osinfo_entity.h>
24 
25 #ifndef __OSINFO_RESOURCES_H__
26 # define __OSINFO_RESOURCES_H__
27 
28 # include "osinfo/osinfo_macros.h"
29 
30 # define OSINFO_ARCHITECTURE_ALL "all"
31 # define OSINFO_MEGAHERTZ        1000000
32 # define OSINFO_KIBIBYTES        1024
33 # define OSINFO_MEBIBYTES        1048576
34 # define OSINFO_GIBIBYTES        1073741824
35 
36 # define OSINFO_TYPE_RESOURCES (osinfo_resources_get_type ())
37 OSINFO_DECLARE_TYPE_WITH_PRIVATE_AND_CLASS(OsinfoResources,
38                                            osinfo_resources,
39                                            OSINFO,
40                                            RESOURCES,
41                                            OsinfoEntity)
42 
43 # define OSINFO_RESOURCES_PROP_ARCHITECTURE "architecture"
44 # define OSINFO_RESOURCES_PROP_CPU          "cpu"
45 # define OSINFO_RESOURCES_PROP_N_CPUS       "n-cpus"
46 # define OSINFO_RESOURCES_PROP_RAM          "ram"
47 # define OSINFO_RESOURCES_PROP_STORAGE      "storage"
48 
49 OsinfoResources *osinfo_resources_new(const gchar *id, const gchar *architecture);
50 
51 const gchar *osinfo_resources_get_architecture(OsinfoResources *resources);
52 gint osinfo_resources_get_n_cpus(OsinfoResources *resources);
53 gint64 osinfo_resources_get_cpu(OsinfoResources *resources);
54 gint64 osinfo_resources_get_ram(OsinfoResources *resources);
55 gint64 osinfo_resources_get_storage(OsinfoResources *resources);
56 
57 void osinfo_resources_set_n_cpus(OsinfoResources *resources, gint n_cpus);
58 void osinfo_resources_set_cpu(OsinfoResources *resources, gint64 cpu);
59 void osinfo_resources_set_ram(OsinfoResources *resources, gint64 ram);
60 void osinfo_resources_set_storage(OsinfoResources *resources, gint64 storage);
61 
62 #endif /* __OSINFO_RESOURCES_H__ */
63