server: Introduce kernel_object struct for generic association between server and kernel objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f48ea29726
commit
b2a546c92d
|
@ -79,6 +79,7 @@ static const struct object_ops async_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
async_destroy /* destroy */
|
async_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -467,6 +468,7 @@ static const struct object_ops iosb_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
iosb_destroy /* destroy */
|
iosb_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,6 +90,7 @@ static const struct object_ops atom_table_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
atom_table_destroy /* destroy */
|
atom_table_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,6 +172,7 @@ static const struct object_ops dir_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
dir_close_handle, /* close_handle */
|
dir_close_handle, /* close_handle */
|
||||||
dir_destroy /* destroy */
|
dir_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,6 +87,7 @@ static const struct object_ops clipboard_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
clipboard_destroy /* destroy */
|
clipboard_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,6 +75,7 @@ static const struct object_ops completion_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
completion_destroy /* destroy */
|
completion_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,6 +87,7 @@ static const struct object_ops console_input_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
console_input_destroy /* destroy */
|
console_input_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -121,6 +122,7 @@ static const struct object_ops console_input_events_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
console_input_events_destroy /* destroy */
|
console_input_events_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -177,6 +179,7 @@ static const struct object_ops screen_buffer_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
screen_buffer_destroy /* destroy */
|
screen_buffer_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,6 +84,7 @@ static const struct object_ops debug_event_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
debug_event_destroy /* destroy */
|
debug_event_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -110,6 +111,7 @@ static const struct object_ops debug_ctx_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
debug_ctx_destroy /* destroy */
|
debug_ctx_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "wine/port.h"
|
#include "wine/port.h"
|
||||||
|
#include "wine/rbtree.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -75,6 +76,7 @@ static const struct object_ops irp_call_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
irp_call_destroy /* destroy */
|
irp_call_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -87,6 +89,7 @@ struct device_manager
|
||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
struct list devices; /* list of devices */
|
struct list devices; /* list of devices */
|
||||||
struct list requests; /* list of pending irps across all devices */
|
struct list requests; /* list of pending irps across all devices */
|
||||||
|
struct wine_rb_tree kernel_objects; /* map of objects that have client side pointer associated */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void device_manager_dump( struct object *obj, int verbose );
|
static void device_manager_dump( struct object *obj, int verbose );
|
||||||
|
@ -111,6 +114,7 @@ static const struct object_ops device_manager_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
device_manager_destroy /* destroy */
|
device_manager_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -152,6 +156,7 @@ static const struct object_ops device_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
device_open_file, /* open_file */
|
device_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
device_destroy /* destroy */
|
device_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -197,6 +202,7 @@ static const struct object_ops device_file_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
device_file_close_handle, /* close_handle */
|
device_file_close_handle, /* close_handle */
|
||||||
device_file_destroy /* destroy */
|
device_file_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -217,6 +223,26 @@ static const struct fd_ops device_file_fd_ops =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct list *no_kernel_obj_list( struct object *obj )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct kernel_object
|
||||||
|
{
|
||||||
|
struct device_manager *manager;
|
||||||
|
client_ptr_t user_ptr;
|
||||||
|
struct object *object;
|
||||||
|
struct list list_entry;
|
||||||
|
struct wine_rb_entry rb_entry;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int compare_kernel_object( const void *k, const struct wine_rb_entry *entry )
|
||||||
|
{
|
||||||
|
struct kernel_object *ptr = WINE_RB_ENTRY_VALUE( entry, struct kernel_object, rb_entry );
|
||||||
|
return memcmp( k, &ptr->user_ptr, sizeof(client_ptr_t) );
|
||||||
|
}
|
||||||
|
|
||||||
static void irp_call_dump( struct object *obj, int verbose )
|
static void irp_call_dump( struct object *obj, int verbose )
|
||||||
{
|
{
|
||||||
struct irp_call *irp = (struct irp_call *)obj;
|
struct irp_call *irp = (struct irp_call *)obj;
|
||||||
|
@ -608,8 +634,17 @@ static int device_manager_signaled( struct object *obj, struct wait_queue_entry
|
||||||
static void device_manager_destroy( struct object *obj )
|
static void device_manager_destroy( struct object *obj )
|
||||||
{
|
{
|
||||||
struct device_manager *manager = (struct device_manager *)obj;
|
struct device_manager *manager = (struct device_manager *)obj;
|
||||||
|
struct kernel_object *kernel_object;
|
||||||
struct list *ptr;
|
struct list *ptr;
|
||||||
|
|
||||||
|
while (manager->kernel_objects.root)
|
||||||
|
{
|
||||||
|
kernel_object = WINE_RB_ENTRY_VALUE( manager->kernel_objects.root, struct kernel_object, rb_entry );
|
||||||
|
wine_rb_remove( &manager->kernel_objects, &kernel_object->rb_entry );
|
||||||
|
list_remove( &kernel_object->list_entry );
|
||||||
|
free( kernel_object );
|
||||||
|
}
|
||||||
|
|
||||||
while ((ptr = list_head( &manager->devices )))
|
while ((ptr = list_head( &manager->devices )))
|
||||||
{
|
{
|
||||||
struct device *device = LIST_ENTRY( ptr, struct device, entry );
|
struct device *device = LIST_ENTRY( ptr, struct device, entry );
|
||||||
|
@ -625,10 +660,26 @@ static struct device_manager *create_device_manager(void)
|
||||||
{
|
{
|
||||||
list_init( &manager->devices );
|
list_init( &manager->devices );
|
||||||
list_init( &manager->requests );
|
list_init( &manager->requests );
|
||||||
|
wine_rb_init( &manager->kernel_objects, compare_kernel_object );
|
||||||
}
|
}
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_kernel_objects( struct object *obj )
|
||||||
|
{
|
||||||
|
struct list *ptr, *list;
|
||||||
|
|
||||||
|
if (!(list = obj->ops->get_kernel_obj_list( obj ))) return;
|
||||||
|
|
||||||
|
while ((ptr = list_head( list )))
|
||||||
|
{
|
||||||
|
struct kernel_object *kernel_object = LIST_ENTRY( ptr, struct kernel_object, list_entry );
|
||||||
|
list_remove( &kernel_object->list_entry );
|
||||||
|
wine_rb_remove( &kernel_object->manager->kernel_objects, &kernel_object->rb_entry );
|
||||||
|
free( kernel_object );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create a device manager */
|
/* create a device manager */
|
||||||
DECL_HANDLER(create_device_manager)
|
DECL_HANDLER(create_device_manager)
|
||||||
|
|
|
@ -67,6 +67,7 @@ static const struct object_ops object_type_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
no_destroy /* destroy */
|
no_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -102,6 +103,7 @@ static const struct object_ops directory_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
directory_destroy /* destroy */
|
directory_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,6 +68,7 @@ static const struct object_ops event_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
no_destroy /* destroy */
|
no_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -101,6 +102,7 @@ static const struct object_ops keyed_event_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
no_destroy /* destroy */
|
no_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -218,6 +218,7 @@ static const struct object_ops fd_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
fd_destroy /* destroy */
|
fd_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -257,6 +258,7 @@ static const struct object_ops device_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
device_destroy /* destroy */
|
device_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -295,6 +297,7 @@ static const struct object_ops inode_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
inode_destroy /* destroy */
|
inode_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -335,6 +338,7 @@ static const struct object_ops file_lock_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
no_destroy /* destroy */
|
no_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,6 +94,7 @@ static const struct object_ops file_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
file_open_file, /* open_file */
|
file_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
file_destroy /* destroy */
|
file_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -133,6 +133,7 @@ static const struct object_ops handle_table_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
handle_table_destroy /* destroy */
|
handle_table_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,6 +91,7 @@ static const struct object_ops hook_table_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
hook_table_destroy /* destroy */
|
hook_table_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,6 +89,7 @@ static const struct object_ops mailslot_ops =
|
||||||
mailslot_link_name, /* link_name */
|
mailslot_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
mailslot_open_file, /* open_file */
|
mailslot_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
mailslot_destroy /* destroy */
|
mailslot_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -145,6 +146,7 @@ static const struct object_ops mail_writer_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
mail_writer_destroy /* destroy */
|
mail_writer_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -202,6 +204,7 @@ static const struct object_ops mailslot_device_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
mailslot_device_open_file, /* open_file */
|
mailslot_device_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
mailslot_device_destroy /* destroy */
|
mailslot_device_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,6 +77,7 @@ static const struct object_ops ranges_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
ranges_destroy /* destroy */
|
ranges_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -111,6 +112,7 @@ static const struct object_ops shared_map_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
shared_map_destroy /* destroy */
|
shared_map_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -166,6 +168,7 @@ static const struct object_ops mapping_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
mapping_destroy /* destroy */
|
mapping_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,6 +71,7 @@ static const struct object_ops mutex_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
mutex_destroy /* destroy */
|
mutex_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,6 +128,7 @@ static const struct object_ops named_pipe_ops =
|
||||||
named_pipe_link_name, /* link_name */
|
named_pipe_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
named_pipe_open_file, /* open_file */
|
named_pipe_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
named_pipe_destroy /* destroy */
|
named_pipe_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -169,6 +170,7 @@ static const struct object_ops pipe_server_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
pipe_server_destroy /* destroy */
|
pipe_server_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -210,6 +212,7 @@ static const struct object_ops pipe_client_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
pipe_end_destroy /* destroy */
|
pipe_end_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -255,6 +258,7 @@ static const struct object_ops named_pipe_device_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
named_pipe_device_open_file, /* open_file */
|
named_pipe_device_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
named_pipe_device_destroy /* destroy */
|
named_pipe_device_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -283,6 +287,7 @@ static const struct object_ops named_pipe_device_file_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
named_pipe_device_file_destroy /* destroy */
|
named_pipe_device_file_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -425,6 +425,7 @@ void release_object( void *ptr )
|
||||||
assert( !obj->handle_count );
|
assert( !obj->handle_count );
|
||||||
/* if the refcount is 0, nobody can be in the wait queue */
|
/* if the refcount is 0, nobody can be in the wait queue */
|
||||||
assert( list_empty( &obj->wait_queue ));
|
assert( list_empty( &obj->wait_queue ));
|
||||||
|
free_kernel_objects( obj );
|
||||||
unlink_named_object( obj );
|
unlink_named_object( obj );
|
||||||
obj->ops->destroy( obj );
|
obj->ops->destroy( obj );
|
||||||
free_object( obj );
|
free_object( obj );
|
||||||
|
|
|
@ -89,6 +89,8 @@ struct object_ops
|
||||||
/* open a file object to access this object */
|
/* open a file object to access this object */
|
||||||
struct object *(*open_file)(struct object *, unsigned int access, unsigned int sharing,
|
struct object *(*open_file)(struct object *, unsigned int access, unsigned int sharing,
|
||||||
unsigned int options);
|
unsigned int options);
|
||||||
|
/* return list of kernel objects */
|
||||||
|
struct list *(*get_kernel_obj_list)(struct object *);
|
||||||
/* close a handle to this object */
|
/* close a handle to this object */
|
||||||
int (*close_handle)(struct object *,struct process *,obj_handle_t);
|
int (*close_handle)(struct object *,struct process *,obj_handle_t);
|
||||||
/* destroy on refcount == 0 */
|
/* destroy on refcount == 0 */
|
||||||
|
@ -141,6 +143,7 @@ extern void *open_named_object( struct object *parent, const struct object_ops *
|
||||||
extern void unlink_named_object( struct object *obj );
|
extern void unlink_named_object( struct object *obj );
|
||||||
extern void make_object_static( struct object *obj );
|
extern void make_object_static( struct object *obj );
|
||||||
extern struct namespace *create_namespace( unsigned int hash_size );
|
extern struct namespace *create_namespace( unsigned int hash_size );
|
||||||
|
extern void free_kernel_objects( struct object *obj );
|
||||||
/* grab/release_object can take any pointer, but you better make sure */
|
/* grab/release_object can take any pointer, but you better make sure */
|
||||||
/* that the thing pointed to starts with a struct object... */
|
/* that the thing pointed to starts with a struct object... */
|
||||||
extern struct object *grab_object( void *obj );
|
extern struct object *grab_object( void *obj );
|
||||||
|
@ -163,6 +166,7 @@ extern int no_link_name( struct object *obj, struct object_name *name, struct ob
|
||||||
extern void default_unlink_name( struct object *obj, struct object_name *name );
|
extern void default_unlink_name( struct object *obj, struct object_name *name );
|
||||||
extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
|
extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
|
||||||
unsigned int options );
|
unsigned int options );
|
||||||
|
extern struct list *no_kernel_obj_list( struct object *obj );
|
||||||
extern int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
extern int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||||
extern void no_destroy( struct object *obj );
|
extern void no_destroy( struct object *obj );
|
||||||
#ifdef DEBUG_OBJECTS
|
#ifdef DEBUG_OBJECTS
|
||||||
|
|
|
@ -85,6 +85,7 @@ static const struct object_ops process_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
process_destroy /* destroy */
|
process_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -134,6 +135,7 @@ static const struct object_ops startup_info_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
startup_info_destroy /* destroy */
|
startup_info_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -177,6 +179,7 @@ static const struct object_ops job_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
job_close_handle, /* close_handle */
|
job_close_handle, /* close_handle */
|
||||||
job_destroy /* destroy */
|
job_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -181,6 +181,7 @@ static const struct object_ops msg_queue_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
msg_queue_destroy /* destroy */
|
msg_queue_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -216,6 +217,7 @@ static const struct object_ops thread_input_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
thread_input_destroy /* destroy */
|
thread_input_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -170,6 +170,7 @@ static const struct object_ops key_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
key_close_handle, /* close_handle */
|
key_close_handle, /* close_handle */
|
||||||
key_destroy /* destroy */
|
key_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,6 +107,7 @@ static const struct object_ops master_socket_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
master_socket_destroy /* destroy */
|
master_socket_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,6 +68,7 @@ static const struct object_ops semaphore_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
no_destroy /* destroy */
|
no_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,6 +102,7 @@ static const struct object_ops serial_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
serial_destroy /* destroy */
|
serial_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,6 +77,7 @@ static const struct object_ops handler_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
handler_destroy /* destroy */
|
handler_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,6 +71,7 @@ static const struct object_ops snapshot_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
snapshot_destroy /* destroy */
|
snapshot_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -154,6 +154,7 @@ static const struct object_ops sock_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
fd_close_handle, /* close_handle */
|
fd_close_handle, /* close_handle */
|
||||||
sock_destroy /* destroy */
|
sock_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -968,6 +969,7 @@ static const struct object_ops ifchange_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
ifchange_destroy /* destroy */
|
ifchange_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,6 +70,7 @@ static const struct object_ops symlink_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
symlink_destroy /* destroy */
|
symlink_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -120,6 +120,7 @@ static const struct object_ops thread_apc_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
thread_apc_destroy /* destroy */
|
thread_apc_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -152,6 +153,7 @@ static const struct object_ops thread_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
destroy_thread /* destroy */
|
destroy_thread /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,6 +75,7 @@ static const struct object_ops timer_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
timer_destroy /* destroy */
|
timer_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -156,6 +156,7 @@ static const struct object_ops token_ops =
|
||||||
no_link_name, /* link_name */
|
no_link_name, /* link_name */
|
||||||
NULL, /* unlink_name */
|
NULL, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
no_close_handle, /* close_handle */
|
no_close_handle, /* close_handle */
|
||||||
token_destroy /* destroy */
|
token_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,6 +75,7 @@ static const struct object_ops winstation_ops =
|
||||||
directory_link_name, /* link_name */
|
directory_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
winstation_close_handle, /* close_handle */
|
winstation_close_handle, /* close_handle */
|
||||||
winstation_destroy /* destroy */
|
winstation_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
@ -98,6 +99,7 @@ static const struct object_ops desktop_ops =
|
||||||
desktop_link_name, /* link_name */
|
desktop_link_name, /* link_name */
|
||||||
default_unlink_name, /* unlink_name */
|
default_unlink_name, /* unlink_name */
|
||||||
no_open_file, /* open_file */
|
no_open_file, /* open_file */
|
||||||
|
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||||
desktop_close_handle, /* close_handle */
|
desktop_close_handle, /* close_handle */
|
||||||
desktop_destroy /* destroy */
|
desktop_destroy /* destroy */
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue