Re: [PATCH] fs: Create anon_inode_getfile_fmode()

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

 



On 4/25/24 22:25, Al Viro wrote:
On Thu, Apr 25, 2024 at 11:57:12AM +0200, Christian Brauner wrote:
On Thu, Apr 25, 2024 at 01:38:59AM +0200, Dawid Osuchowski wrote:
Creates an anon_inode_getfile_fmode() function that works similarly to
anon_inode_getfile() with the addition of being able to set the fmode
member.

And for what use-case exactly?

There are several places where we might want that -
arch/powerpc/platforms/pseries/papr-vpd.c:488:  file = anon_inode_getfile("[papr-vpd]", &papr_vpd_handle_ops,
fs/cachefiles/ondemand.c:233:   file = anon_inode_getfile("[cachefiles]", &cachefiles_ondemand_fd_fops,
fs/eventfd.c:412:       file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, flags);
in addition to vfio example Dawid mentions, as well as a couple of
borderline cases in
virt/kvm/kvm_main.c:4404:       file = anon_inode_getfile(name, &kvm_vcpu_stats_fops, vcpu, O_RDONLY);
virt/kvm/kvm_main.c:5092:       file = anon_inode_getfile("kvm-vm-stats",

So something of that sort is probably a good idea.  Said that,
what the hell is __anon_inode_getfile_fmode() for?  It's identical
to exported variant, AFAICS.

Thank you for the feedback. I tried emulating what I saw in the other functions (which was clearly wrong). Will address this is in next revision.

 And then there's this:

	if (IS_ERR(file))
		goto err;

	file->f_mode |= f_mode;

	return file;

err:
	return file;

a really odd way to spell

	if (!IS_ERR(file))
		file->f_mode |= f_mode;
	return file;

Same for this, will rewrite it based on your suggestion.

-- Dawid





[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