From: Abhishek Lekshmanan Date: Fri, 3 May 2019 12:53:27 +0000 (+0200) Subject: rgw_common: introduce a decode_bl function to decode a bl to type X-Git-Tag: v15.1.0~2690^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5e56ea6f0778973cdbb90eaf643fba1240af3f8b;p=ceph.git rgw_common: introduce a decode_bl function to decode a bl to type Signed-off-by: Abhishek Lekshmanan --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 8ff03a554dc..fbd1b4dc726 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -2669,4 +2669,16 @@ static inline string rgw_bl_str(ceph::buffer::list& raw) return s; } +template +int decode_bl(bufferlist& bl, T& t) +{ + auto iter = bl.cbegin(); + try { + decode(t, iter); + } catch (buffer::error& err) { + return -EIO; + } + return 0; +} + #endif