:: limine / common / lib / uri.h 1.0 KB raw

1
#ifndef LIB__URI_H__
2
#define LIB__URI_H__
3
4
#include <stdbool.h>
5
#include <fs/file.h>
6
7
bool uri_resolve(char *uri, char **resource, char **root, char **path, char **hash);
8
9
// uri_open resolves the URI, verifies the blake2b hash (if present) and
10
// gzip-decodes (if the resource is prefixed with `$`) in a single streaming
11
// pass, and returns a memfile (is_memfile=true, readall=true) whose payload
12
// has been placed in memory of the requested `type`.
13
//
14
// When `allow_high_mem` is true and the target architecture is i386, the
15
// buffer may end up above 4 GiB; in that case the returned handle has
16
// is_high_mem=true, fd=NULL, and load_addr_64 holding the physical address.
17
// Otherwise load_addr_64 == (uintptr_t)fd. On i386 the two memcpy callbacks
18
// are used only when allow_high_mem is true; pass NULL otherwise.
19
struct file_handle *uri_open(char *uri, uint32_t type, bool allow_high_mem
20
#if defined (__i386__)
21
    , void (*memcpy_to_64)(uint64_t dst, void *src, size_t count)
22
    , void (*memcpy_from_64)(void *dst, uint64_t src, size_t count)
23
#endif
24
);
25
26
#endif
tab: 248 wrap: offon