From: Jeff Layton Date: Fri, 2 Sep 2016 12:36:59 +0000 (-0400) Subject: SQUASH: mds/client: add routines to copy to/from ceph_mds_request_head_legacy X-Git-Tag: v11.0.1~326^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7c59b9e96a37ecf8130efec29ec6443d7793473a;p=ceph.git SQUASH: mds/client: add routines to copy to/from ceph_mds_request_head_legacy Signed-off-by: Jeff Layton --- diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 73701a6ba6d9d..946a10d4ba526 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -559,6 +559,20 @@ struct ceph_mds_request_release { __le32 dname_len; /* string follows. */ } __attribute__ ((packed)); +static inline void +copy_from_legacy_head(struct ceph_mds_request_head *head, + struct ceph_mds_request_head_legacy *legacy) +{ + memcpy(&(head->oldest_client_tid), legacy, sizeof(*legacy)); +} + +static inline void +copy_to_legacy_head(struct ceph_mds_request_head_legacy *legacy, + struct ceph_mds_request_head *head) +{ + memcpy(legacy, &(head->oldest_client_tid), sizeof(*legacy)); +} + /* client reply */ struct ceph_mds_reply_head { __le32 op; diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index 00419ebb5aca4..543761ec473d0 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -168,7 +168,7 @@ public: struct ceph_mds_request_head_legacy old_mds_head; ::decode(old_mds_head, p); - memcpy(&head.oldest_client_tid, &old_mds_head, sizeof(old_mds_head)); + copy_from_legacy_head(&head, &old_mds_head); head.version = 0; /* Can't set the btime from legacy struct */ @@ -198,7 +198,7 @@ public: } else { struct ceph_mds_request_head_legacy old_mds_head; - memcpy(&old_mds_head, &(head.oldest_client_tid), sizeof(old_mds_head)); + copy_to_legacy_head(&old_mds_head, &head); ::encode(old_mds_head, payload); }