1 /* 2 * Operations and their invocation. 3 * 4 * Copyright (C) 2022 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 #pragma once 23 24 #include <ext2fs/ext2fs.h> 25 26 /* Invocation support. */ 27 28 enum op_results 29 { 30 OP_SUCCESS = 0, 31 OP_FAILED = 1, 32 OP_UNKNOWN = 2, 33 }; 34 35 int handle_op_result(const char *operation, enum op_results op_result); 36 enum op_results run_operation(ext2_filsys fs, const char *operation, int argc, char *argv[]); 37 38 /* Operations exposed by the program. */ 39 40 typedef int (*op_sig)(ext2_filsys, int, char *[]); 41 42 struct operation 43 { 44 const char *name; 45 op_sig fn; 46 }; 47 48 int copy_in(ext2_filsys fs, int argc, char *argv[]); 49 int copy_out(ext2_filsys fs, int argc, char *argv[]); 50 int list(ext2_filsys fs, int argc, char *argv[]); 51 int make_dirs(ext2_filsys fs, int argc, char *argv[]); 52 int remove_dirs(ext2_filsys fs, int argc, char *argv[]); 53 int remove_non_dirs(ext2_filsys fs, int argc, char *argv[]); 54 int run_script(ext2_filsys fs, int argc, char *argv[]); 55 int stat_objects(ext2_filsys fs, int argc, char *argv[]); 56 57 /* vim: tabstop=4 expandtab shiftwidth=4 58 */