]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: Add new function ext2fs_file_get_inode()
authorRenzo Davoli <renzo@cs.unibo.it>
Sat, 10 Jul 2010 13:32:46 +0000 (15:32 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Jul 2010 13:40:25 +0000 (09:40 -0400)
This patch adds a very simple function:

struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);

which is useful for fuse-ext2 when it needs to read the inode of an
open file.

Signed-off-by: renzo davoli <renzo@cs.unibo.it>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2fs.h
lib/ext2fs/fileio.c

index f3531c08acc16d4dd69cd6cc5b69a9a7d18c10f6..96dc54ba773f4c9bc44595bc87f28468acc51456 100644 (file)
@@ -1014,6 +1014,7 @@ extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
 extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
                                  int flags, ext2_file_t *ret);
 extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
+struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);
 extern errcode_t ext2fs_file_close(ext2_file_t file);
 extern errcode_t ext2fs_file_flush(ext2_file_t file);
 extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
index 2a80d16d8d3a31dc88e0754a1f469c1dc3046d22..f3a4d706539efd2d1551ef5acf0ba8f6b814cea9 100644 (file)
@@ -95,6 +95,16 @@ ext2_filsys ext2fs_file_get_fs(ext2_file_t file)
        return file->fs;
 }
 
+/*
+ * This function returns the pointer to the inode of a file from the structure
+ */
+struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file)
+{
+       if (file->magic != EXT2_ET_MAGIC_EXT2_FILE)
+               return NULL;
+       return &file->inode;
+}
+
 /*
  * This function flushes the dirty block buffer out to disk if
  * necessary.