paul@278 | 1 | /* |
paul@279 | 2 | * Operations and their invocation. |
paul@278 | 3 | * |
paul@278 | 4 | * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk> |
paul@278 | 5 | * |
paul@278 | 6 | * This program is free software; you can redistribute it and/or |
paul@278 | 7 | * modify it under the terms of the GNU General Public License as |
paul@278 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@278 | 9 | * the License, or (at your option) any later version. |
paul@278 | 10 | * |
paul@278 | 11 | * This program is distributed in the hope that it will be useful, |
paul@278 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@278 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@278 | 14 | * GNU General Public License for more details. |
paul@278 | 15 | * |
paul@278 | 16 | * You should have received a copy of the GNU General Public License |
paul@278 | 17 | * along with this program; if not, write to the Free Software |
paul@278 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@278 | 19 | * Boston, MA 02110-1301, USA |
paul@278 | 20 | */ |
paul@278 | 21 | |
paul@278 | 22 | #pragma once |
paul@278 | 23 | |
paul@279 | 24 | #include <ext2fs/ext2fs.h> |
paul@279 | 25 | |
paul@279 | 26 | /* Invocation support. */ |
paul@279 | 27 | |
paul@279 | 28 | enum op_results |
paul@279 | 29 | { |
paul@279 | 30 | OP_SUCCESS = 0, |
paul@279 | 31 | OP_FAILED = 1, |
paul@279 | 32 | OP_UNKNOWN = 2, |
paul@279 | 33 | }; |
paul@279 | 34 | |
paul@279 | 35 | int handle_op_result(const char *operation, enum op_results op_result); |
paul@279 | 36 | enum op_results run_operation(ext2_filsys fs, const char *operation, int argc, char *argv[]); |
paul@279 | 37 | |
paul@279 | 38 | /* Operations exposed by the program. */ |
paul@279 | 39 | |
paul@279 | 40 | typedef int (*op_sig)(ext2_filsys, int, char *[]); |
paul@279 | 41 | |
paul@279 | 42 | struct operation |
paul@279 | 43 | { |
paul@279 | 44 | const char *name; |
paul@279 | 45 | op_sig fn; |
paul@279 | 46 | }; |
paul@279 | 47 | |
paul@278 | 48 | int copy_in(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 49 | int copy_out(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 50 | int list(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 51 | int make_dirs(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 52 | int remove_dirs(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 53 | int remove_non_dirs(ext2_filsys fs, int argc, char *argv[]); |
paul@279 | 54 | int run_script(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 55 | int stat_objects(ext2_filsys fs, int argc, char *argv[]); |
paul@278 | 56 | |
paul@278 | 57 | /* vim: tabstop=4 expandtab shiftwidth=4 |
paul@278 | 58 | */ |