summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/util.h
blob: 44d5728cc3f82edf71e190c3e946399f369deedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once
#include <kernel/types.h>
#include <shared/mem.h>
#include <shared/ring.h>
#include <stdbool.h>
#include <stddef.h>

// TODO put req_readcopy in a global header
int req_readcopy(VfsReq *req, const void *buf, size_t len);

/* compare request path. path MUST be a static string */
#define reqpathcmp(req, path) _reqpathcmp(req, ""path"", sizeof(path) - 1)
#define _reqpathcmp(req, path, plen) \
	(req->kin && req->kinlen == plen && memcmp(req->kin, path, plen) == 0)

size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max);