git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
7-ps2_keyboard.md and 8-multitasking.md (#29)
[lunaix-os.git]
/
lunaix-os
/
kernel
/
fs
/
pcache.c
diff --git
a/lunaix-os/kernel/fs/pcache.c
b/lunaix-os/kernel/fs/pcache.c
index 8f6a710c6ed82000dea0f70d7e4b1158eabe4369..3e77cf50a56cb756596032ca569e0187beff4e0b 100644
(file)
--- a/
lunaix-os/kernel/fs/pcache.c
+++ b/
lunaix-os/kernel/fs/pcache.c
@@
-1,7
+1,6
@@
#include <klibc/string.h>
#include <lunaix/ds/btrie.h>
#include <lunaix/fs.h>
#include <klibc/string.h>
#include <lunaix/ds/btrie.h>
#include <lunaix/fs.h>
-#include <lunaix/mm/page.h>
#include <lunaix/mm/pmm.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/mm/pmm.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/mm/vmm.h>
@@
-23,21
+22,21
@@
static void
pcache_free_page(void* va)
{
ptr_t pa = vmm_del_mapping(VMS_SELF, (ptr_t)va);
pcache_free_page(void* va)
{
ptr_t pa = vmm_del_mapping(VMS_SELF, (ptr_t)va);
- pmm_free_page(
KERNEL_PID,
pa);
+ pmm_free_page(pa);
}
static void*
pcache_alloc_page()
{
int i = 0;
}
static void*
pcache_alloc_page()
{
int i = 0;
- ptr_t pp = pmm_alloc_page(
KERNEL_PID,
0), va = 0;
+ ptr_t pp = pmm_alloc_page(0), va = 0;
if (!pp) {
return NULL;
}
if (!pp) {
return NULL;
}
- if (!(va = (ptr_t)vmap(pp, P
G_SIZE, PG_PREM_RW, 0
))) {
- pmm_free_page(
KERNEL_PID,
pp);
+ if (!(va = (ptr_t)vmap(pp, P
AGE_SIZE, KERNEL_DATA
))) {
+ pmm_free_page(pp);
return NULL;
}
return NULL;
}
@@
-47,7
+46,7
@@
pcache_alloc_page()
void
pcache_init(struct pcache* pcache)
{
void
pcache_init(struct pcache* pcache)
{
- btrie_init(&pcache->tree, P
G_SIZE_BITS
);
+ btrie_init(&pcache->tree, P
AGE_SHIFT
);
llist_init_head(&pcache->dirty);
llist_init_head(&pcache->pages);
llist_init_head(&pcache->dirty);
llist_init_head(&pcache->pages);
@@
-134,7
+133,7
@@
pcache_write(struct v_inode* inode, void* data, u32_t len, u32_t fpos)
struct pcache_pg* pg;
while (buf_off < len && errno >= 0) {
struct pcache_pg* pg;
while (buf_off < len && errno >= 0) {
- u32_t wr_bytes = MIN(P
G
_SIZE - pg_off, len - buf_off);
+ u32_t wr_bytes = MIN(P
AGE
_SIZE - pg_off, len - buf_off);
int new_page = pcache_get_page(pcache, fpos, &pg_off, &pg);
int new_page = pcache_get_page(pcache, fpos, &pg_off, &pg);
@@
-145,7
+144,7
@@
pcache_write(struct v_inode* inode, void* data, u32_t len, u32_t fpos)
if (errno < 0) {
break;
}
if (errno < 0) {
break;
}
- if (errno <
PG
_SIZE) {
+ if (errno <
(int)PAGE
_SIZE) {
// EOF
len = MIN(len, buf_off + errno);
}
// EOF
len = MIN(len, buf_off + errno);
}
@@
-182,7
+181,7
@@
pcache_read(struct v_inode* inode, void* data, u32_t len, u32_t fpos)
if (errno < 0) {
break;
}
if (errno < 0) {
break;
}
- if (errno <
PG
_SIZE) {
+ if (errno <
(int)PAGE
_SIZE) {
// EOF
len = MIN(len, buf_off + errno);
}
// EOF
len = MIN(len, buf_off + errno);
}