1/*
2   Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 */
14
15#ifndef DIRCACHE_H
16#define DIRCACHE_H
17
18#include <sys/types.h>
19
20#include <atalk/volume.h>
21#include <atalk/directory.h>
22
23/* Maximum size of the dircache hashtable */
24#define MAX_POSSIBLE_DIRCACHE_SIZE 131072
25#define DIRCACHE_FREE_QUANTUM 256
26
27/* flags for dircache_remove */
28#define DIRCACHE      (1 << 0)
29#define DIDNAME_INDEX (1 << 1)
30#define QUEUE_INDEX   (1 << 2)
31#define DIRCACHE_ALL  (DIRCACHE|DIDNAME_INDEX|QUEUE_INDEX)
32
33extern int        dircache_init(int reqsize);
34extern int        dircache_add(const struct vol *, struct dir *);
35extern void       dircache_remove(const struct vol *, struct dir *, int flag);
36extern struct dir *dircache_search_by_did(const struct vol *vol, cnid_t did);
37extern struct dir *dircache_search_by_name(const struct vol *, const struct dir *dir, char *name, int len);
38extern void       dircache_dump(void);
39extern void       log_dircache_stat(void);
40#endif /* DIRCACHE_H */
41