]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDCap: fix output operators for caps
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 27 Sep 2012 21:41:24 +0000 (14:41 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 27 Sep 2012 22:36:48 +0000 (15:36 -0700)
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>
src/osd/OSDCap.cc

index dbb1a97bcdc456ca60e003f288390bbded18f829..f2ee2efc7e651bc5af8fb4fd9dc00e39ddad8d64 100644 (file)
@@ -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)