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 DEFAULT_MAX_DIRCACHE_SIZE 8192
25#define MAX_POSSIBLE_DIRCACHE_SIZE 131072
26#define DIRCACHE_FREE_QUANTUM 256
27
28/* flags for dircache_remove */
29#define DIRCACHE      (1 << 0)
30#define DIDNAME_INDEX (1 << 1)
31#define QUEUE_INDEX   (1 << 2)
32#define DIRCACHE_ALL  (DIRCACHE|DIDNAME_INDEX|QUEUE_INDEX)
33
34extern int        dircache_init(int reqsize);
35extern int        dircache_add(const struct vol *, struct dir *);
36extern void       dircache_remove(const struct vol *, struct dir *, int flag);
37extern struct dir *dircache_search_by_did(const struct vol *vol, cnid_t did);
38extern struct dir *dircache_search_by_name(const struct vol *, const struct dir *dir, char *name, int len);
39extern void       dircache_dump(void);
40extern void       log_dircache_stat(void);
41#endif /* DIRCACHE_H */
42