libstorage-ng
Partitionable.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) 2016 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_PARTITIONABLE_H
25 #define STORAGE_PARTITIONABLE_H
26 
27 
28 #include <vector>
29 
30 #include "storage/Utils/Topology.h"
31 #include "storage/Devices/BlkDevice.h"
32 #include "storage/Devices/PartitionTable.h"
33 
34 
35 namespace storage
36 {
37 
38  // abstract class
39 
40  class Partitionable : public BlkDevice
41  {
42  public:
43 
44  const Topology& get_topology() const;
45  void set_topology(const Topology& topology);
46 
47  unsigned int get_range() const;
48  void set_range(unsigned int range);
49 
54 
59  std::vector<PtType> get_possible_partition_table_types() const;
60 
61  PartitionTable* create_partition_table(PtType pt_type);
62 
63  bool has_partition_table() const;
64 
65  PartitionTable* get_partition_table();
66  const PartitionTable* get_partition_table() const;
67 
68  static std::vector<Partitionable*> get_all(Devicegraph* devicegraph);
69  static std::vector<const Partitionable*> get_all(const Devicegraph* devicegraph);
70 
71  public:
72 
73  class Impl;
74 
75  Impl& get_impl();
76  const Impl& get_impl() const;
77 
78  protected:
79 
80  Partitionable(Impl* impl);
81 
82  };
83 
84 
85  bool is_partitionable(const Device* device);
86 
87  Partitionable* to_partitionable(Device* device);
88  const Partitionable* to_partitionable(const Device* device);
89 
90 }
91 
92 #endif
PtType get_default_partition_table_type() const
Get the default partition table type for the partitionable.
PtType
Partition Table Type.
Definition: PartitionTable.h:42
std::vector< PtType > get_possible_partition_table_types() const
Get possible partition table types for the disk.
The master container of the libstorage.
Definition: Devicegraph.h:133
An abstract Block Device.
Definition: BlkDevice.h:40
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:73
Definition: Partitionable.h:40
A class to calculate partition alignment based on hardware topology.
Definition: Topology.h:57
The storage namespace.
Definition: Actiongraph.h:36
Definition: PartitionTable.h:71