From patchwork Sat Jan 7 08:55:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 134843 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 913B7B6F74 for ; Sat, 7 Jan 2012 19:55:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562Ab2AGIzj (ORCPT ); Sat, 7 Jan 2012 03:55:39 -0500 Received: from e2.ny.us.ibm.com ([32.97.182.142]:33033 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282Ab2AGIzd (ORCPT ); Sat, 7 Jan 2012 03:55:33 -0500 Received: from /spool/local by e2.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Jan 2012 03:55:32 -0500 Received: from d01relay02.pok.ibm.com (9.56.227.234) by e2.ny.us.ibm.com (192.168.1.102) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 7 Jan 2012 03:55:31 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q078tU69161972 for ; Sat, 7 Jan 2012 03:55:30 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q078tTU3022709 for ; Sat, 7 Jan 2012 06:55:30 -0200 Received: from elm3c44.beaverton.ibm.com (elm3c44.beaverton.ibm.com [9.47.69.44]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q078tTDO022685; Sat, 7 Jan 2012 06:55:29 -0200 Subject: [PATCH 1/2] libext2fs: Add ext2fs_file_get_inode_num call (for fuse2fs) To: Theodore Tso , "Darrick J. Wong" From: "Darrick J. Wong" Cc: linux-ext4@vger.kernel.org Date: Sat, 07 Jan 2012 00:55:29 -0800 Message-ID: <20120107085529.4325.17894.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20120107085523.4325.42183.stgit@elm3c44.beaverton.ibm.com> References: <20120107085523.4325.42183.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 x-cbid: 12010708-5112-0000-0000-000003CE60CC Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add a function to return the inode number of an open file. Signed-off-by: Darrick J. Wong --- lib/ext2fs/ext2fs.h | 1 + lib/ext2fs/fileio.c | 8 ++++++++ 2 files changed, 9 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index 227ee58..0b4b285 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -1094,6 +1094,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, diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c index 8751635..1f7002c 100644 --- a/lib/ext2fs/fileio.c +++ b/lib/ext2fs/fileio.c @@ -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.