1 /* 2 * A file accessor employing a file provided via the filesystem client 3 * interface. 4 * 5 * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA 21 */ 22 23 #pragma once 24 25 #include <fsserver/accessor.h> 26 27 #include <fsclient/file.h> 28 29 30 31 /* A filesystem client file accessor, providing flexpages corresponding to file 32 regions. */ 33 34 class ClientFileAccessor : public Accessor 35 { 36 protected: 37 const char *_path; 38 file_t *_file; 39 40 /* Data transfer helper methods. */ 41 42 virtual void fill_populated(Flexpage *flexpage); 43 44 virtual void flush_populated(Flexpage *flexpage); 45 46 public: 47 explicit ClientFileAccessor(const char *path, fileid_t fileid); 48 49 virtual void close(); 50 51 virtual void open(); 52 53 virtual offset_t get_size(); 54 55 virtual void set_size(offset_t size); 56 }; 57 58 // vim: tabstop=4 expandtab shiftwidth=4