summaryrefslogtreecommitdiff
path: root/include/linux/memory-failure.h
blob: d333dcdbeae707c7aad467174d3bf647748c5546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_MEMORY_FAILURE_H
#define _LINUX_MEMORY_FAILURE_H

#include <linux/interval_tree.h>

struct pfn_address_space {
	struct interval_tree_node node;
	struct address_space *mapping;
	int (*pfn_to_vma_pgoff)(struct vm_area_struct *vma,
				unsigned long pfn, pgoff_t *pgoff);
};

#ifdef CONFIG_MEMORY_FAILURE
int register_pfn_address_space(struct pfn_address_space *pfn_space);
void unregister_pfn_address_space(struct pfn_address_space *pfn_space);
#else
static inline int register_pfn_address_space(struct pfn_address_space *pfn_space)
{
	return -EOPNOTSUPP;
}

static inline void unregister_pfn_address_space(struct pfn_address_space *pfn_space)
{
}
#endif /* CONFIG_MEMORY_FAILURE */

#endif /* _LINUX_MEMORY_FAILURE_H */