libstorage-ng
Dasd.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) [2016-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_DASD_H
25 #define STORAGE_DASD_H
26 
27 
28 #include "storage/Devices/Partitionable.h"
29 
30 
31 namespace storage
32 {
33 
37  enum class DasdType {
38  UNKNOWN, ECKD, FBA
39  };
40 
41 
45  enum class DasdFormat {
46  NONE, LDL, CDL
47  };
48 
49 
53  class Dasd : public Partitionable
54  {
55  public:
56 
57  static Dasd* create(Devicegraph* devicegraph, const std::string& name);
58  static Dasd* create(Devicegraph* devicegraph, const std::string& name,
59  const Region& region);
60  static Dasd* create(Devicegraph* devicegraph, const std::string& name,
61  unsigned long long size);
62 
63  static Dasd* load(Devicegraph* devicegraph, const xmlNode* node);
64 
68  static std::vector<Dasd*> get_all(Devicegraph* devicegraph);
69 
73  static std::vector<const Dasd*> get_all(const Devicegraph* devicegraph);
74 
75  std::string get_bus_id() const;
76  void set_bus_id(std::string bus_id);
77 
78  bool is_rotational() const;
79 
80  DasdType get_type() const;
81  void set_type(DasdType type);
82 
83  DasdFormat get_format() const;
84  void set_format(DasdFormat format);
85 
92  static Dasd* find_by_name(Devicegraph* devicegraph, const std::string& name);
93 
97  static const Dasd* find_by_name(const Devicegraph* devicegraph, const std::string& name);
98 
99  public:
100 
101  class Impl;
102 
103  Impl& get_impl();
104  const Impl& get_impl() const;
105 
106  virtual Dasd* clone() const override;
107 
108  protected:
109 
110  Dasd(Impl* impl);
111 
112  };
113 
114 
115  bool is_dasd(const Device* device);
116 
123  Dasd* to_dasd(Device* device);
124 
128  const Dasd* to_dasd(const Device* device);
129 
130 }
131 
132 #endif
A physical DASD device.
Definition: Dasd.h:53
DasdType
The DASD type.
Definition: Dasd.h:37
static Dasd * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a Dasd by its name.
A start/length pair with a block size.
Definition: Region.h:73
The master container of the libstorage.
Definition: Devicegraph.h:153
Dasd * to_dasd(Device *device)
Converts pointer to Device to pointer to Dasd.
DasdFormat
The layout with which the ECKD DASD was formatted.
Definition: Dasd.h:45
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
static std::vector< Dasd * > get_all(Devicegraph *devicegraph)
Get all Dasds.
Definition: Partitionable.h:40
The storage namespace.
Definition: Actiongraph.h:37