paul@105 | 1 | /* |
paul@105 | 2 | * Test dataspace operations. |
paul@105 | 3 | * |
paul@105 | 4 | * Copyright (C) 2020, 2021 Paul Boddie <paul@boddie.org.uk> |
paul@105 | 5 | * |
paul@105 | 6 | * This program is free software; you can redistribute it and/or |
paul@105 | 7 | * modify it under the terms of the GNU General Public License as |
paul@105 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@105 | 9 | * the License, or (at your option) any later version. |
paul@105 | 10 | * |
paul@105 | 11 | * This program is distributed in the hope that it will be useful, |
paul@105 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@105 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@105 | 14 | * GNU General Public License for more details. |
paul@105 | 15 | * |
paul@105 | 16 | * You should have received a copy of the GNU General Public License |
paul@105 | 17 | * along with this program; if not, write to the Free Software |
paul@105 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@105 | 19 | * Boston, MA 02110-1301, USA |
paul@105 | 20 | */ |
paul@105 | 21 | |
paul@105 | 22 | #include <systypes/fcntl.h> |
paul@105 | 23 | |
paul@105 | 24 | #include <stdio.h> |
paul@105 | 25 | |
paul@105 | 26 | #include <fsclient/client.h> |
paul@105 | 27 | |
paul@105 | 28 | #include <e2access/fs.h> |
paul@105 | 29 | |
paul@105 | 30 | |
paul@105 | 31 | |
paul@105 | 32 | int main(int argc, char *argv[]) |
paul@105 | 33 | { |
paul@105 | 34 | if (argc < 3) |
paul@105 | 35 | { |
paul@105 | 36 | printf("Need a device and filename.\n"); |
paul@105 | 37 | return 1; |
paul@105 | 38 | } |
paul@105 | 39 | |
paul@105 | 40 | /* Obtain device, filename and access parameters. */ |
paul@105 | 41 | |
paul@105 | 42 | char *device = argv[1]; |
paul@105 | 43 | char *filename = argv[2]; |
paul@105 | 44 | |
paul@105 | 45 | e2access_init(device); |
paul@105 | 46 | |
paul@105 | 47 | ext2_filsys fs = NULL; |
paul@105 | 48 | |
paul@105 | 49 | errcode_t retval = e2access_open(filename, EXT2_FLAG_RW, &fs); // EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_64BITS |
paul@105 | 50 | |
paul@105 | 51 | if (retval) |
paul@105 | 52 | { |
paul@105 | 53 | printf("Could not obtain filesystem: %ld.\n", retval); |
paul@105 | 54 | return 1; |
paul@105 | 55 | } |
paul@105 | 56 | |
paul@105 | 57 | printf("Access completed.\n"); |
paul@105 | 58 | |
paul@105 | 59 | return 0; |
paul@105 | 60 | } |
paul@105 | 61 | |
paul@105 | 62 | // vim: tabstop=2 expandtab shiftwidth=2 |