}
#ifdef CONFIG_CHECKPOINT_RESTORE
-static inline struct msg_msg *fill_copy(unsigned long copy_nr,
- unsigned long msg_nr,
- struct msg_msg *msg,
- struct msg_msg *copy)
-{
- if (copy_nr == msg_nr)
- return copy_msg(msg, copy);
- return NULL;
-}
-
static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz,
int msgflg, long *msgtyp,
unsigned long *copy_number)
free_msg(copy);
}
#else
-#define fill_copy(copy_nr, msg_nr, msg, copy) NULL
-
static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz,
int msgflg, long *msgtyp,
unsigned long *copy_number)
walk_msg->m_type != 1) {
msgtyp = walk_msg->m_type - 1;
} else if (msgflg & MSG_COPY) {
- msg = fill_copy(copy_number,
- msg_counter,
- walk_msg, copy);
- if (msg)
+ if (copy_number == msg_counter) {
+ /*
+ * Found requested message.
+ * Copy it.
+ */
+ msg = copy_msg(msg, copy);
+ if (IS_ERR(msg))
+ goto out_unlock;
break;
+ }
} else
break;
msg_counter++;
return dst;
}
+#else
+struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
+{
+ return ERR_PTR(-ENOSYS);
+}
#endif
int store_msg(void __user *dest, struct msg_msg *msg, int len)
{