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  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, 10 Aug 2020 10:08:56 +0800
From:   Libing Zhou <libing.zhou@...ia-sbell.com>
To:     viro@...iv.linux.org.uk, dhowells@...hat.com
Cc:     libing.zhou@...ia-sbell.com, darrick.wong@...cle.com,
        deepa.kernel@...il.com, linux-kernel@...r.kernel.org
Subject: [PATCH] ROMFS: support inode blocks calculation

When use 'stat' tool to display file status, the 'Blocks' field
always in '0', this is not good for tool 'du'(e.g.: busybox 'du'),
it always output '0' size for the files under ROMFS since such
tool calculates number of 512B Blocks.

This patch calculates approx. number of 512B blocks based on inode
size.

Signed-off-by: Libing Zhou <libing.zhou@...ia-sbell.com>
---
 fs/romfs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index e582d001f792..b1b7d3f5752f 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -356,6 +356,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
 	}
 
 	i->i_mode = mode;
+	i->i_blocks = (i->i_size + 511) >> 9;
 
 	unlock_new_inode(i);
 	return i;
-- 
2.22.0

Powered by blists - more mailing lists