Blame libkmod/libkmod-index.h

Packit Service 68b988
/*
Packit Service 68b988
 * libkmod - interface to kernel module operations
Packit Service 68b988
 *
Packit Service 68b988
 * Copyright (C) 2011-2013  ProFUSION embedded systems
Packit Service 68b988
 *
Packit Service 68b988
 * This library is free software; you can redistribute it and/or
Packit Service 68b988
 * modify it under the terms of the GNU Lesser General Public
Packit Service 68b988
 * License as published by the Free Software Foundation; either
Packit Service 68b988
 * version 2.1 of the License, or (at your option) any later version.
Packit Service 68b988
 *
Packit Service 68b988
 * This library is distributed in the hope that it will be useful,
Packit Service 68b988
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 68b988
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 68b988
 * Lesser General Public License for more details.
Packit Service 68b988
 *
Packit Service 68b988
 * You should have received a copy of the GNU Lesser General Public
Packit Service 68b988
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit Service 68b988
 */
Packit Service 68b988
Packit Service 68b988
#pragma once
Packit Service 68b988
Packit Service 68b988
#include <inttypes.h>
Packit Service 68b988
Packit Service 68b988
struct index_value {
Packit Service 68b988
	struct index_value *next;
Packit Service 68b988
	unsigned int priority;
Packit Service 68b988
	unsigned int len;
Packit Service 68b988
	char value[0];
Packit Service 68b988
};
Packit Service 68b988
Packit Service 68b988
/* In-memory index (depmod only) */
Packit Service 68b988
struct index_file;
Packit Service 68b988
struct index_file *index_file_open(const char *filename);
Packit Service 68b988
void index_file_close(struct index_file *idx);
Packit Service 68b988
char *index_search(struct index_file *idx, const char *key);
Packit Service 68b988
void index_dump(struct index_file *in, int fd, const char *prefix);
Packit Service 68b988
struct index_value *index_searchwild(struct index_file *idx, const char *key);
Packit Service 68b988
Packit Service 68b988
void index_values_free(struct index_value *values);
Packit Service 68b988
Packit Service 68b988
/* Implementation using mmap */
Packit Service 68b988
struct index_mm;
Packit Service 68b988
struct index_mm *index_mm_open(struct kmod_ctx *ctx, const char *filename,
Packit Service 68b988
						unsigned long long *stamp);
Packit Service 68b988
void index_mm_close(struct index_mm *index);
Packit Service 68b988
char *index_mm_search(struct index_mm *idx, const char *key);
Packit Service 68b988
struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key);
Packit Service 68b988
void index_mm_dump(struct index_mm *idx, int fd, const char *prefix);