Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: utils.h

Issue 5684002: Add support for bsdiff of file system metadata blocks (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Forgot newly added metadata processing files. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test_utils.h ('K') | « test_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils.h
diff --git a/utils.h b/utils.h
index 34b862e109195ec393e81fdbc9562679bb791a90..d2b39cdce9327d681166f6518489465e6b12106d 100644
--- a/utils.h
+++ b/utils.h
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include <ext2fs/ext2fs.h>
#include <glib.h>
#include "update_engine/action.h"
@@ -271,6 +272,15 @@ class ScopedFdCloser {
DISALLOW_COPY_AND_ASSIGN(ScopedFdCloser);
};
+// Utility class to close a file system
+class ScopedExt2fsCloser {
+ public:
+ explicit ScopedExt2fsCloser(ext2_filsys filsys) : filsys_(filsys) {}
+ ~ScopedExt2fsCloser() { ext2fs_close(filsys_); }
+ private:
petkov 2010/12/15 18:40:32 empty line before private (yeah, i know the rest o
thieule 2010/12/15 19:57:01 Done.
+ ext2_filsys filsys_;
+};
petkov 2010/12/15 18:40:32 Add DISALLOW_COPY_AND_ASSIGN
thieule 2010/12/15 19:57:01 Done.
+
// Utility class to delete a file when it goes out of scope.
class ScopedPathUnlinker {
public:
@@ -389,6 +399,16 @@ class ScopedActionCompleter {
} \
} while (0)
+#define TEST_AND_RETURN_FALSE_ERRCODE(_x) \
+ do { \
+ errcode_t _error = (_x); \
+ if (_error) { \
+ errno = _error; \
+ LOG(ERROR) << #_x " failed: " << _error; \
+ return false; \
+ } \
+ } while (0)
+
#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UTILS_H__
« test_utils.h ('K') | « test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698