mirror of
https://github.com/clearlinux/graphene.git
synced 2026-10-03 23:48:19 +00:00
[LibOS] Get rid of qstrtostr()
Used in one place. Needed to remove non-standard use of alloca.
This commit is contained in:
committed by
Dmitrii Kuvaiskii
parent
f883d05317
commit
d8930fb4ac
@@ -145,19 +145,6 @@ void* malloc(size_t size);
|
||||
void free(void* mem);
|
||||
void* malloc_copy(const void* mem, size_t size);
|
||||
|
||||
static inline __attribute__((always_inline)) char* qstrtostr(struct shim_qstr* qstr, bool on_stack) {
|
||||
int len = qstr->len;
|
||||
char* buf = on_stack ? __alloca(len + 1) : malloc(len + 1);
|
||||
|
||||
if (!buf)
|
||||
return NULL;
|
||||
|
||||
memcpy(buf, qstrgetstr(qstr), len);
|
||||
|
||||
buf[len] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* typedef a 32 bit type */
|
||||
#ifndef UINT4
|
||||
#define UINT4 uint32_t
|
||||
|
||||
@@ -1504,8 +1504,13 @@ retry:
|
||||
if (!p->port) {
|
||||
IDTYPE type = IPC_PORT_OWNER | IPC_PORT_LISTEN;
|
||||
IDTYPE owner = p->vmid;
|
||||
char* uri = qstrtostr(&p->uri, true);
|
||||
struct shim_ipc_port* port = NULL;
|
||||
size_t uri_len = p->uri.len;
|
||||
char uri[uri_len + 1];
|
||||
|
||||
memcpy(&uri, qstrgetstr(&p->uri), uri_len);
|
||||
uri[uri_len] = 0;
|
||||
|
||||
unlock(&range_map_lock);
|
||||
|
||||
PAL_HANDLE pal_handle = DkStreamOpen(uri, 0, 0, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user