]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: Add ext2fs_file_get_inode_num call (for fuse2fs)
authorDarrick J. Wong <djwong@us.ibm.com>
Fri, 17 Feb 2012 14:56:33 +0000 (09:56 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Feb 2012 20:28:21 +0000 (15:28 -0500)
Add a function to return the inode number of an open file.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2fs.h
lib/ext2fs/fileio.c

index 7343090cda1161fa6457c73fea281a5f0db71d1a..68afdff2212de92c18d329d12b206a1b1a9c4a28 100644 (file)
@@ -1103,6 +1103,7 @@ 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 ext2_ino_t ext2fs_file_get_inode_num(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 8751635b5c9aa70c746cd8d0eb4e01cc83f80ce8..1f7002cdafb2340c9b77c5c5a2cab912e35ad71e 100644 (file)
@@ -106,6 +106,14 @@ struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file)
        return &file->inode;
 }
 
+/* This function returns the inode number from the structure */
+ext2_ino_t ext2fs_file_get_inode_num(ext2_file_t file)
+{
+       if (file->magic != EXT2_ET_MAGIC_EXT2_FILE)
+               return 0;
+       return file->ino;
+}
+
 /*
  * This function flushes the dirty block buffer out to disk if
  * necessary.