fileobj/devobj: record path name (originally by Takagi-san)
This commit is contained in:
@ -136,6 +136,18 @@ int devobj_create(int fd, size_t len, off_t off, struct memobj **objp, int *maxp
|
||||
obj->memobj.flags = MF_HAS_PAGER | MF_DEV_FILE;
|
||||
obj->memobj.size = len;
|
||||
obj->handle = result.handle;
|
||||
|
||||
dkprintf("%s: path=%s\n", __FUNCTION__, result.path);
|
||||
if (result.path[0]) {
|
||||
obj->memobj.path = kmalloc(PATH_MAX, IHK_MC_AP_NOWAIT);
|
||||
if (!obj->memobj.path) {
|
||||
error = -ENOMEM;
|
||||
kprintf("%s: ERROR: Out of memory\n", __FUNCTION__);
|
||||
goto out;
|
||||
}
|
||||
strncpy(obj->memobj.path, result.path, PATH_MAX);
|
||||
}
|
||||
|
||||
obj->ref = 1;
|
||||
obj->pfn_pgoff = off / PAGE_SIZE;
|
||||
obj->npages = npages;
|
||||
@ -217,6 +229,11 @@ static void devobj_release(struct memobj *memobj)
|
||||
ihk_mc_free_pages(obj->pfn_table, pfn_npages);
|
||||
#endif /*POSTK_DEBUG_TEMP_FIX_36*/
|
||||
}
|
||||
|
||||
if (to_memobj(free_obj)->path) {
|
||||
kfree(to_memobj(free_obj)->path);
|
||||
}
|
||||
|
||||
kfree(free_obj);
|
||||
}
|
||||
|
||||
|
||||
@ -223,6 +223,18 @@ int fileobj_create(int fd, struct memobj **objp, int *maxprotp, uintptr_t virt_a
|
||||
newobj->memobj.ops = &fileobj_ops;
|
||||
newobj->memobj.flags = MF_HAS_PAGER | MF_REG_FILE;
|
||||
newobj->handle = result.handle;
|
||||
dkprintf("%s: path=%s\n", __FUNCTION__, result.path);
|
||||
|
||||
if (result.path[0]) {
|
||||
newobj->memobj.path = kmalloc(PATH_MAX, IHK_MC_AP_NOWAIT);
|
||||
if (!newobj->memobj.path) {
|
||||
error = -ENOMEM;
|
||||
kprintf("%s: error: allocating path\n", __FUNCTION__);
|
||||
goto out;
|
||||
}
|
||||
strncpy(newobj->memobj.path, result.path, PATH_MAX);
|
||||
}
|
||||
|
||||
newobj->sref = 1;
|
||||
newobj->cref = 1;
|
||||
fileobj_page_hash_init(newobj);
|
||||
@ -434,6 +446,10 @@ static void fileobj_release(struct memobj *memobj)
|
||||
kfree(to_memobj(free_obj)->pages);
|
||||
}
|
||||
|
||||
if (to_memobj(free_obj)->path) {
|
||||
kfree(to_memobj(free_obj)->path);
|
||||
}
|
||||
|
||||
obj_list_remove(free_obj);
|
||||
mcs_lock_unlock_noirq(&fileobj_list_lock, &node);
|
||||
kfree(free_obj);
|
||||
|
||||
@ -61,6 +61,7 @@ struct memobj {
|
||||
/* For pre-mapped memobjects */
|
||||
void **pages;
|
||||
int nr_pages;
|
||||
char *path;
|
||||
};
|
||||
|
||||
typedef void memobj_release_func_t(struct memobj *obj);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#define HEADER_PAGER_H
|
||||
|
||||
#include <ihk/types.h>
|
||||
#include <limits.h>
|
||||
|
||||
enum pager_op {
|
||||
PAGER_REQ_CREATE = 0x0001,
|
||||
@ -32,6 +33,7 @@ struct pager_create_result {
|
||||
int maxprot;
|
||||
uint32_t flags;
|
||||
size_t size;
|
||||
char path[PATH_MAX];
|
||||
};
|
||||
|
||||
/*
|
||||
@ -46,6 +48,7 @@ struct pager_map_result {
|
||||
uintptr_t handle;
|
||||
int maxprot;
|
||||
int8_t padding[4];
|
||||
char path[PATH_MAX];
|
||||
};
|
||||
|
||||
/* for pager_req_pfn() */
|
||||
|
||||
Reference in New Issue
Block a user