[PATCH] x86/sgx: sgx_alloc_page() to sgx_grab_page()
From: Jarkko Sakkinen
Date: Wed May 27 2020 - 21:21:08 EST
$ git grep -l sgx_alloc_page | xargs sed -i 's/sgx_alloc_page/sgx_grab_page/g'
$ git grep -l sgx_try_alloc_page | xargs sed -i 's/sgx_try_alloc_page/sgx_try_grab_page/g'
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/sgx/encl.c | 6 +++---
arch/x86/kernel/cpu/sgx/ioctl.c | 4 ++--
arch/x86/kernel/cpu/sgx/main.c | 14 +++++++-------
arch/x86/kernel/cpu/sgx/sgx.h | 4 ++--
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index c070aa90b5fe..fab2a8aec410 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -67,7 +67,7 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page,
struct sgx_epc_page *epc_page;
int ret;
- epc_page = sgx_alloc_page(encl_page, false);
+ epc_page = sgx_grab_page(encl_page, false);
if (IS_ERR(epc_page))
return epc_page;
@@ -686,7 +686,7 @@ struct sgx_encl_page *sgx_encl_reserve_page(struct sgx_encl *encl,
}
/**
- * sgx_alloc_page - allocate a VA page
+ * sgx_grab_page - allocate a VA page
*
* Allocates an &sgx_epc_page instance and converts it to a VA page.
*
@@ -699,7 +699,7 @@ struct sgx_epc_page *sgx_alloc_va_page(void)
struct sgx_epc_page *epc_page;
int ret;
- epc_page = sgx_alloc_page(NULL, true);
+ epc_page = sgx_grab_page(NULL, true);
if (IS_ERR(epc_page))
return ERR_CAST(epc_page);
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 81b6c5d64c96..c880dc40310c 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -183,7 +183,7 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs)
encl->backing = backing;
- secs_epc = sgx_alloc_page(&encl->secs, true);
+ secs_epc = sgx_grab_page(&encl->secs, true);
if (IS_ERR(secs_epc)) {
ret = PTR_ERR(secs_epc);
goto err_out_backing;
@@ -376,7 +376,7 @@ static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long src,
if (IS_ERR(encl_page))
return PTR_ERR(encl_page);
- epc_page = sgx_alloc_page(encl_page, true);
+ epc_page = sgx_grab_page(encl_page, true);
if (IS_ERR(epc_page)) {
kfree(encl_page);
return PTR_ERR(epc_page);
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index 5ce77e554676..b5cd941861bc 100644
--- a/arch/x86/kernel/cpu/sgx/main.c
+++ b/arch/x86/kernel/cpu/sgx/main.c
@@ -14,7 +14,7 @@
struct sgx_epc_section sgx_epc_sections[SGX_MAX_EPC_SECTIONS];
int sgx_nr_epc_sections;
-static struct sgx_epc_page *__sgx_try_alloc_page(struct sgx_epc_section *section)
+static struct sgx_epc_page *__sgx_try_grab_page(struct sgx_epc_section *section)
{
struct sgx_epc_page *page;
@@ -29,7 +29,7 @@ static struct sgx_epc_page *__sgx_try_alloc_page(struct sgx_epc_section *section
}
/**
- * sgx_try_alloc_page() - Allocate an EPC page
+ * sgx_try_grab_page() - Allocate an EPC page
*
* Try to grab a page from the free EPC page list.
*
@@ -37,7 +37,7 @@ static struct sgx_epc_page *__sgx_try_alloc_page(struct sgx_epc_section *section
* a pointer to a &struct sgx_epc_page instance,
* -errno on error
*/
-struct sgx_epc_page *sgx_try_alloc_page(void)
+struct sgx_epc_page *sgx_try_grab_page(void)
{
struct sgx_epc_section *section;
struct sgx_epc_page *page;
@@ -46,7 +46,7 @@ struct sgx_epc_page *sgx_try_alloc_page(void)
for (i = 0; i < sgx_nr_epc_sections; i++) {
section = &sgx_epc_sections[i];
spin_lock(§ion->lock);
- page = __sgx_try_alloc_page(section);
+ page = __sgx_try_grab_page(section);
spin_unlock(§ion->lock);
if (page)
@@ -57,7 +57,7 @@ struct sgx_epc_page *sgx_try_alloc_page(void)
}
/**
- * sgx_alloc_page() - Allocate an EPC page
+ * sgx_grab_page() - Allocate an EPC page
* @owner: the owner of the EPC page
* @reclaim: reclaim pages if necessary
*
@@ -69,12 +69,12 @@ struct sgx_epc_page *sgx_try_alloc_page(void)
* a pointer to a &struct sgx_epc_page instance,
* -errno on error
*/
-struct sgx_epc_page *sgx_alloc_page(void *owner, bool reclaim)
+struct sgx_epc_page *sgx_grab_page(void *owner, bool reclaim)
{
struct sgx_epc_page *entry;
for ( ; ; ) {
- entry = sgx_try_alloc_page();
+ entry = sgx_try_grab_page();
if (!IS_ERR(entry)) {
entry->owner = owner;
break;
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 0c481e6f2c95..84198c17e766 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -101,8 +101,8 @@ void sgx_mark_page_reclaimable(struct sgx_epc_page *page);
int sgx_unmark_page_reclaimable(struct sgx_epc_page *page);
void sgx_reclaim_pages(void);
-struct sgx_epc_page *sgx_try_alloc_page(void);
-struct sgx_epc_page *sgx_alloc_page(void *owner, bool reclaim);
+struct sgx_epc_page *sgx_try_grab_page(void);
+struct sgx_epc_page *sgx_grab_page(void *owner, bool reclaim);
void sgx_free_page(struct sgx_epc_page *page);
#endif /* _X86_SGX_H */
--
2.25.1
--PEIAKu/WMn1b1Hv9--