Enrico Granata | 60b1cbc | 2019-05-20 11:06:46 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef MEMS_SETUP_DELEGATE_H_ |
| 6 | #define MEMS_SETUP_DELEGATE_H_ |
| 7 | |
| 8 | #include <unistd.h> |
| 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | #include <base/files/file_path.h> |
| 13 | #include <base/macros.h> |
| 14 | #include <base/optional.h> |
| 15 | |
| 16 | namespace mems_setup { |
| 17 | |
| 18 | class Delegate { |
| 19 | public: |
| 20 | virtual ~Delegate() = default; |
| 21 | |
| 22 | virtual base::Optional<std::string> ReadVpdValue(const std::string& key) = 0; |
| 23 | virtual bool ProbeKernelModule(const std::string& module) = 0; |
| 24 | |
| 25 | virtual bool Exists(const base::FilePath&) = 0; |
| 26 | |
Enrico Granata | 10e19de | 2019-05-21 14:17:36 -0700 | [diff] [blame^] | 27 | virtual base::Optional<gid_t> FindGroupId(const char* group) = 0; |
| 28 | |
| 29 | virtual int GetPermissions(const base::FilePath& path) = 0; |
| 30 | virtual bool SetPermissions(const base::FilePath& path, int mode) = 0; |
| 31 | |
| 32 | virtual bool SetOwnership(const base::FilePath& path, |
| 33 | uid_t user, |
| 34 | gid_t group) = 0; |
| 35 | |
Enrico Granata | 60b1cbc | 2019-05-20 11:06:46 -0700 | [diff] [blame] | 36 | protected: |
| 37 | Delegate() = default; |
| 38 | |
| 39 | private: |
| 40 | DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 41 | }; |
| 42 | |
| 43 | } // namespace mems_setup |
| 44 | |
| 45 | #endif // MEMS_SETUP_DELEGATE_H_ |