1 /* 2 * A pipe accessor merely resetting allocated memory for use. 3 * 4 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #include "pipe_accessor.h" 23 24 #include <string.h> 25 26 PipeAccessor::PipeAccessor() 27 : Accessor(0) 28 { 29 } 30 31 /* Perform any closing operation on the file. */ 32 33 void PipeAccessor::close() 34 { 35 } 36 37 /* Perform any opening operation on the file. */ 38 39 void PipeAccessor::open() 40 { 41 } 42 43 /* Data transfer helper methods. */ 44 45 void PipeAccessor::fill_populated(Flexpage *flexpage) 46 { 47 offset_t filepos = flexpage->base_offset; 48 offset_t addr = flexpage->base_addr; 49 50 /* Tag the region with file state. */ 51 52 flexpage->region->fill(fileid, filepos); 53 54 /* File the flexpage with zero. */ 55 56 memset((void *) addr, 0, flexpage->size); 57 } 58 59 void PipeAccessor::flush_populated(Flexpage *flexpage) 60 { 61 flexpage->region->flush(); 62 } 63 64 // vim: tabstop=4 expandtab shiftwidth=4