osdcap: whitespace to make grammar more readable

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-06-13 13:55:38 -07:00
parent 1cfd65b128
commit 762f6d9541
2 changed files with 9 additions and 7 deletions

View File

@ -147,8 +147,8 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap(), ascii::space_type>
// match := [pool <poolname> | uid <123>] [object_prefix <prefix>]
pool_name %= -(lit("pool") >> str);
object_prefix %= -(lit("object_prefix") >> str);
match = ( (lit("auid") >> int_ >> object_prefix)[_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
(pool_name >> object_prefix)[_val = phoenix::construct<OSDCapMatch>(_1, _2)]);
match = ( (lit("auid") >> int_ >> object_prefix) [_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
(pool_name >> object_prefix) [_val = phoenix::construct<OSDCapMatch>(_1, _2)]);
// rwxa := * | [r][w][x]
@ -161,15 +161,15 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap(), ascii::space_type>
// capspec := * | rwx | class <name> [classcap]
capspec =
rwxa[_val = phoenix::construct<OSDCapSpec>(_1)] |
( lit("class") >> ((str >> str)[_val = phoenix::construct<OSDCapSpec>(_1, _2)] |
str[_val = phoenix::construct<OSDCapSpec>(_1, string())] ));
rwxa [_val = phoenix::construct<OSDCapSpec>(_1)] |
( lit("class") >> ((str >> str) [_val = phoenix::construct<OSDCapSpec>(_1, _2)] |
str [_val = phoenix::construct<OSDCapSpec>(_1, string())] ));
// grant := allow match capspec
grant = lit("allow") >> ((match >> capspec)[_val = phoenix::construct<OSDCapGrant>(_1, _2)]);
grant = lit("allow") >> ((match >> capspec) [_val = phoenix::construct<OSDCapGrant>(_1, _2)]);
// osdcap := grant [grant ...]
osdcap %= (grant % (lit(';') | lit(',')))[_val = phoenix::construct<OSDCap>(_1)];
osdcap %= (grant % (lit(';') | lit(','))) [_val = phoenix::construct<OSDCap>(_1)];
}
qi::rule<Iterator, unsigned(), ascii::space_type> rwxa;
qi::rule<Iterator, string(), ascii::space_type> quoted_string;

View File

@ -58,8 +58,10 @@ ostream& operator<<(ostream& out, const OSDCapSpec& s);
struct OSDCapMatch {
// auid and pool_name are mutually exclusive
int64_t auid;
std::string pool_name;
std::string object_prefix;
OSDCapMatch() : auid(CEPH_AUTH_UID_DEFAULT) {}