static void set_irp_result( struct irp_call *irp, unsigned int status, const void *out_data, data_size_t out_size, data_size_t result ) { struct device_file *file = irp->file; if (!file) return; /* already finished */ /* FIXME: handle the STATUS_PENDING case */ irp->status = status; irp->result = result; irp->out_size = min( irp->out_size, out_size ); if (irp->out_size && !(irp->out_data = memdup( out_data, irp->out_size ))) irp->out_size = 0; irp->file = NULL; if (irp->async) { if (result) status = STATUS_ALERTED; async_terminate( irp->async, status ); release_object( irp->async ); irp->async = NULL; } wake_up( &irp->obj, 0 ); if (status != STATUS_ALERTED) { /* remove it from the device queue */ /* (for STATUS_ALERTED this will be done in get_irp_result) */ list_remove( &irp->dev_entry ); release_object( irp ); /* no longer on the device queue */ } release_object( file ); }
static void set_ioctl_result( struct ioctl_call *ioctl, unsigned int status, const void *out_data, data_size_t out_size ) { struct device *device = ioctl->device; if (!device) return; /* already finished */ /* FIXME: handle the STATUS_PENDING case */ ioctl->status = status; ioctl->out_size = min( ioctl->out_size, out_size ); if (ioctl->out_size && !(ioctl->out_data = memdup( out_data, ioctl->out_size ))) ioctl->out_size = 0; release_object( device ); ioctl->device = NULL; if (ioctl->async) { if (ioctl->out_size) status = STATUS_ALERTED; async_terminate( ioctl->async, status ); release_object( ioctl->async ); ioctl->async = NULL; } wake_up( &ioctl->obj, 0 ); if (status != STATUS_ALERTED) { /* remove it from the device queue */ /* (for STATUS_ALERTED this will be done in get_ioctl_result) */ list_remove( &ioctl->dev_entry ); release_object( ioctl ); /* no longer on the device queue */ } }
static void irp_call_destroy( struct object *obj ) { struct irp_call *irp = (struct irp_call *)obj; free( irp->in_data ); free( irp->out_data ); if (irp->async) { async_terminate( irp->async, STATUS_CANCELLED ); release_object( irp->async ); } if (irp->file) release_object( irp->file ); if (irp->thread) release_object( irp->thread ); }
static void ioctl_call_destroy( struct object *obj ) { struct ioctl_call *ioctl = (struct ioctl_call *)obj; free( ioctl->in_data ); free( ioctl->out_data ); if (ioctl->async) { async_terminate( ioctl->async, STATUS_CANCELLED ); release_object( ioctl->async ); } if (ioctl->device) release_object( ioctl->device ); release_object( ioctl->thread ); }