libstorage-ng
BlkFilesystem.h
1 /*
2  * Copyright (c) [2014-2015] Novell, Inc.
3  * Copyright (c) [2016-2018] 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_BLK_FILESYSTEM_H
25 #define STORAGE_BLK_FILESYSTEM_H
26 
27 
28 #include <vector>
29 
30 #include "storage/Filesystems/Filesystem.h"
31 
32 
33 namespace storage
34 {
35 
36  class BlkDevice;
37  class ContentInfo;
38 
39 
40  // abstract class
41 
42  class BlkFilesystem : public Filesystem
43  {
44  public:
45 
49  static std::vector<BlkFilesystem*> get_all(Devicegraph* devicegraph);
50 
54  static std::vector<const BlkFilesystem*> get_all(const Devicegraph* devicegraph);
55 
56  bool supports_label() const;
57  unsigned int max_labelsize() const;
58 
59  const std::string& get_label() const;
60  void set_label(const std::string& label);
61 
62  bool supports_uuid() const;
63 
64  const std::string& get_uuid() const;
65  void set_uuid(const std::string& uuid);
66 
70  const std::string& get_mkfs_options() const;
71 
77  void set_mkfs_options(const std::string& mkfs_options);
78 
82  const std::string& get_tune_options() const;
83 
91  void set_tune_options(const std::string& tune_options);
92 
96  bool supports_shrink() const;
97 
101  bool supports_grow() const;
102 
108 
113  bool supports_mounted_grow() const;
114 
120 
126 
130  void set_resize_info(const ResizeInfo& resize_info);
131 
138 
142  void set_content_info(const ContentInfo& content_info);
143 
144  static std::vector<const BlkFilesystem*> find_by_label(const Devicegraph* devicegraph,
145  const std::string& label);
146 
147  static std::vector<const BlkFilesystem*> find_by_uuid(const Devicegraph* devicegraph,
148  const std::string& uuid);
149 
150  std::vector<const BlkDevice*> get_blk_devices() const;
151 
152  public:
153 
154  class Impl;
155 
156  Impl& get_impl();
157  const Impl& get_impl() const;
158 
159  protected:
160 
161  BlkFilesystem(Impl* impl);
162 
163  };
164 
165 
171  bool is_blk_filesystem(const Device* device);
172 
180 
184  const BlkFilesystem* to_blk_filesystem(const Device* device);
185 
186 }
187 
188 #endif
storage::BlkFilesystem::get_mkfs_options
const std::string & get_mkfs_options() const
Get extra options for the filesystem mkfs command.
storage::BlkFilesystem::supports_shrink
bool supports_shrink() const
Checks whether shrinking the filesystem is supported.
storage::BlkFilesystem::set_content_info
void set_content_info(const ContentInfo &content_info)
Set the ResizeInfo.
storage::BlkFilesystem::detect_content_info
ContentInfo detect_content_info() const
Detect the content info of the filesystem.
storage
The storage namespace.
Definition: Actiongraph.h:39
storage::BlkFilesystem::set_tune_options
void set_tune_options(const std::string &tune_options)
Set extra options for the filesystem tune command.
storage::ContentInfo
Definition: FreeInfo.h:252
storage::Devicegraph
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
storage::BlkFilesystem::get_tune_options
const std::string & get_tune_options() const
Get extra options for the filesystem tune command.
storage::BlkFilesystem::get_all
static std::vector< const BlkFilesystem * > get_all(const Devicegraph *devicegraph)
Get all BlkFilesystems.
storage::BlkFilesystem::set_mkfs_options
void set_mkfs_options(const std::string &mkfs_options)
Set extra options for the filesystem mkfs command.
storage::BlkFilesystem::supports_unmounted_grow
bool supports_unmounted_grow() const
Checks whether growing the filesystem while being unmounted is supported.
storage::ResizeInfo
Definition: FreeInfo.h:198
storage::Device
An abstract base class for storage devices.
Definition: Device.h:82
storage::BlkFilesystem::supports_grow
bool supports_grow() const
Checks whether growing the filesystem is supported.
storage::Filesystem
Definition: Filesystem.h:41
storage::BlkFilesystem::set_resize_info
void set_resize_info(const ResizeInfo &resize_info)
Set the ResizeInfo.
storage::BlkFilesystem::get_all
static std::vector< BlkFilesystem * > get_all(Devicegraph *devicegraph)
Get all BlkFilesystems.
storage::BlkFilesystem
Definition: BlkFilesystem.h:43
storage::BlkFilesystem::supports_mounted_grow
bool supports_mounted_grow() const
Checks whether growing the filesystem while being mounted is supported.
storage::BlkFilesystem::supports_mounted_shrink
bool supports_mounted_shrink() const
Checks whether shrinking the filesystem while being mounted is supported.
storage::BlkFilesystem::supports_unmounted_shrink
bool supports_unmounted_shrink() const
Checks whether shrinking the filesystem while being unmounted is supported.
storage::to_blk_filesystem
BlkFilesystem * to_blk_filesystem(Device *device)
Converts pointer to Device to pointer to BlkFilesystem.
storage::is_blk_filesystem
bool is_blk_filesystem(const Device *device)
Checks whether device points to a BlkFilesystem.