Messages in this thread | | | Date | Mon, 09 Apr 2012 23:47:43 +0400 | From | Pavel Emelyanov <> | Subject | Re: [CRIU] [PATCH 2/4] ipc: move all checkpoint-restore code under appropriate define |
| |
On 04/09/2012 09:54 PM, Stanislav Kinsbursky wrote: > All new checkpoint/restore code parts are now covered with > CONFIG_CHECKPOINT_RESTORE marco. So it would be easy to remove them, in case > the whole project fails. > > --- > ipc/compat.c | 9 ++++++--- > ipc/msg.c | 15 ++++++++++++++- > 2 files changed, 20 insertions(+), 4 deletions(-) > > @@ -387,8 +388,10 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third, > msgtyp = ipck.msgtyp; > } > return do_msgrcv(first, uptr, second, msgtyp, third, > - (third & MSG_PEEK_ALL) ? compat_do_msg_peek_all > - : compat_do_msg_fill); > +#ifdef CONFIG_CHECKPOINT_RESTORE > + (third & MSG_PEEK_ALL) ? compat_do_msg_peek_all : > +#endif > + compat_do_msg_fill);
These ifdefs in the middle of the code look not very elegant. Is there a way to replace the checks they surround with static inline function (reporting 0 when CHECKPOINT_RESTORE is off) potentially letting the compiler optimize out the code sitting under if (0) ?
> } > > static inline int get_compat_msqid64(struct msqid64_ds *m64, > diff --git a/ipc/msg.c b/ipc/msg.c > index 017bf0b..8d63cc7 100644
| |