libstorage-ng
Loading...
Searching...
No Matches
Dasd.h
1/*
2 * Copyright (c) [2014-2015] Novell, Inc.
3 * Copyright (c) [2016-2021] 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
31namespace 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
55 std::string get_dasd_type_name(DasdType dasd_type);
56
57
63 std::string get_dasd_format_name(DasdFormat dasd_format);
64
65
69 class Dasd : public Partitionable
70 {
71 public:
72
79 static Dasd* create(Devicegraph* devicegraph, const std::string& name);
80
84 static Dasd* create(Devicegraph* devicegraph, const std::string& name,
85 const Region& region);
86
90 static Dasd* create(Devicegraph* devicegraph, const std::string& name,
91 unsigned long long size);
92
93 static Dasd* load(Devicegraph* devicegraph, const xmlNode* node);
94
98 static std::vector<Dasd*> get_all(Devicegraph* devicegraph);
99
103 static std::vector<const Dasd*> get_all(const Devicegraph* devicegraph);
104
108 std::string get_bus_id() const;
109
118 void set_bus_id(std::string bus_id);
119
125 bool is_rotational() const;
126
133
142 void set_type(DasdType type);
143
150
159 void set_format(DasdFormat format);
160
167 static Dasd* find_by_name(Devicegraph* devicegraph, const std::string& name);
168
172 static const Dasd* find_by_name(const Devicegraph* devicegraph, const std::string& name);
173
174 public:
175
176 class Impl;
177
178 Impl& get_impl();
179 const Impl& get_impl() const;
180
181 virtual Dasd* clone() const override;
182
183 protected:
184
185 Dasd(Impl* impl);
186
187 };
188
189
195 bool is_dasd(const Device* device);
196
203 Dasd* to_dasd(Device* device);
204
208 const Dasd* to_dasd(const Device* device);
209
210}
211
212#endif
A physical DASD device.
Definition: Dasd.h:70
void set_type(DasdType type)
Set the DASD type.
static Dasd * create(Devicegraph *devicegraph, const std::string &name, unsigned long long size)
Create a device of type Dasd.
static std::vector< const Dasd * > get_all(const Devicegraph *devicegraph)
Get all Dasds.
DasdFormat get_format() const
Get the DASD format.
void set_bus_id(std::string bus_id)
Set the bus ID of the DASD.
static Dasd * create(Devicegraph *devicegraph, const std::string &name)
Create a device of type Dasd.
static const Dasd * find_by_name(const Devicegraph *devicegraph, const std::string &name)
Find a Dasd by its name.
static Dasd * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a Dasd by its name.
std::string get_bus_id() const
Get the bus ID of the DASD.
bool is_rotational() const
Return whether the DASD is of rotational or non-rotational type.
static std::vector< Dasd * > get_all(Devicegraph *devicegraph)
Get all Dasds.
void set_format(DasdFormat format)
Set the DASD format.
DasdType get_type() const
Get the DASD type.
static Dasd * create(Devicegraph *devicegraph, const std::string &name, const Region &region)
Create a device of type Dasd.
An abstract base class for storage devices.
Definition: Device.h:82
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
Definition: Partitionable.h:40
A start/length pair with a block size.
Definition: Region.h:85
The storage namespace.
Definition: Actiongraph.h:39
std::string get_dasd_type_name(DasdType dasd_type)
Convert the DASD type dasd_type to a string.
DasdFormat
The layout with which the ECKD DASD was formatted.
Definition: Dasd.h:45
std::string get_dasd_format_name(DasdFormat dasd_format)
Convert the DASD format dasd_format to a string.
Dasd * to_dasd(Device *device)
Converts pointer to Device to pointer to Dasd.
bool is_dasd(const Device *device)
Checks whether device points to a Dasd.
DasdType
The DASD type.
Definition: Dasd.h:37