paul@181 | 1 | /* |
paul@181 | 2 | * Filesystem image access functions. |
paul@181 | 3 | * |
paul@181 | 4 | * Copyright (C) 2019 Paul Boddie <paul@boddie.org.uk> |
paul@181 | 5 | * |
paul@181 | 6 | * This program is free software; you can redistribute it and/or |
paul@181 | 7 | * modify it under the terms of the GNU General Public License as |
paul@181 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@181 | 9 | * the License, or (at your option) any later version. |
paul@181 | 10 | * |
paul@181 | 11 | * This program is distributed in the hope that it will be useful, |
paul@181 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@181 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@181 | 14 | * GNU General Public License for more details. |
paul@181 | 15 | * |
paul@181 | 16 | * You should have received a copy of the GNU General Public License |
paul@181 | 17 | * along with this program; if not, write to the Free Software |
paul@181 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@181 | 19 | * Boston, MA 02110-1301, USA |
paul@181 | 20 | */ |
paul@181 | 21 | |
paul@181 | 22 | #ifndef __IMAGE_H__ |
paul@181 | 23 | #define __IMAGE_H__ |
paul@181 | 24 | |
paul@181 | 25 | #include <ext2fs/ext2fs.h> |
paul@181 | 26 | |
paul@181 | 27 | |
paul@181 | 28 | |
paul@181 | 29 | #ifdef __cplusplus |
paul@181 | 30 | extern "C" { |
paul@181 | 31 | #endif |
paul@181 | 32 | |
paul@181 | 33 | errcode_t image_create_file(ext2_filsys fs, ext2_ino_t ino_target, |
paul@181 | 34 | const char *basename, __u16 mode, |
paul@181 | 35 | __u16 uid, __u16 gid, ext2_ino_t *ino_file); |
paul@181 | 36 | |
paul@181 | 37 | errcode_t image_find_next(ext2_filsys fs, ext2_ino_t ino_dir, |
paul@181 | 38 | const char **basename, char *buf, ext2_ino_t *ino); |
paul@181 | 39 | |
paul@181 | 40 | errcode_t image_find_path(ext2_filsys fs, const char **pathname, |
paul@181 | 41 | ext2_ino_t *ino); |
paul@181 | 42 | |
paul@181 | 43 | errcode_t image_find_file(ext2_filsys fs, const char *dirname, |
paul@181 | 44 | const char *basename, ext2_ino_t *ino); |
paul@181 | 45 | |
paul@181 | 46 | errcode_t image_inode(ext2_filsys fs, const char *pathname, |
paul@181 | 47 | struct ext2_inode *inode); |
paul@181 | 48 | |
paul@181 | 49 | errcode_t image_make_dir(ext2_filsys fs, ext2_ino_t ino_dir, |
paul@181 | 50 | const char *basename, __u16 mode, |
paul@181 | 51 | __u16 uid, __u16 gid, ext2_ino_t *ino); |
paul@181 | 52 | |
paul@181 | 53 | errcode_t image_make_next_dir(ext2_filsys fs, ext2_ino_t ino_dir, |
paul@181 | 54 | const char **basename, __u16 mode, __u16 uid, |
paul@181 | 55 | __u16 gid, ext2_ino_t *ino); |
paul@181 | 56 | |
paul@181 | 57 | errcode_t image_make_dirs(ext2_filsys fs, const char **pathname, |
paul@181 | 58 | ext2_ino_t ino_dir, __u16 mode, __u16 uid, |
paul@181 | 59 | __u16 gid); |
paul@181 | 60 | |
paul@181 | 61 | void image_set_metadata(struct ext2_inode *inode, int clean, __u16 mode, |
paul@181 | 62 | __u16 uid, __u16 gid); |
paul@181 | 63 | |
paul@181 | 64 | errcode_t image_stat_inode(ext2_filsys fs, ext2_ino_t ino, struct stat *st); |
paul@181 | 65 | |
paul@181 | 66 | int _image_isdir(ext2_filsys fs, ext2_ino_t ino); |
paul@181 | 67 | |
paul@181 | 68 | int image_isdir(ext2_filsys fs, const char *name); |
paul@181 | 69 | |
paul@181 | 70 | int _image_isfile(ext2_filsys fs, ext2_ino_t ino); |
paul@181 | 71 | |
paul@181 | 72 | int image_isfile(ext2_filsys fs, const char *name); |
paul@181 | 73 | |
paul@181 | 74 | #ifdef __cplusplus |
paul@181 | 75 | } |
paul@181 | 76 | #endif |
paul@181 | 77 | |
paul@181 | 78 | |
paul@181 | 79 | #endif /* __IMAGE_H__ */ |