# HG changeset patch # User Paul Boddie # Date 1715381364 -7200 # Node ID cb08608b37fd49bd578fdc478af4e6201f957741 # Parent 2c83535db1dbccb54a82f44edf6e561113e501cb Moved current_region from the Pipe interface to the Flush interface as refresh. diff -r 2c83535db1db -r cb08608b37fd docs/wiki/Components --- a/docs/wiki/Components Sat May 11 00:10:59 2024 +0200 +++ b/docs/wiki/Components Sat May 11 00:49:24 2024 +0200 @@ -348,7 +348,7 @@ Directory -> Reader1; Reader1 -> Client2; - Client3 -> Reader2 [label="current_region()"]; + Client3 -> Reader2 [label="refresh()"]; Reader3 -> Memory -> Client4; } }}} @@ -360,7 +360,7 @@ {{{ reader = directory.opendir() -reader.current_region() +reader.refresh() entries = reader.read() # this being a memory access operation }}} @@ -397,14 +397,13 @@ fully populated region. Naturally, the reader may not advance ahead of the writer. -Pipes implement the `Pipe` interface and a number of operations to support -this interaction mechanism. +Pipes implement a number of operations to support this interaction mechanism. The details of an endpoint's current region can be queried using the following -operation: +operation from the `Flush` interface: {{{ -current_region(inout offset_t position, out offset_t populated_size, out offset_t size) +refresh(out offset_t position, out offset_t size, out offset_t region_size) }}} This provides details of the recorded access position in a region, the @@ -413,7 +412,7 @@ the same. Navigation to the next available region of the pipe is performed using the -following operation: +following operation from the `Pipe` interface: {{{ next_region(inout offset_t populated_size, out offset_t size) diff -r 2c83535db1db -r cb08608b37fd libfsclient/lib/src/file.cc --- a/libfsclient/lib/src/file.cc Sat May 11 00:10:59 2024 +0200 +++ b/libfsclient/lib/src/file.cc Sat May 11 00:49:24 2024 +0200 @@ -681,9 +681,9 @@ long pipe_current(file_t *pipe, int sync) { - client_Pipe _pipe(pipe->ref); + client_Flush _pipe(pipe->ref); offset_t data_current; - long err = _pipe.current_region(&data_current, &pipe->size, &pipe->end_pos); + long err = _pipe.refresh(&data_current, &pipe->size, &pipe->end_pos); if (err) return err; diff -r 2c83535db1db -r cb08608b37fd libfsserver/include/fsserver/pipe_pager.h --- a/libfsserver/include/fsserver/pipe_pager.h Sat May 11 00:10:59 2024 +0200 +++ b/libfsserver/include/fsserver/pipe_pager.h Sat May 11 00:49:24 2024 +0200 @@ -1,7 +1,7 @@ /* * A pipe pager providing access to pipe content and navigation support. * - * 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 @@ -66,14 +66,14 @@ virtual long closed(int *closed); - virtual long current_region(offset_t *position, offset_t *populated_size, offset_t *size); - virtual long next_region(offset_t *populated_size, offset_t *size); /* Flushing/synchronisation. */ virtual long flush(offset_t position, offset_t *size); + virtual long refresh(offset_t *position, offset_t *populated_size, offset_t *size); + /* Notification methods. */ virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags); diff -r 2c83535db1db -r cb08608b37fd libfsserver/lib/pipes/pipe_pager.cc --- a/libfsserver/lib/pipes/pipe_pager.cc Sat May 11 00:10:59 2024 +0200 +++ b/libfsserver/lib/pipes/pipe_pager.cc Sat May 11 00:49:24 2024 +0200 @@ -96,7 +96,7 @@ /* Return details of the current region. */ -long PipePager::current_region(offset_t *position, offset_t *populated_size, offset_t *size) +long PipePager::refresh(offset_t *position, offset_t *populated_size, offset_t *size) { if (_mapper != NULL) { @@ -133,7 +133,7 @@ _mapper = mapper; _data_current = 0; - return current_region(NULL, populated_size, size); + return refresh(NULL, populated_size, size); } long PipePager::next_region_for_writer(offset_t *populated_size, offset_t *size) @@ -153,7 +153,7 @@ _mapper = mapper; _data_current = 0; - return current_region(NULL, populated_size, size); + return refresh(NULL, populated_size, size); } long PipePager::pipe_error() diff -r 2c83535db1db -r cb08608b37fd libsystypes/idl/flush.idl --- a/libsystypes/idl/flush.idl Sat May 11 00:10:59 2024 +0200 +++ b/libsystypes/idl/flush.idl Sat May 11 00:49:24 2024 +0200 @@ -9,4 +9,10 @@ indicates the point from which data is being consumed by a client. */ [opcode(5)] void flush(in offset_t position, out offset_t size); + + /* Refresh any recorded position and size information, also obtaining the span + of the mapped region used to access the file or pipe. */ + + [opcode(16)] void refresh(out offset_t position, out offset_t size, + out offset_t region_size); }; diff -r 2c83535db1db -r cb08608b37fd libsystypes/idl/pipe.idl --- a/libsystypes/idl/pipe.idl Sat May 11 00:10:59 2024 +0200 +++ b/libsystypes/idl/pipe.idl Sat May 11 00:49:24 2024 +0200 @@ -4,12 +4,11 @@ interface Pipe { - /* Obtain details of the current region of shared memory. */ + /* Advance to the next region of shared memory, indicating and obtaining the + populated limit of the region and obtaining the region size. - [opcode(16)] void current_region(out offset_t position, out offset_t populated_size, out offset_t size); - - /* Advance to the next region of shared memory, indicating and obtaining the - populated limit of the region and obtaining the region size. */ + The current region details are available via the Flush interface's refresh + operation. */ [opcode(17)] void next_region(inout offset_t populated_size, out offset_t size);