win-pvdrivers

view liblfds.6/src/ringbuffer/ringbuffer_query.c @ 1025:aa2e51f67f7c

Fix hibernate under Win8. Change debugprints.
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 19 15:14:53 2013 +1100 (2013-02-19)
parents 6300617040e0
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 }