2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2018 Aleph One Ltd.
6 * Created by Charles Manning <charles@aleph1.co.uk>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __YAFFS_CACHE_H__
14 #define __YAFFS_CACHE_H__
16 #include "yaffs_guts.h"
19 /* Does the object have a dirty cache ? */
20 int yaffs_obj_cache_dirty(struct yaffs_obj *obj);
22 /* Flush the cache associated with a file, either discarding or keeping */
23 void yaffs_flush_file_cache(struct yaffs_obj *obj, int discard);
25 /* Flush everything in the cache, either discarding or keeping */
26 void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard);
28 /* Grab a cache item during read or write. */
29 struct yaffs_cache *yaffs_grab_chunk_cache(struct yaffs_dev *dev);
31 /* Find a cached chunk */
32 struct yaffs_cache *yaffs_find_chunk_cache(const struct yaffs_obj *obj,
35 /* Mark the chunk for the least recently used algorithym */
36 void yaffs_use_cache(struct yaffs_dev *dev, struct yaffs_cache *cache,
40 /* Invalidate a single cache page. The cache no longer holds valid data. */
41 void yaffs_invalidate_chunk_cache(struct yaffs_obj *object,
44 /* Invalidate all the cache pages associated with this object
45 * Do this whenever ther file is deleted or resized.
47 void yaffs_invalidate_file_cache(struct yaffs_obj *in);
50 int yaffs_count_dirty_caches(struct yaffs_dev *dev);
53 int yaffs_cache_init(struct yaffs_dev *dev);
54 void yaffs_cache_deinit(struct yaffs_dev *dev);