From: Xiubo Li Date: Tue, 5 Jul 2022 03:47:16 +0000 (+0800) Subject: ceph_fs.h: switch to use its own encode/decode helpers X-Git-Tag: v16.2.14~138^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2f1fb9d14cdb6f4dbc508aae1277e4e11714ae11;p=ceph.git ceph_fs.h: switch to use its own encode/decode helpers Prepare switching num_retry and num_fwd to __le32. Fixes: https://tracker.ceph.com/issues/57854 Signed-off-by: Xiubo Li (cherry picked from commit 82d7d2094116b69f861728028de88d5736002126) --- diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 491931a8b278..eb10581b3eaa 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -14,6 +14,8 @@ #include "msgr.h" #include "rados.h" +#include "include/encoding.h" +#include "include/denc.h" /* * The data structures defined here are shared between Linux kernel and @@ -636,6 +638,38 @@ struct ceph_mds_request_head { union ceph_mds_request_args args; } __attribute__ ((packed)); +void inline encode(const struct ceph_mds_request_head& h, ceph::buffer::list& bl) { + using ceph::encode; + encode(h.version, bl); + encode(h.oldest_client_tid, bl); + encode(h.mdsmap_epoch, bl); + encode(h.flags, bl); + encode(h.num_retry, bl); + encode(h.num_fwd, bl); + encode(h.num_releases, bl); + encode(h.op, bl); + encode(h.caller_uid, bl); + encode(h.caller_gid, bl); + encode(h.ino, bl); + bl.append((char*)&h.args, sizeof(h.args)); +} + +void inline decode(struct ceph_mds_request_head& h, ceph::buffer::list::const_iterator& bl) { + using ceph::decode; + decode(h.version, bl); + decode(h.oldest_client_tid, bl); + decode(h.mdsmap_epoch, bl); + decode(h.flags, bl); + decode(h.num_retry, bl); + decode(h.num_fwd, bl); + decode(h.num_releases, bl); + decode(h.op, bl); + decode(h.caller_uid, bl); + decode(h.caller_gid, bl); + decode(h.ino, bl); + bl.copy(sizeof(h.args), (char*)&(h.args)); +} + /* cap/lease release record */ struct ceph_mds_request_release { __le64 ino, cap_id; /* ino and unique cap id */ diff --git a/src/include/types.h b/src/include/types.h index 60d1fb305a8e..c150262e9fac 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -320,7 +320,6 @@ WRITE_RAW_ENCODER(ceph_file_layout) WRITE_RAW_ENCODER(ceph_dir_layout) WRITE_RAW_ENCODER(ceph_mds_session_head) WRITE_RAW_ENCODER(ceph_mds_request_head_legacy) -WRITE_RAW_ENCODER(ceph_mds_request_head) WRITE_RAW_ENCODER(ceph_mds_request_release) WRITE_RAW_ENCODER(ceph_filelock) WRITE_RAW_ENCODER(ceph_mds_caps_head)