This file is indexed.

/usr/include/infiniband/complib/cl_qpool.h is in libopensm-dev 3.3.15-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
/*
 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

/*
 * Abstract:
 *	Declaration of the quick pool.
 *	The quick pool manages a pool of objects.
 *	The pool can grow to meet demand, limited only by system memory.
 */

#ifndef _CL_QUICK_POOL_H_
#define _CL_QUICK_POOL_H_

#include <complib/cl_qcomppool.h>

#ifdef __cplusplus
#  define BEGIN_C_DECLS extern "C" {
#  define END_C_DECLS   }
#else				/* !__cplusplus */
#  define BEGIN_C_DECLS
#  define END_C_DECLS
#endif				/* __cplusplus */

BEGIN_C_DECLS
/****h* Component Library/Quick Pool
* NAME
*	Quick Pool
*
* DESCRIPTION
*	The quick pool provides a self-contained and self-sustaining pool
*	of user defined objects.
*
*	To aid in object oriented design, the quick pool provides the user
*	the ability to specify callbacks that are invoked for each object for
*	construction, initialization, and destruction. Constructor and destructor
*	callback functions may not fail.
*
*	A quick pool does not return memory to the system as the user returns
*	objects to the pool. The only method of returning memory to the system is
*	to destroy the pool.
*
*	The quick pool operates on cl_pool_item_t structures that describe
*	objects. This can provides for more efficient memory use and operation.
*	If using a cl_pool_item_t is not desired, the Pool provides similar
*	functionality but operates on opaque objects.
*
*	The quick pool functions operates on a cl_qpool_t structure which should
*	be treated as opaque and should be manipulated only through the provided
*	functions.
*
* SEE ALSO
*	Structures:
*		cl_qpool_t, cl_pool_item_t
*
*	Callbacks:
*		cl_pfn_qpool_init_t, cl_pfn_qpool_dtor_t
*
*	Initialization/Destruction:
*		cl_qpool_construct, cl_qpool_init, cl_qpool_destroy
*
*	Manipulation:
*		cl_qpool_get, cl_qpool_put, cl_qpool_put_list, cl_qpool_grow
*
*	Attributes:
*		cl_is_qpool_inited, cl_qpool_count
*********/
/****d* Component Library: Quick Pool/cl_pfn_qpool_init_t
* NAME
*	cl_pfn_qpool_init_t
*
* DESCRIPTION
*	The cl_pfn_qpool_init_t function type defines the prototype for
*	functions used as constructor for objects being allocated by a
*	quick pool.
*
* SYNOPSIS
*/
typedef cl_status_t
    (*cl_pfn_qpool_init_t) (IN void *const p_object,
			    IN void *context,
			    OUT cl_pool_item_t ** const pp_pool_item);
/*
* PARAMETERS
*	p_object
*		[in] Pointer to an object to initialize.
*
*	context
*		[in] Context provided in a call to cl_qpool_init.
*
* RETURN VALUES
*	Return CL_SUCCESS to indicate that initialization of the object
*	was successful and that initialization of further objects may continue.
*
*	Other cl_status_t values will be returned by cl_qcpool_init
*	and cl_qcpool_grow.
*
* NOTES
*	This function type is provided as function prototype reference for
*	the function provided by the user as an optional parameter to the
*	cl_qpool_init function.
*
*	The initializer is invoked once per allocated object, allowing the user
*	to perform any necessary initialization.  Returning a status other than
*	CL_SUCCESS aborts a grow operation, initiated either through cl_qcpool_init
*	or cl_qcpool_grow, causing the initiating function to fail.
*	Any non-CL_SUCCESS status will be returned by the function that initiated
*	the grow operation.
*
*	All memory for the object is pre-allocated.  Users should include space in
*	their objects for the cl_pool_item_t structure that will represent the
*	object to avoid having to allocate that structure in the initialization
*	callback.
*
*	When later performing a cl_qcpool_get call, the return value is a pointer
*	to the cl_pool_item_t returned by this function in the pp_pool_item
*	parameter.  Users must set pp_pool_item to a valid pointer to the
*	cl_pool_item_t representing the object if they return CL_SUCCESS.
*
* SEE ALSO
*	Quick Pool, cl_qpool_init
*********/

/****d* Component Library: Quick Pool/cl_pfn_qpool_dtor_t
* NAME
*	cl_pfn_qpool_dtor_t
*
* DESCRIPTION
*	The cl_pfn_qpool_dtor_t function type defines the prototype for
*	functions used as destructor for objects being deallocated by a
*	quick pool.
*
* SYNOPSIS
*/
typedef void
 (*cl_pfn_qpool_dtor_t) (IN const cl_pool_item_t * const p_pool_item,
			 IN void *context);
/*
* PARAMETERS
*	p_pool_item
*		[in] Pointer to a cl_pool_item_t structure representing an object.
*
*	context
*		[in] Context provided in a call to cl_qpool_init.
*
* RETURN VALUE
*	This function does not return a value.
*
* NOTES
*	This function type is provided as function prototype reference for
*	the function provided by the user as an optional parameter to the
*	cl_qpool_init function.
*
*	The destructor is invoked once per allocated object, allowing the user
*	to perform any necessary cleanup. Users should not attempt to deallocate
*	the memory for the object, as the quick pool manages object
*	allocation and deallocation.
*
* SEE ALSO
*	Quick Pool, cl_qpool_init
*********/

/****s* Component Library: Quick Pool/cl_qpool_t
* NAME
*	cl_qpool_t
*
* DESCRIPTION
*	Quick pool structure.
*
*	The cl_qpool_t structure should be treated as opaque and should be
*	manipulated only through the provided functions.
*
* SYNOPSIS
*/
typedef struct _cl_qpool {
	cl_qcpool_t qcpool;
	cl_pfn_qpool_init_t pfn_init;
	cl_pfn_qpool_dtor_t pfn_dtor;
	const void *context;
} cl_qpool_t;
/*
* FIELDS
*	qcpool
*		Quick composite pool that manages all objects.
*
*	pfn_init
*		Pointer to the user's initializer callback, used by the pool
*		to translate the quick composite pool's initializer callback to
*		a quick pool initializer callback.
*
*	pfn_dtor
*		Pointer to the user's destructor callback, used by the pool
*		to translate the quick composite pool's destructor callback to
*		a quick pool destructor callback.
*
*	context
*		User's provided context for callback functions, used by the pool
*		to when invoking callbacks.
*
* SEE ALSO
*	Quick Pool
*********/

/****f* Component Library: Quick Pool/cl_qpool_construct
* NAME
*	cl_qpool_construct
*
* DESCRIPTION
*	The cl_qpool_construct function constructs a quick pool.
*
* SYNOPSIS
*/
void cl_qpool_construct(IN cl_qpool_t * const p_pool);
/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure whose state to initialize.
*
* RETURN VALUE
*	This function does not return a value.
*
* NOTES
*	Allows calling cl_qpool_init, cl_qpool_destroy, cl_is_qpool_inited.
*
*	Calling cl_qpool_construct is a prerequisite to calling any other
*	quick pool function except cl_pool_init.
*
* SEE ALSO
*	Quick Pool, cl_qpool_init, cl_qpool_destroy, cl_is_qpool_inited.
*********/

/****f* Component Library: Quick Pool/cl_is_qpool_inited
* NAME
*	cl_is_qpool_inited
*
* DESCRIPTION
*	The cl_is_qpool_inited function returns whether a quick pool was
*	successfully initialized.
*
* SYNOPSIS
*/
static inline uint32_t cl_is_qpool_inited(IN const cl_qpool_t * const p_pool)
{
	/* CL_ASSERT that a non-null pointer is provided. */
	CL_ASSERT(p_pool);
	return (cl_is_qcpool_inited(&p_pool->qcpool));
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure whose initialization state
*		to check.
*
* RETURN VALUES
*	TRUE if the quick pool was initialized successfully.
*
*	FALSE otherwise.
*
* NOTES
*	Allows checking the state of a quick pool to determine if
*	invoking member functions is appropriate.
*
* SEE ALSO
*	Quick Pool
*********/

/****f* Component Library: Quick Pool/cl_qpool_init
* NAME
*	cl_qpool_init
*
* DESCRIPTION
*	The cl_qpool_init function initializes a quick pool for use.
*
* SYNOPSIS
*/
cl_status_t
cl_qpool_init(IN cl_qpool_t * const p_pool,
	      IN const size_t min_size,
	      IN const size_t max_size,
	      IN const size_t grow_size,
	      IN const size_t object_size,
	      IN cl_pfn_qpool_init_t pfn_initializer OPTIONAL,
	      IN cl_pfn_qpool_dtor_t pfn_destructor OPTIONAL,
	      IN const void *const context);
/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure to initialize.
*
*	min_size
*		[in] Minimum number of objects that the pool should support. All
*		necessary allocations to allow storing the minimum number of items
*		are performed at initialization time, and all necessary callbacks
*		successfully invoked.
*
*	max_size
*		[in] Maximum number of objects to which the pool is allowed to grow.
*		A value of zero specifies no maximum.
*
*	grow_size
*		[in] Number of objects to allocate when incrementally growing the pool.
*		A value of zero disables automatic growth.
*
*	object_size
*		[in] Size, in bytes, of each object.
*
*	pfn_initializer
*		[in] Initialization callback to invoke for every new object when
*		growing the pool. This parameter is optional and may be NULL. If NULL,
*		the pool assumes the cl_pool_item_t structure describing objects is
*		located at the head of each object. See the cl_pfn_qpool_init_t
*		function type declaration for details about the callback function.
*
*	pfn_destructor
*		[in] Destructor callback to invoke for every object before memory for
*		that object is freed. This parameter is optional and may be NULL.
*		See the cl_pfn_qpool_dtor_t function type declaration for details
*		about the callback function.
*
*	context
*		[in] Value to pass to the callback functions to provide context.
*
* RETURN VALUES
*	CL_SUCCESS if the quick pool was initialized successfully.
*
*	CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the
*	quick pool.
*
*	CL_INVALID_SETTING if a the maximum size is non-zero and less than the
*	minimum size.
*
*	Other cl_status_t value returned by optional initialization callback function
*	specified by the pfn_initializer parameter.
*
* NOTES
*	cl_qpool_init initializes, and if necessary, grows the pool to
*	the capacity desired.
*
* SEE ALSO
*	Quick Pool, cl_qpool_construct, cl_qpool_destroy,
*	cl_qpool_get, cl_qpool_put, cl_qpool_grow,
*	cl_qpool_count, cl_pfn_qpool_init_t, cl_pfn_qpool_init_t,
*	cl_pfn_qpool_dtor_t
*********/

/****f* Component Library: Quick Pool/cl_qpool_destroy
* NAME
*	cl_qpool_destroy
*
* DESCRIPTION
*	The cl_qpool_destroy function destroys a quick pool.
*
* SYNOPSIS
*/
static inline void cl_qpool_destroy(IN cl_qpool_t * const p_pool)
{
	CL_ASSERT(p_pool);
	cl_qcpool_destroy(&p_pool->qcpool);
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure to destroy.
*
* RETURN VALUE
*	This function does not return a value.
*
* NOTES
*	All memory allocated for objects is freed. The destructor callback,
*	if any, will be invoked for every allocated object. Further operations
*	on the pool should not be attempted after cl_qpool_destroy
*	is invoked.
*
*	This function should only be called after a call to
*	cl_qpool_construct or cl_qpool_init.
*
*	In a debug build, cl_qpool_destroy asserts that all objects are in
*	the pool.
*
* SEE ALSO
*	Quick Pool, cl_qpool_construct, cl_qpool_init
*********/

/****f* Component Library: Quick Pool/cl_qpool_count
* NAME
*	cl_qpool_count
*
* DESCRIPTION
*	The cl_qpool_count function returns the number of available objects
*	in a quick pool.
*
* SYNOPSIS
*/
static inline size_t cl_qpool_count(IN cl_qpool_t * const p_pool)
{
	CL_ASSERT(p_pool);
	return (cl_qcpool_count(&p_pool->qcpool));
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure for which the number of
*		available objects is requested.
*
* RETURN VALUE
*	Returns the number of objects available in the specified quick pool.
*
* SEE ALSO
*	Quick Pool
*********/

/****f* Component Library: Quick Pool/cl_qpool_get
* NAME
*	cl_qpool_get
*
* DESCRIPTION
*	The cl_qpool_get function retrieves an object from a
*	quick pool.
*
* SYNOPSIS
*/
static inline cl_pool_item_t *cl_qpool_get(IN cl_qpool_t * const p_pool)
{
	CL_ASSERT(p_pool);
	return (cl_qcpool_get(&p_pool->qcpool));
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure from which to retrieve
*		an object.
*
* RETURN VALUES
*	Returns a pointer to a cl_pool_item_t for an object.
*
*	Returns NULL if the pool is empty and can not be grown automatically.
*
* NOTES
*	cl_qpool_get returns the object at the head of the pool. If the pool is
*	empty, it is automatically grown to accommodate this request unless the
*	grow_size parameter passed to the cl_qpool_init function was zero.
*
* SEE ALSO
*	Quick Pool, cl_qpool_get_tail, cl_qpool_put, cl_qpool_grow, cl_qpool_count
*********/

/****f* Component Library: Quick Pool/cl_qpool_put
* NAME
*	cl_qpool_put
*
* DESCRIPTION
*	The cl_qpool_put function returns an object to the head of a quick pool.
*
* SYNOPSIS
*/
static inline void
cl_qpool_put(IN cl_qpool_t * const p_pool,
	     IN cl_pool_item_t * const p_pool_item)
{
	CL_ASSERT(p_pool);
	cl_qcpool_put(&p_pool->qcpool, p_pool_item);
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure to which to return
*		an object.
*
*	p_pool_item
*		[in] Pointer to a cl_pool_item_t structure for the object
*		being returned.
*
* RETURN VALUE
*	This function does not return a value.
*
* NOTES
*	cl_qpool_put places the returned object at the head of the pool.
*
*	The object specified by the p_pool_item parameter must have been
*	retrieved from the pool by a previous call to cl_qpool_get.
*
* SEE ALSO
*	Quick Pool, cl_qpool_put_tail, cl_qpool_get
*********/

/****f* Component Library: Quick Pool/cl_qpool_put_list
* NAME
*	cl_qpool_put_list
*
* DESCRIPTION
*	The cl_qpool_put_list function returns a list of objects to the head
*	of a quick pool.
*
* SYNOPSIS
*/
static inline void
cl_qpool_put_list(IN cl_qpool_t * const p_pool, IN cl_qlist_t * const p_list)
{
	CL_ASSERT(p_pool);
	cl_qcpool_put_list(&p_pool->qcpool, p_list);
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure to which to return
*		a list of objects.
*
*	p_list
*		[in] Pointer to a cl_qlist_t structure for the list of objects
*		being returned.
*
* RETURN VALUE
*	This function does not return a value.
*
* NOTES
*	cl_qpool_put_list places the returned objects at the head of the pool.
*
*	The objects in the list specified by the p_list parameter must have been
*	retrieved from the pool by a previous call to cl_qpool_get.
*
* SEE ALSO
*	Quick Pool, cl_qpool_put, cl_qpool_put_tail, cl_qpool_get
*********/

/****f* Component Library: Quick Pool/cl_qpool_grow
* NAME
*	cl_qpool_grow
*
* DESCRIPTION
*	The cl_qpool_grow function grows a quick pool by
*	the specified number of objects.
*
* SYNOPSIS
*/
static inline cl_status_t
cl_qpool_grow(IN cl_qpool_t * const p_pool, IN const size_t obj_count)
{
	CL_ASSERT(p_pool);
	return (cl_qcpool_grow(&p_pool->qcpool, obj_count));
}

/*
* PARAMETERS
*	p_pool
*		[in] Pointer to a cl_qpool_t structure whose capacity to grow.
*
*	obj_count
*		[in] Number of objects by which to grow the pool.
*
* RETURN VALUES
*	CL_SUCCESS if the quick pool grew successfully.
*
*	CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the
*	quick pool.
*
*	cl_status_t value returned by optional initialization callback function
*	specified by the pfn_initializer parameter passed to the
*	cl_qpool_init function.
*
* NOTES
*	It is not necessary to call cl_qpool_grow if the pool is
*	configured to grow automatically.
*
* SEE ALSO
*	Quick Pool
*********/

END_C_DECLS
#endif				/* _CL_QUICK_POOL_H_ */