mirror of
https://github.com/drasko/codezero.git
synced 2026-02-03 13:43:14 +01:00
Revised task initialisation, revising mmap yet.
This commit is contained in:
@@ -15,6 +15,15 @@ LIST_HEAD(vm_object_list);
|
||||
/* Global list of in-memory vm files */
|
||||
LIST_HEAD(vm_file_list);
|
||||
|
||||
struct vm_object *vm_object_init(struct vm_object *obj)
|
||||
{
|
||||
INIT_LIST_HEAD(&obj->list);
|
||||
INIT_LIST_HEAD(&obj->page_cache);
|
||||
INIT_LIST_HEAD(&obj->shadows);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* Allocate and initialise a vmfile, and return it */
|
||||
struct vm_object *vm_object_alloc_init(void)
|
||||
{
|
||||
@@ -23,10 +32,19 @@ struct vm_object *vm_object_alloc_init(void)
|
||||
if (!(obj = kzalloc(sizeof(*obj))))
|
||||
return PTR_ERR(-ENOMEM);
|
||||
|
||||
INIT_LIST_HEAD(&obj->list);
|
||||
INIT_LIST_HEAD(&obj->page_cache);
|
||||
INIT_LIST_HEAD(&obj->shadows);
|
||||
|
||||
return obj;
|
||||
return vm_object_init(obj);
|
||||
}
|
||||
|
||||
struct vm_file *vm_file_alloc_init(void)
|
||||
{
|
||||
struct vm_file *f;
|
||||
|
||||
if (!(f = kzalloc(sizeof(*f))))
|
||||
return PTR_ERR(-ENOMEM);
|
||||
|
||||
INIT_LIST_HEAD(&f->file_list);
|
||||
vm_object_init(&f->vm_obj);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user