1 /* 2 * libosinfo: An installation tree for a (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_TREE_H__ 26 # define __OSINFO_TREE_H__ 27 28 # include "osinfo/osinfo_macros.h" 29 30 GQuark 31 osinfo_tree_error_quark (void) G_GNUC_CONST; 32 33 # define OSINFO_TREE_ERROR (osinfo_tree_error_quark ()) 34 35 /** 36 * OsinfoTreeError: 37 * @OSINFO_TREE_ERROR_NO_TREEINFO: No treeinfo found; 38 * @OSINFO_TREE_ERROR_NOT_SUPPORTED_PROTOCOL: The URL protocol is not supported. 39 * 40 * #GError codes used for errors in the #OSINFO_TREE_ERROR domain, during 41 * reading the treeinfo from a URI. 42 * 43 * Since: 1.6.0 44 */ 45 typedef enum { 46 OSINFO_TREE_ERROR_NO_TREEINFO, 47 OSINFO_TREE_ERROR_NOT_SUPPORTED_PROTOCOL 48 } OsinfoTreeError; 49 50 # define OSINFO_TYPE_TREE (osinfo_tree_get_type ()) 51 OSINFO_DECLARE_TYPE_WITH_PRIVATE_AND_CLASS(OsinfoTree, 52 osinfo_tree, 53 OSINFO, 54 TREE, 55 OsinfoEntity) 56 57 # define OSINFO_TREE_PROP_ARCHITECTURE "architecture" 58 # define OSINFO_TREE_PROP_URL "url" 59 # define OSINFO_TREE_PROP_TREEINFO_FAMILY "treeinfo-family" 60 # define OSINFO_TREE_PROP_TREEINFO_VARIANT "treeinfo-variant" 61 # define OSINFO_TREE_PROP_TREEINFO_VERSION "treeinfo-version" 62 # define OSINFO_TREE_PROP_TREEINFO_ARCH "treeinfo-arch" 63 # define OSINFO_TREE_PROP_BOOT_ISO "boot-iso" 64 # define OSINFO_TREE_PROP_KERNEL "kernel" 65 # define OSINFO_TREE_PROP_INITRD "initrd" 66 # define OSINFO_TREE_PROP_HAS_TREEINFO "has-treeinfo" 67 # define OSINFO_TREE_PROP_VARIANT "variant" 68 69 OsinfoTree *osinfo_tree_new(const gchar *id, const gchar *architecture); 70 OsinfoTree *osinfo_tree_create_from_location(const gchar *location, 71 GCancellable *cancellable, 72 GError **error); 73 void osinfo_tree_create_from_location_async(const gchar *location, 74 gint priority, 75 GCancellable *cancellable, 76 GAsyncReadyCallback callback, 77 gpointer user_data); 78 OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, 79 GError **error); 80 81 OsinfoTree *osinfo_tree_create_from_treeinfo(const gchar *treeinfo, 82 const gchar *location, 83 GError **error); 84 85 const gchar *osinfo_tree_get_architecture(OsinfoTree *tree); 86 const gchar *osinfo_tree_get_url(OsinfoTree *tree); 87 gboolean osinfo_tree_has_treeinfo(OsinfoTree *tree); 88 const gchar *osinfo_tree_get_treeinfo_family(OsinfoTree *tree); 89 const gchar *osinfo_tree_get_treeinfo_variant(OsinfoTree *tree); 90 const gchar *osinfo_tree_get_treeinfo_version(OsinfoTree *tree); 91 const gchar *osinfo_tree_get_treeinfo_arch(OsinfoTree *tree); 92 /* XXX list of files to probe for in absence of treeinfo ? see virtinst isValidStore */ 93 const gchar *osinfo_tree_get_boot_iso_path(OsinfoTree *tree); 94 const gchar *osinfo_tree_get_kernel_path(OsinfoTree *tree); 95 const gchar *osinfo_tree_get_initrd_path(OsinfoTree *tree); 96 OsinfoOs *osinfo_tree_get_os(OsinfoTree *tree); 97 void osinfo_tree_set_os(OsinfoTree *tree, OsinfoOs *os); 98 OsinfoOsVariantList *osinfo_tree_get_os_variants(OsinfoTree *tree); 99 /* XXX Xen kernel/initrd paths ? */ 100 101 #endif /* __OSINFO_TREE_H__ */ 102