AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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. */
10
typedef
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. */
13
ssize_t
blkcache_read
(
void
*owner,
uint64_t
sector,
size_t
count,
void
*buf,
14
uint64_t
nsectors,
blkcache_io
read);
15
ssize_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. */
19
int
blkcache_flush
(
void
);
20
21
#endif
/* ! _DEV_BLKCACHE_H */
blkcache_read
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
blkcache_write
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
blkcache_flush
int blkcache_flush(void)
Writes every dirty block of the cache to its disk.
Definition
blkcache.c:309
blkcache_io
ssize_t(*) blkcache_io(void *owner, uint64_t sector, size_t count, void *buf)
Definition
blkcache.h:10
system.h
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
ssize_t
long int ssize_t
Definition
types.h:12
kernel
include
dev
blkcache.h
Generated by
1.18.0