summaryrefslogtreecommitdiff
path: root/src/ext4.c
diff options
context:
space:
mode:
authorgkostka <kostka.grzegorz@gmail.com>2017-04-19 20:47:14 +0200
committergkostka <kostka.grzegorz@gmail.com>2017-04-19 20:47:14 +0200
commitc8978f9dba53333004f3f20e5acc57df8867dc16 (patch)
tree3245d618c1fccc84e2629da7a357f3f455357136 /src/ext4.c
parent2a4f69fbabf98920717366cd574f0d4aba1aa3a1 (diff)
ext4: add ext4_inode_exist method
Diffstat (limited to 'src/ext4.c')
-rw-r--r--src/ext4.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ext4.c b/src/ext4.c
index 6a8fa10..98f3e09 100644
--- a/src/ext4.c
+++ b/src/ext4.c
@@ -2110,6 +2110,22 @@ int ext4_raw_inode_fill(const char *path, uint32_t *ret_ino,
return r;
}
+int ext4_inode_exist(const char *path, int type)
+{
+ int r;
+ ext4_file f;
+ struct ext4_mountpoint *mp = ext4_get_mount(path);
+
+ if (!mp)
+ return ENOENT;
+
+ EXT4_MP_LOCK(mp);
+ r = ext4_generic_open2(&f, path, O_RDONLY, type, NULL, NULL);
+ EXT4_MP_UNLOCK(mp);
+
+ return r;
+}
+
int ext4_mode_set(const char *path, uint32_t mode)
{
int r;