mmap-cache.h revision 1b8951e5bd9b2bf1722098a861055cae0bb52088
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering#pragma once
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering/***
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering This file is part of systemd.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering Copyright 2012 Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering systemd is free software; you can redistribute it and/or modify it
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering under the terms of the GNU Lesser General Public License as published by
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering (at your option) any later version.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering systemd is distributed in the hope that it will be useful, but
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering Lesser General Public License for more details.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering You should have received a copy of the GNU Lesser General Public License
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering***/
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering#include <inttypes.h>
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering#include <stdbool.h>
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering#include <sys/stat.h>
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringtypedef struct MMapCache MMapCache;
9eb977db5b89b44f254ab40c1876a76b7d7ea2d0Kay Sievers
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart PoetteringMMapCache* mmap_cache_new(void);
a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7Harald HoyerMMapCache* mmap_cache_ref(MMapCache *m);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart PoetteringMMapCache* mmap_cache_unref(MMapCache *m);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringint mmap_cache_get(
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering MMapCache *m,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering int fd,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering int prot,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering unsigned context,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering bool keep_always,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering uint64_t offset,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering size_t size,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering struct stat *st,
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering void **ret);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringvoid mmap_cache_close_fd(MMapCache *m, int fd);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringvoid mmap_cache_close_context(MMapCache *m, unsigned context);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poetteringunsigned mmap_cache_get_hit(MMapCache *m);
2b6bf07dd23bb467099d213c97b3875c5e453491Zbigniew Jędrzejewski-Szmekunsigned mmap_cache_get_missed(MMapCache *m);
f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6Lennart Poettering