1 /* 2 * Test dataspace operations. 3 * 4 * Copyright (C) 2020, 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 <systypes/fcntl.h> 23 24 #include <stdio.h> 25 26 #include <fsclient/client.h> 27 28 #include <e2access/fs.h> 29 30 31 32 int main(int argc, char *argv[]) 33 { 34 if (argc < 3) 35 { 36 printf("Need a device and filename.\n"); 37 return 1; 38 } 39 40 /* Obtain device, filename and access parameters. */ 41 42 char *device = argv[1]; 43 char *filename = argv[2]; 44 45 e2access_init(device); 46 47 ext2_filsys fs = NULL; 48 49 errcode_t retval = e2access_open(filename, EXT2_FLAG_RW, &fs); // EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS 50 51 if (retval) 52 { 53 printf("Could not obtain filesystem: %ld.\n", retval); 54 return 1; 55 } 56 57 printf("Access completed.\n"); 58 59 return 0; 60 } 61 62 // vim: tabstop=2 expandtab shiftwidth=2