From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH 1/2] c/r: Add CR_COPY() macro Date: Tue, 24 Feb 2009 13:20:54 -0600 Message-ID: <20090224192054.GA24007@us.ibm.com> References: <1235500639-9597-1-git-send-email-danms@us.ibm.com> <1235500639-9597-2-git-send-email-danms@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1235500639-9597-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Dan Smith Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org List-Id: containers.vger.kernel.org Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org): > As suggested by Dave, this provides us a way to make the copy-in and > copy-out processes symmetric. I also added CR_COPY_BIT() to use with > the s390 bitfields, since we can't memcpy() those. > > Signed-off-by: Dan Smith > --- > include/linux/checkpoint.h | 20 ++++++++++++++++++++ > 1 files changed, 20 insertions(+), 0 deletions(-) > > diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h > index 217cf6e..b94422a 100644 > --- a/include/linux/checkpoint.h > +++ b/include/linux/checkpoint.h > @@ -149,4 +149,24 @@ static inline void process_deny_checkpointing(struct task_struct *task) {} > > #endif > > +#define CR_CPT 1 > +#define CR_RST 2 > + > +#define CR_COPY(op, a, b) \ > + do { \ > + WARN_ON(sizeof(a) != sizeof(b)); \ Can this be a BUILD_BUG_ON()? > + if (op == CR_CPT) \ > + memcpy(&a, &b, sizeof(a)); \ > + else \ > + memcpy(&b, &a, sizeof(a)); \ > + } while (0); > + > +#define CR_COPY_BIT(op, a, b) \ > + do { \ maybe add a BUILD_BUG_ON(typeof(a)!=typeof(b)); ? > + if (op == CR_CPT) \ > + a = b; \ > + else \ > + b = a; \ > + } while (0); > + > #endif /* _CHECKPOINT_CKPT_H_ */ > -- > 1.6.1 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linux-foundation.org/mailman/listinfo/containers