lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 15 May 2017 20:57:30 +0200
From:   Fabian Frederick <fabf@...net.be>
To:     Alexander Viro <viro@...iv.linux.org.uk>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        fabf@...net.be
Subject: [PATCH 3/3 linux-next] fs/affs: stat: return block number

stat <filename> doesn't give any block number
as it's filesystem specific. Add getattr wrapper to return
i_blkcnt calculated during affs_iget()

Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 fs/affs/affs.h  |  2 ++
 fs/affs/file.c  |  1 +
 fs/affs/inode.c | 11 +++++++++++
 3 files changed, 14 insertions(+)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index fd99f28..a2151e9 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -180,6 +180,8 @@ extern int	affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
 /* inode.c */
 
 extern struct inode *affs_new_inode(struct inode *dir);
+extern int	affs_getattr(const struct path *path, struct kstat *stat,
+			     u32 request_mask, unsigned int flags);
 extern int	affs_notify_change(struct dentry *dentry, struct iattr *attr);
 extern void	affs_evict_inode(struct inode *inode);
 extern struct inode *affs_iget(struct super_block *sb, unsigned long ino);
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 196ee7f..b331abb 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -979,4 +979,5 @@ const struct file_operations affs_file_operations = {
 
 const struct inode_operations affs_file_inode_operations = {
 	.setattr	= affs_notify_change,
+	.getattr	= affs_getattr,
 };
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index fd4ef3c..76fb281 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -214,6 +214,17 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	return 0;
 }
 
+int affs_getattr(const struct path *path, struct kstat *stat,
+		 u32 request_mask, unsigned int flags)
+{
+	struct inode *inode = d_inode(path->dentry);
+
+	generic_fillattr(inode, stat);
+	stat->blocks = AFFS_I(inode)->i_blkcnt;
+
+	return 0;
+}
+
 int
 affs_notify_change(struct dentry *dentry, struct iattr *attr)
 {
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ