mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
s390/set_memory: generate all set_memory() functions
The set_memory() functions all follow the same pattern. Use a macro to generate them, and in result remove a bit of code. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
a6e49f10f4
commit
c22a4c8aaf
1 changed files with 12 additions and 32 deletions
|
@ -26,41 +26,21 @@ enum {
|
||||||
|
|
||||||
int __set_memory(unsigned long addr, int numpages, unsigned long flags);
|
int __set_memory(unsigned long addr, int numpages, unsigned long flags);
|
||||||
|
|
||||||
static inline int set_memory_ro(unsigned long addr, int numpages)
|
|
||||||
{
|
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_RO);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int set_memory_rw(unsigned long addr, int numpages)
|
|
||||||
{
|
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_RW);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int set_memory_nx(unsigned long addr, int numpages)
|
|
||||||
{
|
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_NX);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int set_memory_x(unsigned long addr, int numpages)
|
|
||||||
{
|
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_X);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define set_memory_rox set_memory_rox
|
#define set_memory_rox set_memory_rox
|
||||||
static inline int set_memory_rox(unsigned long addr, int numpages)
|
|
||||||
{
|
#define __SET_MEMORY_FUNC(fname, flags) \
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_RO | SET_MEMORY_X);
|
static inline int fname(unsigned long addr, int numpages) \
|
||||||
|
{ \
|
||||||
|
return __set_memory(addr, numpages, (flags)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int set_memory_rwnx(unsigned long addr, int numpages)
|
__SET_MEMORY_FUNC(set_memory_ro, SET_MEMORY_RO)
|
||||||
{
|
__SET_MEMORY_FUNC(set_memory_rw, SET_MEMORY_RW)
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_RW | SET_MEMORY_NX);
|
__SET_MEMORY_FUNC(set_memory_nx, SET_MEMORY_NX)
|
||||||
}
|
__SET_MEMORY_FUNC(set_memory_x, SET_MEMORY_X)
|
||||||
|
__SET_MEMORY_FUNC(set_memory_rox, SET_MEMORY_RO | SET_MEMORY_X)
|
||||||
static inline int set_memory_4k(unsigned long addr, int numpages)
|
__SET_MEMORY_FUNC(set_memory_rwnx, SET_MEMORY_RW | SET_MEMORY_NX)
|
||||||
{
|
__SET_MEMORY_FUNC(set_memory_4k, SET_MEMORY_4K)
|
||||||
return __set_memory(addr, numpages, SET_MEMORY_4K);
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_direct_map_invalid_noflush(struct page *page);
|
int set_direct_map_invalid_noflush(struct page *page);
|
||||||
int set_direct_map_default_noflush(struct page *page);
|
int set_direct_map_default_noflush(struct page *page);
|
||||||
|
|
Loading…
Reference in a new issue