Alex Deymo | 5d52780 | 2014-07-18 14:24:13 -0700 | [diff] [blame] | 1 | // Copyright 2014 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 UPDATE_ENGINE_PAYLOAD_GENERATOR_EXT2_UTILS_H_ |
| 6 | #define UPDATE_ENGINE_PAYLOAD_GENERATOR_EXT2_UTILS_H_ |
| 7 | |
| 8 | #include <ext2fs/ext2fs.h> |
| 9 | |
| 10 | // Utility class to close a file system. |
| 11 | class ScopedExt2fsCloser { |
| 12 | public: |
| 13 | explicit ScopedExt2fsCloser(ext2_filsys filsys) : filsys_(filsys) {} |
| 14 | ~ScopedExt2fsCloser() { ext2fs_close(filsys_); } |
| 15 | |
| 16 | private: |
| 17 | ext2_filsys filsys_; |
| 18 | DISALLOW_COPY_AND_ASSIGN(ScopedExt2fsCloser); |
| 19 | }; |
| 20 | |
| 21 | #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_EXT2_UTILS_H_ |