Commit 5c4d6cf8 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Pass all creation arguments to the device creation functions.

parent 1a7b256f
...@@ -2540,9 +2540,10 @@ static struct object *console_device_open_file( struct object *obj, unsigned int ...@@ -2540,9 +2540,10 @@ static struct object *console_device_open_file( struct object *obj, unsigned int
return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console ); return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console );
} }
struct object *create_console_device( struct object *root, const struct unicode_str *name ) struct object *create_console_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{ {
return create_named_object( root, &console_device_ops, name, 0, NULL ); return create_named_object( root, &console_device_ops, name, attr, sd );
} }
/* allocate a console for the renderer */ /* allocate a console for the renderer */
......
...@@ -720,11 +720,12 @@ static struct device *create_device( struct object *root, const struct unicode_s ...@@ -720,11 +720,12 @@ static struct device *create_device( struct object *root, const struct unicode_s
} }
struct object *create_unix_device( struct object *root, const struct unicode_str *name, struct object *create_unix_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd,
const char *unix_path ) const char *unix_path )
{ {
struct device *device; struct device *device;
if ((device = create_named_object( root, &device_ops, name, 0, NULL ))) if ((device = create_named_object( root, &device_ops, name, attr, sd )))
{ {
device->unix_path = strdup( unix_path ); device->unix_path = strdup( unix_path );
device->manager = NULL; /* no manager, requests go straight to the Unix device */ device->manager = NULL; /* no manager, requests go straight to the Unix device */
......
...@@ -423,11 +423,11 @@ void init_directories(void) ...@@ -423,11 +423,11 @@ void init_directories(void)
make_object_static( &dir_objtype->obj ); make_object_static( &dir_objtype->obj );
/* devices */ /* devices */
named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str ); named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str, 0, NULL );
mailslot_device = create_mailslot_device( &dir_device->obj, &mailslot_str ); mailslot_device = create_mailslot_device( &dir_device->obj, &mailslot_str, 0, NULL );
console_device = create_console_device( &dir_device->obj, &condrv_str ); console_device = create_console_device( &dir_device->obj, &condrv_str, 0, NULL );
socket_device = create_socket_device( &dir_device->obj, &afd_str ); socket_device = create_socket_device( &dir_device->obj, &afd_str, 0, NULL );
null_device = create_unix_device( &dir_device->obj, &null_str, "/dev/null" ); null_device = create_unix_device( &dir_device->obj, &null_str, 0, NULL, "/dev/null" );
make_object_static( named_pipe_device ); make_object_static( named_pipe_device );
make_object_static( mailslot_device ); make_object_static( mailslot_device );
make_object_static( null_device ); make_object_static( null_device );
......
...@@ -176,12 +176,16 @@ extern struct object *create_user_data_mapping( struct object *root, const struc ...@@ -176,12 +176,16 @@ extern struct object *create_user_data_mapping( struct object *root, const struc
/* device functions */ /* device functions */
extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name ); extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name,
extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name ); unsigned int attr, const struct security_descriptor *sd );
extern struct object *create_console_device( struct object *root, const struct unicode_str *name ); extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name,
extern struct object *create_socket_device( struct object *root, const struct unicode_str *name ); unsigned int attr, const struct security_descriptor *sd );
extern struct object *create_console_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd );
extern struct object *create_socket_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd );
extern struct object *create_unix_device( struct object *root, const struct unicode_str *name, extern struct object *create_unix_device( struct object *root, const struct unicode_str *name,
const char *unix_path ); unsigned int attr, const struct security_descriptor *sd, const char *unix_path );
/* change notification functions */ /* change notification functions */
......
...@@ -433,11 +433,12 @@ static void mailslot_device_destroy( struct object *obj ) ...@@ -433,11 +433,12 @@ static void mailslot_device_destroy( struct object *obj )
free( device->mailslots ); free( device->mailslots );
} }
struct object *create_mailslot_device( struct object *root, const struct unicode_str *name ) struct object *create_mailslot_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{ {
struct mailslot_device *dev; struct mailslot_device *dev;
if ((dev = create_named_object( root, &mailslot_device_ops, name, 0, NULL )) && if ((dev = create_named_object( root, &mailslot_device_ops, name, attr, sd )) &&
get_error() != STATUS_OBJECT_NAME_EXISTS) get_error() != STATUS_OBJECT_NAME_EXISTS)
{ {
dev->mailslots = NULL; dev->mailslots = NULL;
......
...@@ -964,8 +964,8 @@ struct object *create_user_data_mapping( struct object *root, const struct unico ...@@ -964,8 +964,8 @@ struct object *create_user_data_mapping( struct object *root, const struct unico
void *ptr; void *ptr;
struct mapping *mapping; struct mapping *mapping;
if (!(mapping = create_mapping( root, name, OBJ_OPENIF, sizeof(KSHARED_USER_DATA), if (!(mapping = create_mapping( root, name, attr, sizeof(KSHARED_USER_DATA),
SEC_COMMIT, 0, FILE_READ_DATA | FILE_WRITE_DATA, NULL ))) return NULL; SEC_COMMIT, 0, FILE_READ_DATA | FILE_WRITE_DATA, sd ))) return NULL;
ptr = mmap( NULL, mapping->size, PROT_WRITE, MAP_SHARED, get_unix_fd( mapping->fd ), 0 ); ptr = mmap( NULL, mapping->size, PROT_WRITE, MAP_SHARED, get_unix_fd( mapping->fd ), 0 );
if (ptr != MAP_FAILED) if (ptr != MAP_FAILED)
{ {
......
...@@ -507,11 +507,12 @@ static void named_pipe_device_destroy( struct object *obj ) ...@@ -507,11 +507,12 @@ static void named_pipe_device_destroy( struct object *obj )
free( device->pipes ); free( device->pipes );
} }
struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name ) struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{ {
struct named_pipe_device *dev; struct named_pipe_device *dev;
if ((dev = create_named_object( root, &named_pipe_device_ops, name, 0, NULL )) && if ((dev = create_named_object( root, &named_pipe_device_ops, name, attr, sd )) &&
get_error() != STATUS_OBJECT_NAME_EXISTS) get_error() != STATUS_OBJECT_NAME_EXISTS)
{ {
dev->pipes = NULL; dev->pipes = NULL;
......
...@@ -1247,9 +1247,10 @@ static struct object *socket_device_open_file( struct object *obj, unsigned int ...@@ -1247,9 +1247,10 @@ static struct object *socket_device_open_file( struct object *obj, unsigned int
return &sock->obj; return &sock->obj;
} }
struct object *create_socket_device( struct object *root, const struct unicode_str *name ) struct object *create_socket_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{ {
return create_named_object( root, &socket_device_ops, name, 0, NULL ); return create_named_object( root, &socket_device_ops, name, attr, sd );
} }
/* accept a socket */ /* accept a socket */
......
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