AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
blkcache.h
Go to the documentation of this file.
1#ifndef _DEV_BLKCACHE_H
2#define _DEV_BLKCACHE_H
3
4#include <core/system.h>
5
6/* The block cache (dev/blkcache.c): recently used disk sectors, kept in
7 * memory, written back on sync. */
8
9/* Reads or writes `count` sectors from `sector` of the owner's device. */
10typedef ssize_t (*blkcache_io)(void *owner, uint64_t sector, size_t count, void *buf);
11
12/* Reads sectors through the cache, or writes them into it. */
13ssize_t blkcache_read(void *owner, uint64_t sector, size_t count, void *buf,
14 uint64_t nsectors, blkcache_io read);
15ssize_t blkcache_write(void *owner, uint64_t sector, size_t count, void *buf,
16 blkcache_io write);
17
18/* Writes what was written to the cache to the disks. */
19int blkcache_flush(void);
20
21#endif /* ! _DEV_BLKCACHE_H */
ssize_t blkcache_read(void *owner, uint64_t sector, size_t count, void *buf, uint64_t nsectors, blkcache_io read)
Reads sectors of a disk through the cache.
Definition blkcache.c:367
ssize_t blkcache_write(void *owner, uint64_t sector, size_t count, void *buf, blkcache_io write)
Writes sectors of a disk through the cache: they stay dirty in it until it is flushed.
Definition blkcache.c:484
int blkcache_flush(void)
Writes every dirty block of the cache to its disk.
Definition blkcache.c:309
ssize_t(*) blkcache_io(void *owner, uint64_t sector, size_t count, void *buf)
Definition blkcache.h:10
unsigned long long int uint64_t
Definition stddef.h:23
long int ssize_t
Definition types.h:12