mmap-cache.h revision 634ed0ee3466e5e5f78d3acbe9782650ff456288
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#pragma once
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering/***
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering This file is part of systemd.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering Copyright 2012 Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering systemd is free software; you can redistribute it and/or modify it
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering under the terms of the GNU Lesser General Public License as published by
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering (at your option) any later version.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering systemd is distributed in the hope that it will be useful, but
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering Lesser General Public License for more details.
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering You should have received a copy of the GNU Lesser General Public License
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
4871690d9e32608bbd9b18505b5326c2079c9690Allin Cottrell***/
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include <inttypes.h>
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include <stdbool.h>
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering#include <sys/stat.h>
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poetteringtypedef struct MMapCache MMapCache;
13790add4bf648fed816361794d8277a75253410Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart PoetteringMMapCache* mmap_cache_new(void);
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart PoetteringMMapCache* mmap_cache_ref(MMapCache *m);
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart PoetteringMMapCache* mmap_cache_unref(MMapCache *m);
a09561746f15b84da9471b5c4be74e53d19e4f3fLennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringint mmap_cache_get(
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering MMapCache *m,
13790add4bf648fed816361794d8277a75253410Lennart Poettering int fd,
afc5dbf37fd2399d37976388d9dd9ab470ecf446Lennart Poettering int prot,
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering unsigned context,
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering bool keep_always,
d025f1e4dca8fc1436aff76f9e6185fe3e728daaZbigniew Jędrzejewski-Szmek uint64_t offset,
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering size_t size,
a45b9fca6b91a767dcd9060cfcb30617dad234c7Lennart Poettering struct stat *st,
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen void **ret);
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringvoid mmap_cache_close_fd(MMapCache *m, int fd);
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringunsigned mmap_cache_get_hit(MMapCache *m);
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringunsigned mmap_cache_get_missed(MMapCache *m);
15a5e95075a7f6007dd97b2a165c8ed16fe683dfLennart Poettering