pager: minor cleanups

- remove unused MF_END (that only makes sense for enums without holes,
  this one is a set of bits masks)
- remove useless goto in pager_req_create()
- init maxprot to 0 from the start, it's not used in the error cases
  (except for debug print)

Change-Id: Ic56c0754824b99f8a7e45fa8e99b8fe3e7c7e592
This commit is contained in:
Dominique Martinet
2018-09-13 09:48:52 +09:00
committed by Masamichi Takagi
parent b1681f4a3a
commit 13e71ac9dc
2 changed files with 1 additions and 10 deletions

View File

@ -1165,7 +1165,6 @@ enum {
MF_XPMEM = 0x10000, /* To identify XPMEM attachment pages for rusage accounting */
MF_ZEROOBJ = 0x20000, /* To identify pages of anonymous, on-demand paging ranges for rusage accounting */
MF_SHM = 0x40000,
MF_END
};
static int pager_get_path(struct file *file, char *path) {
@ -1200,7 +1199,7 @@ static int pager_req_create(ihk_os_t os, int fd, uintptr_t result_pa)
ihk_device_t dev = ihk_os_to_dev(os);
int error;
struct pager_create_result *resp;
int maxprot = -1;
int maxprot = 0;
struct file *file = NULL;
struct inode *inode;
struct pager *pager = NULL;
@ -1240,7 +1239,6 @@ static int pager_req_create(ihk_os_t os, int fd, uintptr_t result_pa)
goto out;
}
maxprot = 0;
if ((file->f_mode & FMODE_READ) && (file->f_mode & FMODE_PREAD)) {
maxprot |= PROT_READ;
}
@ -1340,13 +1338,7 @@ found:
resp->size = st.size;
error = pager_get_path(file, resp->path);
if (error) {
goto out_unmap;
}
error = 0;
out_unmap:
ihk_device_unmap_virtual(dev, resp, sizeof(*resp));
ihk_device_unmap_memory(dev, phys, sizeof(*resp));

View File

@ -44,7 +44,6 @@ enum {
MF_XPMEM = 0x10000, /* To identify XPMEM attachment pages for rusage accounting */
MF_ZEROOBJ = 0x20000, /* To identify pages of anonymous, on-demand paging ranges for rusage accounting */
MF_SHM = 0x40000,
MF_END
};
#define MEMOBJ_READY 0