This file is indexed.

/usr/include/qb/qbhdb.h is in libqb-dev 0.11.1-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
/*
 * Copyright (C) 2006-2010 Red Hat, Inc.
 *
 * Author: Steven Dake <sdake@redhat.com>
 *
 * This file is part of libqb.
 *
 * libqb is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * libqb is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with libqb.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef QB_HDB_H_DEFINED
#define QB_HDB_H_DEFINED

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <qb/qbarray.h>

/**
 * @file qbhdb.h
 * The handle database is for reference counting objects.
 */

/**
 * Generic handle type is 64 bits.
 */
typedef uint64_t qb_handle_t;

/*
 * Formatting for string printing on 32/64 bit systems
 */
#define QB_HDB_D_FORMAT "%"PRIu64
#define QB_HDB_X_FORMAT "%"PRIx64

struct qb_hdb_handle {
	int32_t state;
	void *instance;
	int32_t check;
	int32_t ref_count;
};

struct qb_hdb {
	uint32_t handle_count;
	qb_array_t *handles;
	uint32_t iterator;
	void (*destructor) (void *);
	uint32_t first_run;
};

/**
 * Convience macro for declaring a file scoped handle database.
 * @code
 * QB_HDB_DECLARE(my_handle_database, NULL);
 * @endcode
 */
#define QB_HDB_DECLARE(database_name,destructor_function)		\
static struct qb_hdb (database_name) = {				\
	.handle_count	= 0,						\
	.handles	= NULL,						\
	.iterator	= 0,						\
	.destructor	= destructor_function,				\
	.first_run	= 1						\
};									\

/**
 * Create a new database.
 * @param hdb the database to init.
 */
void qb_hdb_create(struct qb_hdb *hdb);

/**
 * Destroy a handle database.
 * @param hdb the database to destroy.
 */
void qb_hdb_destroy(struct qb_hdb *hdb);

/**
 * Create a new handle.
 * @param hdb the database instance
 * @param instance_size size of the object to malloc
 * @param handle_id_out new handle
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_handle_create(struct qb_hdb *hdb, int32_t instance_size,
			     qb_handle_t * handle_id_out);
/**
 * Get the instance associated with this handle and increase it's refcount.
 * @param handle_in the handle
 * @param hdb the database instance
 * @param instance (out) pointer to the desired object.
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_handle_get(struct qb_hdb *hdb, qb_handle_t handle_in,
			  void **instance);
/**
 * Get the instance associated with this handle and increase it's refcount.
 * @param handle_in the handle
 * @param hdb the database instance
 * @param instance (out) pointer to the desired object.
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_handle_get_always(struct qb_hdb *hdb, qb_handle_t handle_in,
				 void **instance);
/**
 * Put the instance associated with this handle and decrease it's refcount.
 * @param handle_in the handle
 * @param hdb the database instance
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_handle_put(struct qb_hdb *hdb, qb_handle_t handle_in);

/**
 * Request the destruction of the object.
 * 
 * When the refcount is 0, it will be destroyed.
 *
 * @param handle_in the handle
 * @param hdb the database instance
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_handle_destroy(struct qb_hdb *hdb, qb_handle_t handle_in);

/**
 * Get the current refcount.
 * @param handle_in the handle
 * @param hdb the database instance
 * @return (>= 0 is the refcount, -errno faliure)
 */
int32_t qb_hdb_handle_refcount_get(struct qb_hdb *hdb, qb_handle_t handle_in);

/**
 * Reset the iterator.
 * @param hdb the database instance
 */
void qb_hdb_iterator_reset(struct qb_hdb *hdb);

/**
 * Get the next object and increament it's refcount.
 *
 * Remember to call qb_hdb_handle_put()
 *
 * @param hdb the database instance
 * @param handle (out) the handle
 * @param instance (out) pointer to the desired object.
 * @return (0 == ok, -errno faliure)
 */
int32_t qb_hdb_iterator_next(struct qb_hdb *hdb, void **instance,
			     qb_handle_t * handle);

uint32_t qb_hdb_base_convert(qb_handle_t handle);
uint64_t qb_hdb_nocheck_convert(uint32_t handle);

/* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* QB_HDB_H_DEFINED */