32 lines
741 B
C
32 lines
741 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _DCACHE_H_
|
|
#define _DCACHE_H_
|
|
|
|
#include <kernel/lock.h>
|
|
#include <fs/vfs.h>
|
|
|
|
#include <lib/list.h>
|
|
|
|
#define DCACHE_SHIFT 10
|
|
#define DCACHE_SIZE (1 << DCACHE_SHIFT)
|
|
|
|
#define DCACHE_LOCK_SHIFT 4
|
|
#define DCACHE_NLOCKS (1 << DCACHE_LOCK_SHIFT)
|
|
|
|
struct dc_entry {
|
|
struct dc_entry *parent;
|
|
struct mount *mount;
|
|
lock_t lock;
|
|
list_t children;
|
|
dirent_t *dirent;
|
|
char d_name[FILE_NAME_MAX_LEN + 1];
|
|
};
|
|
|
|
extern struct dc_entry dcache[DCACHE_SIZE];
|
|
|
|
void dcache_init(void);
|
|
void dcache_insert(struct dc_entry *parent, dirent_t *dirent, const char *name);
|
|
void dcache_remove(struct dc_entry *d);
|
|
struct dc_entry *dcache_lookup(struct dc_entry *parent, const char *name);
|
|
|
|
#endif /* _DCACHE_H_ */
|