mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: misc stuff
This commit is contained in:
@@ -1309,6 +1309,11 @@ static int ext2_link(vnode_t *vnode, vnode_t *dirvnode, char *name, cred_t *cred
|
||||
if (err)
|
||||
goto cleanup;
|
||||
|
||||
// if the node is in memory without any filesystem links,
|
||||
// undo the release done by ext2_unlink
|
||||
if (node->inode.links == 0)
|
||||
VOP_HOLD(&node->vnode);
|
||||
|
||||
node->inode.links += 1;
|
||||
|
||||
ASSERT_UNCLEAN(fs, writeinode(fs, &node->inode, node->id) == 0);
|
||||
|
||||
@@ -348,14 +348,13 @@ static void enqueueandwait(queuepair_t *queuepair, entrypair_t *entries) {
|
||||
|
||||
static int identify(nvmecontroller_t *controller, void *buffer, int what, int namespace) {
|
||||
entrypair_t pair = {0};
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_IDENTIFY, SUB_DW0_UNFUSED, SUB_DW0_PRP, 0);
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_IDENTIFY, SUB_DW0_UNFUSED, SUB_DW0_PRP, namespace);
|
||||
|
||||
pair.sub.datapointer[0] = (uint64_t)pmm_allocpage(PMM_SECTION_DEFAULT);
|
||||
if (pair.sub.datapointer[0] == 0)
|
||||
return ENOMEM;
|
||||
|
||||
pair.sub.command[0] = what;
|
||||
pair.sub.namespace = namespace;
|
||||
|
||||
enqueueandwait(&controller->adminqueue, &pair);
|
||||
|
||||
@@ -481,11 +480,10 @@ static queuepair_t *pickioqueue(nvmecontroller_t *controller) {
|
||||
|
||||
static int ioread(nvmenamespace_t *namespace, uint64_t prp[2], uint64_t lba, uint64_t count) {
|
||||
entrypair_t pair = {0};
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_READ, SUB_DW0_UNFUSED, SUB_DW0_PRP, 0);
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_READ, SUB_DW0_UNFUSED, SUB_DW0_PRP, namespace->id);
|
||||
|
||||
queuepair_t *queue = pickioqueue(namespace->controller);
|
||||
|
||||
pair.sub.namespace = namespace->id;
|
||||
pair.sub.datapointer[0] = prp[0];
|
||||
pair.sub.datapointer[1] = prp[1];
|
||||
pair.sub.command[0] = lba & 0xffffffff;
|
||||
@@ -499,11 +497,10 @@ static int ioread(nvmenamespace_t *namespace, uint64_t prp[2], uint64_t lba, uin
|
||||
|
||||
static int iowrite(nvmenamespace_t *namespace, uint64_t prp[2], uint64_t lba, uint64_t count) {
|
||||
entrypair_t pair = {0};
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_WRITE, SUB_DW0_UNFUSED, SUB_DW0_PRP, 0);
|
||||
PAIR_INIT(&pair, SUB_DW0_OPCODE_WRITE, SUB_DW0_UNFUSED, SUB_DW0_PRP, namespace->id);
|
||||
|
||||
queuepair_t *queue = pickioqueue(namespace->controller);
|
||||
|
||||
pair.sub.namespace = namespace->id;
|
||||
pair.sub.datapointer[0] = prp[0];
|
||||
pair.sub.datapointer[1] = prp[1];
|
||||
pair.sub.command[0] = lba & 0xffffffff;
|
||||
|
||||
@@ -49,10 +49,10 @@ void term_init() {
|
||||
NULL, NULL, NULL, &defaultbg, &defaultfg, NULL, NULL, NULL,
|
||||
0, 0, 1, 1, 1, 0);
|
||||
|
||||
__assert(term_ctx);
|
||||
|
||||
xs = term_ctx->cols;
|
||||
ys = term_ctx->rows;
|
||||
fbxs = fb->width;
|
||||
fbys = fb->height;
|
||||
|
||||
__assert(term_ctx);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ syscallret_t syscall_mmap(context_t *context, void *hint, size_t len, int prot,
|
||||
|
||||
__assert((~KNOWN_FLAGS & flags) == 0);
|
||||
__assert((~KNOWN_PROT & prot) == 0);
|
||||
__assert(!((flags & MAP_PRIVATE) && (flags & MAP_SHARED)));
|
||||
|
||||
// check alignment
|
||||
if (len == 0 || (uintptr_t)hint % PAGE_SIZE) {
|
||||
|
||||
Reference in New Issue
Block a user