Skip to content

Commit

Permalink
SQUASH: mds/client: add routines to copy to/from ceph_mds_request_hea…
Browse files Browse the repository at this point in the history
…d_legacy

Signed-off-by: Jeff Layton <jlayton@redhat.com>
  • Loading branch information
jtlayton committed Sep 2, 2016
1 parent 821e77c commit 7c59b9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/include/ceph_fs.h
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/messages/MClientRequest.h
Expand Up @@ -168,7 +168,7 @@ class MClientRequest : public Message {
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 */
Expand Down Expand Up @@ -198,7 +198,7 @@ class MClientRequest : public Message {
} 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);
}

Expand Down

0 comments on commit 7c59b9e

Please sign in to comment.