Index: util/mac/xattr.h |
diff --git a/util/mac/xattr.h b/util/mac/xattr.h |
index b816f3909b565d4ca7346f13fe7d511287b3b3b5..a02f973bc31ce119533dcee8523e2b090f616af8 100644 |
--- a/util/mac/xattr.h |
+++ b/util/mac/xattr.h |
@@ -24,17 +24,26 @@ |
namespace crashpad { |
+//! \brief The result code for an ReadXattr or WriteXattr operation. |
Mark Mentovai
2015/01/09 17:52:35
I don’t think you need to use these for WriteXattr
Robert Sesek
2015/01/09 17:59:40
Done.
|
+enum class XattrStatus { |
Mark Mentovai
2015/01/09 17:52:35
Our second one of these. Nice!
Robert Sesek
2015/01/09 17:59:40
Third, actually :)
|
+ //! \brief No error occured. No message is logged. |
+ kOK = 0, |
+ //! \brief The attribute does not exist. No message is logged. |
Mark Mentovai
2015/01/09 17:52:35
Space these out with blanks.
Robert Sesek
2015/01/09 17:59:40
Done.
|
+ kNoAttribute, |
+ //! \brief An error occurred and an error message was logged. |
+ kOtherError, |
+}; |
+ |
//! \brief Reads an extended attribute on a file. |
//! |
//! \param[in] file The path to the file. |
//! \param[in] name The name of the extended attribute to read. |
//! \param[out] value The value of the attribute. |
//! |
-//! \return `true` if the read was successful, with \a value filled in. `false` |
-//! on error, with a message logged. |
-bool ReadXattr(const base::FilePath& file, |
- const base::StringPiece& name, |
- std::string* value); |
+//! \return XattrStatus |
+XattrStatus ReadXattr(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ std::string* value); |
//! \brief Writes an extended attribute on a file. |
//! |
@@ -42,44 +51,43 @@ bool ReadXattr(const base::FilePath& file, |
//! \param[in] name The name of the extended attribute to write. |
//! \param[in] value The value of the attribute. |
//! |
-//! \return `true` if the write was successful. `false` on error, with a message |
-//! logged. |
-bool WriteXattr(const base::FilePath& file, |
- const base::StringPiece& name, |
- const std::string& value); |
+//! \return XattrStatus |
+XattrStatus WriteXattr(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ const std::string& value); |
//! \copydoc ReadXattr |
//! |
//! Only the values `"0"` and `"1"`, for `false` and `true` respectively, are |
//! valid conversions. |
-bool ReadXattrBool(const base::FilePath& file, |
- const base::StringPiece& name, |
- bool* value); |
+XattrStatus ReadXattrBool(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ bool* value); |
//! \copydoc WriteXattr |
-bool WriteXattrBool(const base::FilePath& file, |
- const base::StringPiece& name, |
- bool value); |
+XattrStatus WriteXattrBool(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ bool value); |
//! \copydoc ReadXattr |
-bool ReadXattrInt(const base::FilePath& file, |
- const base::StringPiece& name, |
- int* value); |
+XattrStatus ReadXattrInt(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ int* value); |
//! \copydoc WriteXattr |
-bool WriteXattrInt(const base::FilePath& file, |
- const base::StringPiece& name, |
- int value); |
+XattrStatus WriteXattrInt(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ int value); |
//! \copydoc ReadXattr |
-bool ReadXattrTimeT(const base::FilePath& file, |
- const base::StringPiece& name, |
- time_t* value); |
+XattrStatus ReadXattrTimeT(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ time_t* value); |
//! \copydoc WriteXattr |
-bool WriteXattrTimeT(const base::FilePath& file, |
- const base::StringPiece& name, |
- time_t value); |
+XattrStatus WriteXattrTimeT(const base::FilePath& file, |
+ const base::StringPiece& name, |
+ time_t value); |
} // namespace crashpad |