linux-stable/fs/bcachefs
Al Viro e036efbe58 add a string-to-qstr constructor
[ Upstream commit c1feab95e0 ]

Quite a few places want to build a struct qstr by given string;
it would be convenient to have a primitive doing that, rather
than open-coding it via QSTR_INIT().

The closest approximation was in bcachefs, but that expands to
initializer list - {.len = strlen(string), .name = string}.
It would be more useful to have it as compound literal -
(struct qstr){.len = strlen(string), .name = string}.

Unlike initializer list it's a valid expression.  What's more,
it's a valid lvalue - it's an equivalent of anonymous local
variable with such initializer, so the things like
	path->dentry = d_alloc_pseudo(mnt->mnt_sb, &QSTR(name));
are valid.  It can also be used as initializer, with identical
effect -
	struct qstr x = (struct qstr){.name = s, .len = strlen(s)};
is equivalent to
	struct qstr anon_variable = {.name = s, .len = strlen(s)};
	struct qstr x = anon_variable;
	// anon_variable is never used after that point
and any even remotely sane compiler will manage to collapse that
into
	struct qstr x = {.name = s, .len = strlen(s)};

What compound literals can't be used for is initialization of
global variables, but those are covered by QSTR_INIT().

This commit lifts definition(s) of QSTR() into linux/dcache.h,
converts it to compound literal (all bcachefs users are fine
with that) and converts assorted open-coded instances to using
that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Stable-dep-of: cbe4134ea4 ("fs: export anon_inode_make_secure_inode() and fix secretmem LSM bypass")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-10 16:05:08 +02:00
..
acl.c
acl.h
alloc_background_format.h
alloc_background.c
alloc_background.h
alloc_foreground.c
alloc_foreground.h
alloc_types.h
backpointers.c bcachefs: Allow for unknown key types in backpointers fsck 2024-11-11 00:37:19 -05:00
backpointers.h
bbpos_types.h
bbpos.h
bcachefs_format.h
bcachefs_ioctl.h
bcachefs.h
bkey_buf.h
bkey_cmp.h
bkey_methods.c
bkey_methods.h
bkey_sort.c
bkey_sort.h
bkey_types.h
bkey.c bcachefs: Ancient versions with bad bkey_formats are no longer supported 2024-11-07 16:48:20 -05:00
bkey.h
bset.c
bset.h
btree_cache.c bcachefs: btree_cache.freeable list fixes 2024-11-07 16:48:21 -05:00
btree_cache.h bcachefs: btree_cache.freeable list fixes 2024-11-07 16:48:21 -05:00
btree_gc_types.h
btree_gc.c bcachefs: Fix assertion pop in topology repair 2024-11-11 00:37:18 -05:00
btree_gc.h
btree_io.c bcachefs: Fix validate_bset() repair path 2024-11-08 14:07:11 -05:00
btree_io.h
btree_iter.c
btree_iter.h
btree_journal_iter.c
btree_journal_iter.h
btree_key_cache_types.h
btree_key_cache.c
btree_key_cache.h
btree_locking.c
btree_locking.h
btree_node_scan_types.h
btree_node_scan.c
btree_node_scan.h
btree_trans_commit.c
btree_types.h
btree_update_interior.c bcachefs: Fix assertion pop in topology repair 2024-11-11 00:37:18 -05:00
btree_update_interior.h
btree_update.c
btree_update.h
btree_write_buffer_types.h
btree_write_buffer.c bcachefs: bch2_btree_write_buffer_flush_going_ro() 2024-11-07 23:31:11 -05:00
btree_write_buffer.h bcachefs: bch2_btree_write_buffer_flush_going_ro() 2024-11-07 23:31:11 -05:00
buckets_types.h
buckets_waiting_for_journal_types.h
buckets_waiting_for_journal.c
buckets_waiting_for_journal.h
buckets.c
buckets.h
chardev.c
chardev.h
checksum.c
checksum.h
clock_types.h
clock.c
clock.h
compress.c
compress.h
darray.c
darray.h
data_update.c
data_update.h
debug.c
debug.h
dirent_format.h
dirent.c
dirent.h
disk_accounting_format.h
disk_accounting_types.h
disk_accounting.c
disk_accounting.h
disk_groups_format.h
disk_groups_types.h
disk_groups.c
disk_groups.h
ec_format.h
ec_types.h
ec.c
ec.h
errcode.c
errcode.h bcachefs: add check NULL return of bio_kmalloc in journal_read_bucket 2024-11-07 16:48:21 -05:00
error.c
error.h
extent_update.c
extent_update.h
extents_format.h
extents_types.h
extents.c bcachefs: Fix assertion pop in bch2_ptr_swab() 2024-11-12 03:46:57 -05:00
extents.h
eytzinger.c
eytzinger.h
fifo.h
fs-common.c
fs-common.h
fs-io-buffered.c
fs-io-buffered.h
fs-io-direct.c
fs-io-direct.h
fs-io-pagecache.c
fs-io-pagecache.h
fs-io.c
fs-io.h
fs-ioctl.c bcachefs: bch2_ioctl_subvolume_destroy() fixes 2025-04-07 10:08:37 +02:00
fs-ioctl.h
fs.c
fs.h
fsck.c add a string-to-qstr constructor 2025-07-10 16:05:08 +02:00
fsck.h
inode_format.h
inode.c
inode.h
io_misc.c
io_misc.h
io_read.c bcachefs: Fix UAF in __promote_alloc() error path 2024-11-07 16:48:21 -05:00
io_read.h
io_write_types.h
io_write.c
io_write.h
journal_io.c bcachefs: Fix journal_entry_dev_usage_to_text() overrun 2024-11-12 03:46:57 -05:00
journal_io.h
journal_reclaim.c
journal_reclaim.h
journal_sb.c
journal_sb.h
journal_seq_blacklist_format.h
journal_seq_blacklist.c
journal_seq_blacklist.h
journal_types.h
journal.c
journal.h
Kconfig
keylist_types.h
keylist.c
keylist.h
logged_ops_format.h
logged_ops.c
logged_ops.h
lru_format.h
lru.c
lru.h
Makefile
mean_and_variance_test.c
mean_and_variance.c
mean_and_variance.h
migrate.c
migrate.h
move_types.h
move.c
move.h
movinggc.c
movinggc.h
nocow_locking_types.h
nocow_locking.c
nocow_locking.h
opts.c bcachefs: Change OPT_STR max to be 1 less than the size of choices array 2024-11-07 16:48:21 -05:00
opts.h
printbuf.c
printbuf.h
quota_format.h
quota_types.h
quota.c
quota.h
rcu_pending.c
rcu_pending.h
rebalance_types.h
rebalance.c
rebalance.h
recovery_passes_types.h bcachefs: Fix hidden btree errors when reading roots 2024-11-08 14:07:12 -05:00
recovery_passes.c bcachefs: Fix hidden btree errors when reading roots 2024-11-08 14:07:12 -05:00
recovery_passes.h
recovery.c add a string-to-qstr constructor 2025-07-10 16:05:08 +02:00
recovery.h
reflink_format.h
reflink.c
reflink.h
replicas_format.h
replicas_types.h
replicas.c
replicas.h
sb-clean.c
sb-clean.h
sb-counters_format.h
sb-counters.c
sb-counters.h
sb-downgrade_format.h
sb-downgrade.c
sb-downgrade.h
sb-errors_format.h bcachefs: Fix missing validation for bch_backpointer.level 2024-11-08 00:05:53 -05:00
sb-errors_types.h
sb-errors.c
sb-errors.h
sb-members_format.h bcachefs: Fix bch_member.btree_bitmap_shift validation 2024-11-07 23:31:11 -05:00
sb-members_types.h
sb-members.c bcachefs: Fix bch_member.btree_bitmap_shift validation 2024-11-07 23:31:11 -05:00
sb-members.h
seqmutex.h
siphash.c
siphash.h
six.c
six.h
snapshot_format.h
snapshot.c
snapshot.h
str_hash.h
subvolume_format.h
subvolume_types.h
subvolume.c
subvolume.h
super_types.h
super-io.c
super-io.h
super.c bcachefs: bch2_btree_write_buffer_flush_going_ro() 2024-11-07 23:31:11 -05:00
super.h
sysfs.c
sysfs.h
tests.c bcachefs: check the invalid parameter for perf test 2024-11-07 16:48:21 -05:00
tests.h
thread_with_file_types.h
thread_with_file.c
thread_with_file.h
time_stats.c
time_stats.h
trace.c
trace.h
two_state_shared_lock.c
two_state_shared_lock.h
util.c
util.h add a string-to-qstr constructor 2025-07-10 16:05:08 +02:00
varint.c
varint.h
vstructs.h
xattr_format.h bcachefs: Remove incorrect __counted_by annotation 2025-05-09 09:50:49 +02:00
xattr.c
xattr.h