libstorage-ng
Loading...
Searching...
No Matches
Arch.h
1/*
2 * Copyright (c) [2004-2015] Novell, Inc.
3 * Copyright (c) 2017 SUSE LLC
4 *
5 * All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as published
9 * by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, contact Novell, Inc.
18 *
19 * To contact Novell about this file by physical or electronic mail, you may
20 * find current contact information at www.novell.com.
21 */
22
23
24#ifndef STORAGE_ARCH_H
25#define STORAGE_ARCH_H
26
27
28#include <libxml/tree.h>
29#include <string>
30
31
32namespace storage
33{
34
35 class Arch
36 {
37 public:
38
39 Arch(bool do_probe = true);
40
41 void readData(const xmlNode* node);
42 void saveData(xmlNode* node) const;
43
44 const std::string& get_arch() const { return arch; }
45 void set_arch(const std::string& arch) { Arch::arch = arch; }
46
47 bool is_ia64() const;
48 bool is_ppc() const;
49 bool is_ppc64le() const;
50 bool is_s390() const;
51 bool is_sparc() const;
52 bool is_x86() const;
53
54 bool is_ppc_mac() const { return ppc_mac; }
55 bool is_ppc_pegasos() const { return ppc_pegasos; }
56 bool is_ppc_power_nv() const { return ppc_power_nv; }
57
58 bool is_efiboot() const { return efiboot; }
59 void set_efiboot(bool efiboot) { Arch::efiboot = efiboot; }
60
61 static bool is_efibootmgr();
62
63 unsigned int get_page_size() const { return page_size; }
64
65 friend std::ostream& operator<<(std::ostream& s, const Arch& arch);
66
67 private:
68
69 void probe();
70
71 std::string arch = "unknown";
72 bool ppc_mac = false;
73 bool ppc_pegasos = false;
74 bool ppc_power_nv = false;
75 bool efiboot = false;
76 unsigned int page_size = 0;
77
78 };
79
80
81 std::ostream& operator<<(std::ostream& s, const Arch& arch);
82
83}
84
85
86#endif
Definition Arch.h:36
The storage namespace.
Definition Actiongraph.h:40
std::ostream & operator<<(std::ostream &str, const CodeLocation &obj)
CodeLocation stream output.