/** Import a faf file descriptor from the given ghost.
 *  @author Renaud Lottiaux
 *
 *  @param ghost          The ghost to read data from.
 *  @param task           The task data are imported for.
 *  @param returned_file  The file struct where data should be imported to.
 *
 *  @return   0 if everything ok.
 *            Negative value otherwise.
 */
int faf_file_import (struct epm_action *action,
		     ghost_t *ghost,
		     struct task_struct *task,
		     struct file **returned_file)
{
	void *desc;
	struct file *file;
	int r, desc_size;

	BUG_ON(action->type == EPM_RESTART);

	r = ghost_read_file_krg_desc(ghost, &desc, &desc_size);
	if (r)
		goto exit;

	file = create_faf_file_from_krg_desc (task, desc);

	if (IS_ERR(file)) {
		r = PTR_ERR(file);
		goto exit_free_desc;
	}
	*returned_file = file;

exit_free_desc:
	kfree(desc);
exit:
	return r;
}
Exemple #2
0
/** Import a regular file descriptor from the given ghost.
 *  @author Renaud Lottiaux
 *
 *  @param ghost          The ghost to read data from.
 *  @param task           The task data are imported for.
 *  @param returned_file  The file struct where data should be imported to.
 *
 *  @return   0 if everything ok.
 *            Negative value otherwise.
 */
int regular_file_import(struct epm_action *action,
			ghost_t *ghost,
			struct task_struct *task,
			struct file **returned_file)
{
	struct regular_file_krg_desc *desc;
	int desc_size, r = 0;

	BUG_ON(action->type == EPM_CHECKPOINT);

	r = ghost_read_file_krg_desc(ghost, (void **)(&desc), &desc_size);
	if (r)
		goto exit;

	r = __regular_file_import_from_desc(action, desc, task, returned_file);

	kfree (desc);
exit:
	return r;
}