Removed linux linked list dependency.

This commit is contained in:
Bahadir Balban
2009-06-02 13:19:17 +03:00
parent 4757f46f71
commit 276b4643c6
69 changed files with 455 additions and 885 deletions

View File

@@ -33,6 +33,6 @@ struct vfs_file_data {
struct vm_file *vfs_file_create(void);
extern struct list_head vm_file_list;
extern struct link vm_file_list;
#endif /* __MM0_FILE_H__ */

View File

@@ -3,7 +3,7 @@
struct global_list {
int total;
struct list_head list;
struct link list;
};
extern struct global_list global_vm_files;

View File

@@ -21,7 +21,7 @@ struct initdata {
struct page_bitmap page_map;
unsigned long pager_utcb_virt;
unsigned long pager_utcb_phys;
struct list_head boot_file_list;
struct link boot_file_list;
};
extern struct initdata initdata;

View File

@@ -25,7 +25,7 @@ struct shm_descriptor {
struct shm_descriptor {
int key; /* IPC key supplied by user task */
l4id_t shmid; /* SHM area id, allocated by mm0 */
struct list_head list; /* SHM list, used by mm0 */
struct link list; /* SHM list, used by mm0 */
struct vm_file *owner;
void *shm_addr; /* The virtual address for segment. */
unsigned long size; /* Size of the area in pages */

View File

@@ -51,18 +51,18 @@ struct task_fd_head {
};
struct task_vma_head {
struct list_head list;
struct link list;
int tcb_refs;
};
struct utcb_desc {
struct list_head list;
struct link list;
unsigned long utcb_base;
struct id_pool *slots;
};
struct utcb_head {
struct list_head list;
struct link list;
int tcb_refs;
};
@@ -70,11 +70,11 @@ struct utcb_head {
/* Stores all task information that can be kept in userspace. */
struct tcb {
/* Task list */
struct list_head list;
struct link list;
/* Fields for parent-child relations */
struct list_head child_ref; /* Child ref in parent's list */
struct list_head children; /* List of children */
struct link child_ref; /* Child ref in parent's list */
struct link children; /* List of children */
struct tcb *parent; /* Parent task */
/* Task creation flags */
@@ -131,7 +131,7 @@ struct tcb {
};
struct tcb_head {
struct list_head list;
struct link list;
int total; /* Total threads */
};

View File

@@ -57,7 +57,7 @@ enum VM_FILE_TYPE {
struct page {
int refcnt; /* Refcount */
struct spinlock lock; /* Page lock. */
struct list_head list; /* For list of a vm_object's in-memory pages */
struct link list; /* For list of a vm_object's in-memory pages */
struct vm_object *owner;/* The vm_object the page belongs to */
unsigned long virtual; /* If refs >1, first mapper's virtual address */
unsigned int flags; /* Flags associated with the page. */
@@ -115,20 +115,20 @@ struct vm_object {
int npages; /* Number of pages in memory */
int nlinks; /* Number of mapper links that refer */
int shadows; /* Number of shadows that refer */
struct list_head shref; /* Shadow reference from original object */
struct list_head shdw_list; /* List of vm objects that shadows this one */
struct list_head link_list; /* List of links that refer to this object */
struct link shref; /* Shadow reference from original object */
struct link shdw_list; /* List of vm objects that shadows this one */
struct link link_list; /* List of links that refer to this object */
struct vm_object *orig_obj; /* Original object that this one shadows */
unsigned int flags; /* Defines the type and flags of the object */
struct list_head list; /* List of all vm objects in memory */
struct link list; /* List of all vm objects in memory */
struct vm_pager *pager; /* The pager for this object */
struct list_head page_cache;/* List of in-memory pages */
struct link page_cache;/* List of in-memory pages */
};
/* In memory representation of either a vfs file, a device. */
struct vm_file {
int openers;
struct list_head list;
struct link list;
unsigned long length;
unsigned int type;
struct vm_object vm_obj;
@@ -138,22 +138,22 @@ struct vm_file {
/* To create per-vma vm_object lists */
struct vm_obj_link {
struct list_head list;
struct list_head linkref;
struct link list;
struct link linkref;
struct vm_object *obj;
};
static inline void vm_link_object(struct vm_obj_link *link, struct vm_object *obj)
{
link->obj = obj;
list_add(&link->linkref, &obj->link_list);
list_insert(&link->linkref, &obj->link_list);
obj->nlinks++;
}
static inline struct vm_object *vm_unlink_object(struct vm_obj_link *link)
{
/* Delete link from object's link list */
list_del(&link->linkref);
list_remove(&link->linkref);
/* Reduce object's mapper link count */
link->obj->nlinks--;
@@ -175,8 +175,8 @@ static inline struct vm_object *vm_unlink_object(struct vm_obj_link *link)
* object's copy of pages supersede the ones lower in the stack.
*/
struct vm_area {
struct list_head list; /* Per-task vma list */
struct list_head vm_obj_list; /* Head for vm_object list. */
struct link list; /* Per-task vma list */
struct link vm_obj_list; /* Head for vm_object list. */
unsigned long pfn_start; /* Region start virtual pfn */
unsigned long pfn_end; /* Region end virtual pfn, exclusive */
unsigned long flags; /* Protection flags. */
@@ -189,12 +189,12 @@ struct vm_area {
* rather than searching the address. E.g. munmap/msync
*/
static inline struct vm_area *find_vma(unsigned long addr,
struct list_head *vm_area_list)
struct link *vm_area_list)
{
struct vm_area *vma;
unsigned long pfn = __pfn(addr);
list_for_each_entry(vma, vm_area_list, list)
list_foreach_struct(vma, vm_area_list, list)
if ((pfn >= vma->pfn_start) && (pfn < vma->pfn_end))
return vma;
return 0;
@@ -213,12 +213,12 @@ extern struct vm_pager devzero_pager;
extern struct vm_pager swap_pager;
/* vm object and vm file lists */
extern struct list_head vm_object_list;
extern struct link vm_object_list;
/* vm object link related functions */
struct vm_obj_link *vm_objlink_create(void);
struct vm_obj_link *vma_next_link(struct list_head *link,
struct list_head *head);
struct vm_obj_link *vma_next_link(struct link *link,
struct link *head);
/* vm file and object initialisation */
struct vm_object *vm_object_create(void);
@@ -229,8 +229,8 @@ void vm_file_put(struct vm_file *f);
/* Printing objects, files */
void vm_object_print(struct vm_object *vmo);
void vm_print_objects(struct list_head *vmo_list);
void vm_print_files(struct list_head *file_list);
void vm_print_objects(struct link *vmo_list);
void vm_print_files(struct link *file_list);
/* Used for pre-faulting a page from mm0 */
int prefault_page(struct tcb *task, unsigned long address,
@@ -248,7 +248,7 @@ int validate_task_range(struct tcb *t, unsigned long start,
/* Changes all shadows and their ptes to read-only */
int vm_freeze_shadows(struct tcb *task);
int task_insert_vma(struct vm_area *vma, struct list_head *vma_list);
int task_insert_vma(struct vm_area *vma, struct link *vma_list);
/* Main page fault entry point */
int page_fault_handler(struct tcb *faulty_task, fault_kdata_t *fkdata);