Re: [PATCH] debufgs: debugfs_create_blob can set the file size

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

 



On Thu, 2024-02-08 at 09:06 +1100, Dave Chinner wrote:
> So fix the debugfs_create_file_*() functions to pass a length
> and that way you fix all the "debugfs files have zero length but
> still have data that can be read" problems for everyone? Then the
> zero length problem can be isolated to just the debug objects that don't
> know their size (i.e. are streams of data, not fixed size).
> 
> IMO, it doesn't help anyone to have one part of the debugfs
> blob/file API to set inode->i_size correctly, but then leave the
> majority of the users still behaving the problematic way (i.e. zero
> size yet with data that can be read). It's just a recipe for
> confusion....

I don't disagree, but that's a much more ambitious change than I am prepared
to make.  

debugfs_create_file_size() already exists, it's just that
debugfs_create_blob() doesn't use it.  I think the problem is that the file
size is not always known, or at least not always the fixed, so setting the
initial file size isn't always an option.

On a side note, debugfs_create_file_size() does the same thing that my v1
patch does:

struct dentry *de = debugfs_create_file(name, mode, parent, data, fops);
if (!IS_ERR(de))
	d_inode(de)->i_size = file_size;

Shouldn't this function also use i_size_write()?





[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