[PATCH] debufgs: debugfs_create_blob can set the file size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



debugfs_create_blob() is given the size of the blob, so use it to
also set the size of the dentry.  For example, efi=debug previously
showed

-r-------- 1 root root 0 Feb  7 13:30 boot_services_code0
-r-------- 1 root root 0 Feb  7 13:30 boot_services_code1
-r-------- 1 root root 0 Feb  7 13:30 boot_services_data0
-r-------- 1 root root 0 Feb  7 13:30 boot_services_data1
-r-------- 1 root root 0 Feb  7 13:30 boot_services_data2
-r-------- 1 root root 0 Feb  7 13:30 boot_services_data3
-r-------- 1 root root 0 Feb  7 13:30 boot_services_data4

but with this patch it shows

-r-------- 1 root root  12783616 Feb  7 13:26 boot_services_code0
-r-------- 1 root root    262144 Feb  7 13:26 boot_services_code1
-r-------- 1 root root  41705472 Feb  7 13:26 boot_services_data0
-r-------- 1 root root  23187456 Feb  7 13:26 boot_services_data1
-r-------- 1 root root 110645248 Feb  7 13:26 boot_services_data2
-r-------- 1 root root   1048576 Feb  7 13:26 boot_services_data3
-r-------- 1 root root      4096 Feb  7 13:26 boot_services_data4

Signed-off-by: Timur Tabi <ttabi@xxxxxxxxxx>
---
 fs/debugfs/file.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index c6f4a9a98b85..d97800603a8f 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -1152,7 +1152,14 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
 				   struct dentry *parent,
 				   struct debugfs_blob_wrapper *blob)
 {
-	return debugfs_create_file_unsafe(name, mode & 0644, parent, blob, &fops_blob);
+	struct dentry *dentry;
+
+	dentry = debugfs_create_file_unsafe(name, mode & 0644, parent, blob, &fops_blob);
+	if (!IS_ERR(dentry))
+		d_inode(dentry)->i_size = blob->size;
+
+	return dentry;
+
 }
 EXPORT_SYMBOL_GPL(debugfs_create_blob);
 
-- 
2.34.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux