libstorage-ng
Nfs.h
1 /*
2  * Copyright (c) 2017 SUSE LLC
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 
23 #ifndef STORAGE_NFS_H
24 #define STORAGE_NFS_H
25 
26 
27 #include "storage/Filesystems/Filesystem.h"
28 #include "storage/Devicegraph.h"
29 
30 
31 namespace storage
32 {
33 
35  {
36  public:
37 
38  NfsNotFoundByServerAndPath(const std::string& server, const std::string& path);
39  };
40 
41 
52  class Nfs : public Filesystem
53  {
54  public:
55 
56  static Nfs* create(Devicegraph* devicegraph, const std::string& server, const std::string& path);
57  static Nfs* load(Devicegraph* devicegraph, const xmlNode* node);
58 
59  const std::string& get_server() const;
60 
61  const std::string& get_path() const;
62 
63  static std::vector<Nfs*> get_all(Devicegraph* devicegraph);
64  static std::vector<const Nfs*> get_all(const Devicegraph* devicegraph);
65 
71  static Nfs* find_by_server_and_path(Devicegraph* devicegraph, const std::string& server,
72  const std::string& path);
73 
77  static const Nfs* find_by_server_and_path(const Devicegraph* devicegraph,
78  const std::string& server, const std::string& path);
79 
80  public:
81 
82  class Impl;
83 
84  Impl& get_impl();
85  const Impl& get_impl() const;
86 
87  virtual Nfs* clone() const override;
88 
89  protected:
90 
91  Nfs(Impl* impl);
92 
93  };
94 
95 
96  bool is_nfs(const Device* device);
97 
104  Nfs* to_nfs(Device* device);
105 
109  const Nfs* to_nfs(const Device* device);
110 
111 }
112 
113 #endif
static Nfs * find_by_server_and_path(Devicegraph *devicegraph, const std::string &server, const std::string &path)
Find a Nfs by its server and path.
Nfs * to_nfs(Device *device)
Converts pointer to Device to pointer to Nfs.
The master container of the libstorage.
Definition: Devicegraph.h:153
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
Class to represent a NFS mount.
Definition: Nfs.h:52
Definition: Devicegraph.h:48
Definition: Filesystem.h:40
The storage namespace.
Definition: Actiongraph.h:37