From: Josh Durgin Date: Thu, 27 Sep 2012 21:41:24 +0000 (-0700) Subject: OSDCap: fix output operators for caps X-Git-Tag: v0.53~14^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e903ca7add3053c5417294d32369fbaf18ae8840;p=ceph.git 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 --- 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)