osd: convert OSDCaps constants away from #defines

Because constants the compiler understands are way better than
constants only the preprocessor understands.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: rename OSD_POOL_CAP_* to OSD_CAP_*

I thought about having different flags for pools and objects, but that
seemed messier for very little gain.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: const-ify OSDCaps.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: add a stub OSDCaps::get_object_cap function, and use it.

This will shortly allow us to do prefix-matching permissions on
object oids. See #2471.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: rename OSDCap's PoolsMap::apply_caps to apply_pool_caps

We're about to add an apply_object_caps function, and apply_caps
is too ambiguous.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: Add an ObjectCapMap to OSDCaps infrastructure.

Keep an ObjectCapMap* for each Pool, and fill it in upon use. Calculate
object caps by taking the pool caps and then applying the prefix-based
ObjectCapMaps allow and deny fields to that pool cap.
Parse object caps by letting people add "prefix foo bar baz" to the
standard pool caps lines.

Signed-off-by: Greg Farnum <greg@inktank.com>
doc: add deny and prefix options to ceph-authtool manpage

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: move init_op_flags and some checks into op_is_queuable

This moves some checks just a little bit later into the synchronous
op queuing code, but is safe. Nobody else looks at those contents
in the space that just got jumped over, and the safety checks (for
valid snapid, journal write sizes, and full maps) are still valid
to report here without anything else being able to trigger them.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: put init_op_flags and op_has_sufficient_caps together.

We're about to unify these functions.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: unify init_op_flags and op_has_sufficient_caps

Now we have fill_flags_and_check_perms(), which will allow
more capable permission checks without complicating the data structures
we use.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: add some skeleton permission-checking for class-based grants

Signed-off-by: Greg Farnum <greg@inktank.com>