# HG changeset patch # User Paul Boddie # Date 1709851826 -3600 # Node ID e6d0b112316f1fe1d966cd0acc840f0180470def # Parent ff536e5b5cf66acdba11d14dc38e5d5f754a6c44 Updated dataspace type usage. diff -r ff536e5b5cf6 -r e6d0b112316f libexec/include/exec/process_creator_context_resource.h --- a/libexec/include/exec/process_creator_context_resource.h Thu Mar 07 22:41:40 2024 +0100 +++ b/libexec/include/exec/process_creator_context_resource.h Thu Mar 07 23:50:26 2024 +0100 @@ -65,8 +65,8 @@ l4_snd_fpage_t *region) { return SimplePager::map(offset, hot_spot, flags, region); } - long info(offset_t *size, map_flags_t *flags) - { return SimplePager::info(size, flags); } + long info(ds_stats_t *stats) + { return SimplePager::info(stats); } }; /* vim: tabstop=2 expandtab shiftwidth=2 diff -r ff536e5b5cf6 -r e6d0b112316f libfsclient/lib/src/file.cc --- a/libfsclient/lib/src/file.cc Thu Mar 07 22:41:40 2024 +0100 +++ b/libfsclient/lib/src/file.cc Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * File access convenience functions. * - * Copyright (C) 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2021, 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -267,8 +267,7 @@ return -L4_EINVAL; client_Opener opener(server); - offset_t size; - map_flags_t flags; + ds_stats_t stats; long err; file_init(file); @@ -280,14 +279,14 @@ client_Dataspace context_ds(file->ref); - err = context_ds.info(&size, &flags); + err = context_ds.info(&stats); if (err) return err; file->start_pos = 0; - file->end_pos = size; + file->end_pos = stats.size; - return ipc_attach_dataspace(file->ref, size, (void **) &file->memory); + return ipc_attach_dataspace(file->ref, stats.size, (void **) &file->memory); } /* Make a directory using the given context. */ diff -r ff536e5b5cf6 -r e6d0b112316f libfsserver/include/fsserver/opener_context_resource.h --- a/libfsserver/include/fsserver/opener_context_resource.h Thu Mar 07 22:41:40 2024 +0100 +++ b/libfsserver/include/fsserver/opener_context_resource.h Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * A context resource offering support for opening files. * - * Copyright (C) 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2021, 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -68,8 +68,8 @@ l4_snd_fpage_t *region) { return SimplePager::map(offset, hot_spot, flags, region); } - long info(offset_t *size, map_flags_t *flags) - { return SimplePager::info(size, flags); } + long info(ds_stats_t *stats) + { return SimplePager::info(stats); } }; // vim: tabstop=4 expandtab shiftwidth=4 diff -r ff536e5b5cf6 -r e6d0b112316f libfsserver/include/fsserver/simple_pager.h --- a/libfsserver/include/fsserver/simple_pager.h Thu Mar 07 22:41:40 2024 +0100 +++ b/libfsserver/include/fsserver/simple_pager.h Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * A simple pager exposing a single memory region. * - * Copyright (C) 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2021, 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -49,7 +49,7 @@ long map(offset_t offset, map_address_t hot_spot, map_flags_t flags, l4_snd_fpage_t *region); - long info(offset_t *size, map_flags_t *flags); + long info(ds_stats_t *stats); }; // vim: tabstop=4 expandtab shiftwidth=4 diff -r ff536e5b5cf6 -r e6d0b112316f libfsserver/lib/generic/simple_pager.cc --- a/libfsserver/lib/generic/simple_pager.cc Thu Mar 07 22:41:40 2024 +0100 +++ b/libfsserver/lib/generic/simple_pager.cc Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * A simple pager exposing a single memory region. * - * Copyright (C) 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2021, 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -95,10 +95,10 @@ return IPC_MESSAGE_SENT; } -long SimplePager::info(offset_t *size, map_flags_t *flags) +long SimplePager::info(ds_stats_t *stats) { - *size = _region->size(); - *flags = L4_FPAGE_RW; + stats->size = _region->size(); + stats->flags = L4_FPAGE_RW; return L4_EOK; } diff -r ff536e5b5cf6 -r e6d0b112316f libipc/Control --- a/libipc/Control Thu Mar 07 22:41:40 2024 +0100 +++ b/libipc/Control Thu Mar 07 23:50:26 2024 +0100 @@ -1,3 +1,3 @@ -requires: libc +requires: libc libsystypes provides: libipc maintainer: paul@boddie.org.uk diff -r ff536e5b5cf6 -r e6d0b112316f libipc/include/ipc/mem_ipc.h --- a/libipc/include/ipc/mem_ipc.h Thu Mar 07 22:41:40 2024 +0100 +++ b/libipc/include/ipc/mem_ipc.h Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * Memory sharing abstractions. * - * Copyright (C) 2018, 2019, 2021, 2022 Paul Boddie + * Copyright (C) 2018, 2019, 2021, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,24 +21,23 @@ #pragma once -#include -#include #include +#include EXTERN_C_BEGIN -long ipc_allocate(unsigned long size, void **addr, l4re_ds_t *ds); +long ipc_allocate(unsigned long size, void **addr, l4_cap_idx_t *ds); -long ipc_allocate_align(unsigned long size, l4re_rm_flags_t flags, - unsigned char align, void **addr, l4re_ds_t *ds); +long ipc_allocate_align(unsigned long size, rm_flags_t flags, + unsigned char align, void **addr, l4_cap_idx_t *ds); long ipc_new_dataspace(l4_mword_t size, l4_umword_t flags, l4_umword_t align, - l4re_ds_t *ds); + l4_cap_idx_t *ds); -long ipc_attach_dataspace(l4re_ds_t ds, unsigned long size, void **addr); +long ipc_attach_dataspace(l4_cap_idx_t ds, unsigned long size, void **addr); -long ipc_attach_dataspace_align(l4re_ds_t ds, unsigned long size, - l4re_rm_flags_t flags, unsigned char align, +long ipc_attach_dataspace_align(l4_cap_idx_t ds, unsigned long size, + rm_flags_t flags, unsigned char align, void **addr); long ipc_detach_dataspace(void *addr); diff -r ff536e5b5cf6 -r e6d0b112316f libipc/lib/src/Makefile --- a/libipc/lib/src/Makefile Thu Mar 07 22:41:40 2024 +0100 +++ b/libipc/lib/src/Makefile Thu Mar 07 23:50:26 2024 +0100 @@ -4,7 +4,7 @@ TARGET = libipc.a libipc.so PC_FILENAME = libipc SRC_C = cap_alloc.c irq.c map.c mem_ipc.c message.c semaphore.c server.c thread.c util_ipc.c -REQUIRES_LIBS = l4re_c-util +REQUIRES_LIBS = l4re_c-util libsystypes PRIVATE_INCDIR += $(PKGDIR)/include/ipc CONTRIB_INCDIR = libipc diff -r ff536e5b5cf6 -r e6d0b112316f libipc/lib/src/mem_ipc.c --- a/libipc/lib/src/mem_ipc.c Thu Mar 07 22:41:40 2024 +0100 +++ b/libipc/lib/src/mem_ipc.c Thu Mar 07 23:50:26 2024 +0100 @@ -1,7 +1,7 @@ /* * Memory sharing abstractions. * - * Copyright (C) 2018, 2019, 2021, 2022 Paul Boddie + * Copyright (C) 2018, 2019, 2021, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -20,6 +20,7 @@ */ #include +#include /* L4RE_RM_F_* */ #include #include @@ -37,14 +38,14 @@ /* Generic memory allocation. */ -long ipc_allocate(unsigned long size, void **addr, l4re_ds_t *ds) +long ipc_allocate(unsigned long size, void **addr, l4_cap_idx_t *ds) { return ipc_allocate_align(size, L4RE_RM_F_SEARCH_ADDR | L4RE_RM_F_RW, L4_PAGESHIFT, addr, ds); } long ipc_allocate_align(unsigned long size, l4re_rm_flags_t flags, - unsigned char align, void **addr, l4re_ds_t *ds) + unsigned char align, void **addr, l4_cap_idx_t *ds) { /* Allocate and attach the memory for the dataspace. */ @@ -66,7 +67,7 @@ /* Create a dataspace. Equivalent to l4re_ma_alloc_align. */ long ipc_new_dataspace(l4_mword_t size, l4_umword_t flags, l4_umword_t align, - l4re_ds_t *ds) + l4_cap_idx_t *ds) { /* Allocate a capability for the dataspace. */ @@ -80,14 +81,14 @@ /* Attach a dataspace region. Similar to l4re_rm_attach. */ -long ipc_attach_dataspace(l4re_ds_t ds, unsigned long size, void **addr) +long ipc_attach_dataspace(l4_cap_idx_t ds, unsigned long size, void **addr) { return ipc_attach_dataspace_align(ds, size, L4RE_RM_F_SEARCH_ADDR | L4RE_RM_F_RW, L4_PAGESHIFT, addr); } -long ipc_attach_dataspace_align(l4re_ds_t ds, unsigned long size, - l4re_rm_flags_t flags, unsigned char align, +long ipc_attach_dataspace_align(l4_cap_idx_t ds, unsigned long size, + rm_flags_t flags, unsigned char align, void **addr) { long err; diff -r ff536e5b5cf6 -r e6d0b112316f libmem/lib/src/memory_incremental.cc --- a/libmem/lib/src/memory_incremental.cc Thu Mar 07 22:41:40 2024 +0100 +++ b/libmem/lib/src/memory_incremental.cc Thu Mar 07 23:50:26 2024 +0100 @@ -20,6 +20,7 @@ */ #include +#include #include "memory_incremental.h" diff -r ff536e5b5cf6 -r e6d0b112316f libsystypes/idl/dataspace.idl --- a/libsystypes/idl/dataspace.idl Thu Mar 07 22:41:40 2024 +0100 +++ b/libsystypes/idl/dataspace.idl Thu Mar 07 23:50:26 2024 +0100 @@ -26,7 +26,7 @@ /* Obtain statistics about a dataspace. */ - [opcode(2)] void info(out offset_t size, out map_flags_t flags); + [opcode(2)] void info(out ds_stats_t stats); /* Copy data between dataspaces. */ diff -r ff536e5b5cf6 -r e6d0b112316f libsystypes/include/systypes/base.h --- a/libsystypes/include/systypes/base.h Thu Mar 07 22:41:40 2024 +0100 +++ b/libsystypes/include/systypes/base.h Thu Mar 07 23:50:26 2024 +0100 @@ -46,6 +46,18 @@ typedef l4_uint64_t map_address_t; typedef unsigned long map_flags_t; +/* Dataspace types. + See: pkg/l4re-core/l4re_c/include/dataspace.h */ + +typedef unsigned long ds_flags_t; + +typedef struct +{ + offset_t size; + ds_flags_t flags; + +} ds_stats_t; + /* Conversions. */ map_flags_t map_flags_for_fault(l4_umword_t flags);