summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2012-09-27 14:41:24 -0700
committerJosh Durgin <josh.durgin@inktank.com>2012-09-27 15:36:48 -0700
commite903ca7add3053c5417294d32369fbaf18ae8840 (patch)
tree32cc6d8e7fd3be749cbcc2e27df5c1ee053dfd8a
parent1d747d1eb9c8538e306e5c4c9ee638b62e266498 (diff)
downloadceph-e903ca7add3053c5417294d32369fbaf18ae8840.tar.gz
OSDCap: fix output operators for caps
OSD_CAP_ANY is not a flag, but a value (0xff) that will always be true when treated as a mask with a non-zero rwxa_t. Don't duplicate the rwxa_t output operator in the OSDCapSpec output operator, just use it. Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--src/osd/OSDCap.cc17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc
index dbb1a97bcdc..f2ee2efc7e6 100644
--- a/src/osd/OSDCap.cc
+++ b/src/osd/OSDCap.cc
@@ -26,7 +26,7 @@ using std::vector;
ostream& operator<<(ostream& out, rwxa_t p)
{
- if (p & OSD_CAP_ANY)
+ if (p == OSD_CAP_ANY)
return out << "*";
if (p & OSD_CAP_R)
@@ -40,20 +40,11 @@ ostream& operator<<(ostream& out, rwxa_t p)
ostream& operator<<(ostream& out, const OSDCapSpec& s)
{
- if (s.allow & OSD_CAP_ANY)
- return out << "*";
- if (s.allow) {
- if (s.allow & OSD_CAP_R)
- out << 'r';
- if (s.allow & OSD_CAP_W)
- out << 'w';
- if (s.allow & OSD_CAP_X)
- out << 'x';
- return out;
- }
+ if (s.allow)
+ return out << s.allow;
if (s.class_name.length())
return out << "class '" << s.class_name << "' '" << s.class_allow << "'";
- return out << s.allow;
+ return out;
}
ostream& operator<<(ostream& out, const OSDCapMatch& m)