win-pvdrivers

view liblfds.6/src/single_dir_for_windows_kernel/ringbuffer_query.c @ 766:6300617040e0

Big changes - not ready for production use.
Removed all the custom DMA handling code as it was completely incompatible with the Windows verifier.
Added liblfds (using the lock free stack) from liblfds.org so that grant's can be obtained at DIRQL.
Fixed xennet and xenvbd to support the changes.
xenusb and xenscsi almost certainly will not yet work after the changes.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jan 31 21:28:42 2010 +1100 (2010-01-31)
parents
children
line source
1 #include "ringbuffer_internal.h"
7 /****************************************************************************/
8 #pragma warning( disable : 4100 )
10 void ringbuffer_query( struct ringbuffer_state *rs, enum ringbuffer_query_type query_type, void *query_input, void *query_output )
11 {
12 assert( rs != NULL );
13 // TRD : query_type can be any value in its range
14 // TRD : query_input can be NULL
15 assert( query_output != NULL );
17 switch( query_type )
18 {
19 case RINGBUFFER_QUERY_VALIDATE:
20 // TRD : query_input can be NULL
22 ringbuffer_internal_validate( rs, (struct validation_info *) query_input, (enum data_structure_validity *) query_output, ((enum data_structure_validity *) query_output)+2 );
23 break;
24 }
26 return;
27 }
29 #pragma warning( default : 4100 )
35 /****************************************************************************/
36 void ringbuffer_internal_validate( struct ringbuffer_state *rs, struct validation_info *vi, enum data_structure_validity *queue_validity, enum data_structure_validity *freelist_validity )
37 {
38 assert( rs != NULL );
39 // TRD : vi can be NULL
40 assert( queue_validity != NULL );
41 assert( freelist_validity != NULL );
43 queue_query( rs->qs, QUEUE_QUERY_VALIDATE, vi, queue_validity );
45 if( vi != NULL )
46 {
47 struct validation_info
48 freelist_vi;
50 atom_t
51 total_elements;
53 freelist_query( rs->fs, FREELIST_QUERY_ELEMENT_COUNT, NULL, (void *) &total_elements );
54 freelist_vi.min_elements = total_elements - vi->max_elements;
55 freelist_vi.max_elements = total_elements - vi->min_elements;
56 freelist_query( rs->fs, FREELIST_QUERY_VALIDATE, (void *) &freelist_vi, (void *) freelist_validity );
57 }
59 if( vi == NULL )
60 freelist_query( rs->fs, FREELIST_QUERY_VALIDATE, NULL, (void *) freelist_validity );
62 return;
63 }