Commit bb82cbb9 authored by Alexandre Julliard's avatar Alexandre Julliard

Convert the shared mapping list to a standard list.

parent 22fd30c0
...@@ -45,8 +45,7 @@ struct mapping ...@@ -45,8 +45,7 @@ struct mapping
void *base; /* default base addr (for PE image mapping) */ void *base; /* default base addr (for PE image mapping) */
struct file *shared_file; /* temp file for shared PE mapping */ struct file *shared_file; /* temp file for shared PE mapping */
int shared_size; /* shared mapping total size */ int shared_size; /* shared mapping total size */
struct mapping *shared_next; /* next in shared PE mapping list */ struct list shared_entry; /* entry in global shared PE mappings list */
struct mapping *shared_prev; /* prev in shared PE mapping list */
}; };
static void mapping_dump( struct object *obj, int verbose ); static void mapping_dump( struct object *obj, int verbose );
...@@ -67,7 +66,7 @@ static const struct object_ops mapping_ops = ...@@ -67,7 +66,7 @@ static const struct object_ops mapping_ops =
mapping_destroy /* destroy */ mapping_destroy /* destroy */
}; };
static struct mapping *shared_first; static struct list shared_list = LIST_INIT(shared_list);
#ifdef __i386__ #ifdef __i386__
...@@ -111,7 +110,7 @@ static struct file *get_shared_file( struct mapping *mapping ) ...@@ -111,7 +110,7 @@ static struct file *get_shared_file( struct mapping *mapping )
{ {
struct mapping *ptr; struct mapping *ptr;
for (ptr = shared_first; ptr; ptr = ptr->shared_next) LIST_FOR_EACH_ENTRY( ptr, &shared_list, struct mapping, shared_entry )
if (is_same_file( ptr->file, mapping->file )) if (is_same_file( ptr->file, mapping->file ))
return (struct file *)grab_object( ptr->shared_file ); return (struct file *)grab_object( ptr->shared_file );
return NULL; return NULL;
...@@ -223,12 +222,7 @@ static int get_image_params( struct mapping *mapping ) ...@@ -223,12 +222,7 @@ static int get_image_params( struct mapping *mapping )
if (!build_shared_mapping( mapping, unix_fd, sec, nt.FileHeader.NumberOfSections )) goto error; if (!build_shared_mapping( mapping, unix_fd, sec, nt.FileHeader.NumberOfSections )) goto error;
if (mapping->shared_file) /* link it in the list */ if (mapping->shared_file) list_add_head( &shared_list, &mapping->shared_entry );
{
if ((mapping->shared_next = shared_first)) shared_first->shared_prev = mapping;
mapping->shared_prev = NULL;
shared_first = mapping;
}
mapping->size = ROUND_SIZE( nt.OptionalHeader.SizeOfImage ); mapping->size = ROUND_SIZE( nt.OptionalHeader.SizeOfImage );
mapping->base = (void *)nt.OptionalHeader.ImageBase; mapping->base = (void *)nt.OptionalHeader.ImageBase;
...@@ -351,9 +345,7 @@ static void mapping_destroy( struct object *obj ) ...@@ -351,9 +345,7 @@ static void mapping_destroy( struct object *obj )
if (mapping->shared_file) if (mapping->shared_file)
{ {
release_object( mapping->shared_file ); release_object( mapping->shared_file );
if (mapping->shared_next) mapping->shared_next->shared_prev = mapping->shared_prev; list_remove( &mapping->shared_entry );
if (mapping->shared_prev) mapping->shared_prev->shared_next = mapping->shared_next;
else shared_first = mapping->shared_next;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment