Al Viro
e036efbe58
add a string-to-qstr constructor
...
[ Upstream commit c1feab95e0b2e9fce7e4f4b2739baf40d84543af ]
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: cbe4134ea4bc ("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
..
2024-09-09 09:41:47 -04:00
2024-08-08 15:14:02 -04:00
2024-10-04 20:25:32 -04:00
2024-10-18 00:49:48 -04:00
2024-10-24 17:41:43 -04:00
2024-10-29 06:34:10 -04:00
2024-09-21 11:35:20 -04:00
2024-05-08 17:29:24 -04:00
2024-11-11 00:37:19 -05:00
2024-09-21 11:39:49 -04:00
2024-03-13 21:22:24 -04:00
2024-10-09 16:42:51 -04:00
2024-07-14 19:00:15 -04:00
2024-10-29 06:34:10 -04:00
2024-09-27 21:46:35 -04:00
2024-09-27 21:46:35 -04:00
2024-05-08 14:56:09 -04:00
2024-05-08 14:56:09 -04:00
2024-03-13 21:22:26 -04:00
2024-11-07 16:48:20 -05:00
2024-09-27 21:46:35 -04:00
2024-10-02 17:23:23 -04:00
2024-09-09 09:41:49 -04:00
2024-11-07 16:48:21 -05:00
2024-11-07 16:48:21 -05:00
2024-07-14 19:00:15 -04:00
2024-11-11 00:37:18 -05:00
2024-07-14 19:00:15 -04:00
2024-11-08 14:07:11 -05:00
2024-09-21 11:39:48 -04:00
2024-10-29 06:34:11 -04:00
2024-10-18 00:49:48 -04:00
2024-09-09 09:41:46 -04:00
2024-07-14 19:00:13 -04:00
2024-09-09 09:41:47 -04:00
2024-09-21 11:39:46 -04:00
2024-08-13 23:00:34 -04:00
2024-07-14 19:59:12 -04:00
2024-09-09 09:41:49 -04:00
2024-07-14 19:00:16 -04:00
2024-11-07 16:48:17 -05:00
2024-04-03 14:44:18 -04:00
2024-10-02 21:37:42 -04:00
2024-09-21 11:39:48 -04:00
2024-11-11 00:37:18 -05:00
2024-09-09 09:41:49 -04:00
2024-10-18 00:49:48 -04:00
2024-10-18 00:49:48 -04:00
2024-07-14 19:00:14 -04:00
2024-11-07 23:31:11 -05:00
2024-11-07 23:31:11 -05:00
2024-09-09 09:41:49 -04:00
2024-08-18 20:41:50 -04:00
2024-10-18 00:49:48 -04:00
2024-11-07 16:48:17 -05:00
2024-10-18 00:49:48 -04:00
2024-09-21 11:35:20 -04:00
2024-04-13 22:48:17 -04:00
2024-07-21 17:56:22 -07:00
2024-07-21 17:56:22 -07:00
2024-09-09 09:41:48 -04:00
2024-03-13 18:39:12 -04:00
2024-04-13 22:48:17 -04:00
2024-10-20 16:50:14 -04:00
2024-09-09 09:41:49 -04:00
2024-10-29 06:34:10 -04:00
2024-10-29 06:34:10 -04:00
2024-08-13 22:56:50 -04:00
2024-01-21 13:27:10 -05:00
2024-10-18 00:49:48 -04:00
2024-10-18 00:49:48 -04:00
2024-08-13 23:00:50 -04:00
2024-09-27 21:46:35 -04:00
2024-10-18 00:49:48 -04:00
2024-09-27 21:46:35 -04:00
2024-05-28 17:32:03 -04:00
2024-07-14 19:00:12 -04:00
2024-09-21 11:39:48 -04:00
2024-09-21 11:39:48 -04:00
2024-10-29 06:34:10 -04:00
2024-09-21 11:39:49 -04:00
2024-03-13 21:22:25 -04:00
2024-11-07 16:48:21 -05:00
2024-10-20 16:50:14 -04:00
2024-10-04 20:25:31 -04:00
2024-05-08 17:29:18 -04:00
2024-01-21 13:27:11 -05:00
2024-11-12 03:46:57 -05:00
2024-10-29 06:34:10 -04:00
2024-05-08 17:29:18 -04:00
2024-07-14 19:00:15 -04:00
2024-03-13 18:39:12 -04:00
2024-09-21 11:35:20 -04:00
2024-07-14 19:00:12 -04:00
2024-10-18 00:49:48 -04:00
2024-08-07 11:33:21 +02:00
2024-10-13 17:55:33 -04:00
2024-10-18 00:49:48 -04:00
2024-09-09 09:41:49 -04:00
2024-10-29 06:34:10 -04:00
2025-04-07 10:08:37 +02:00
2023-11-05 13:12:18 -05:00
2024-10-24 12:38:59 -07:00
2024-10-09 16:42:53 -04:00
2025-07-10 16:05:08 +02:00
2024-10-06 03:03:45 -04:00
2024-10-18 00:49:48 -04:00
2024-10-24 12:38:59 -07:00
2024-10-18 00:49:48 -04:00
2024-10-18 00:49:48 -04:00
2024-11-07 16:48:21 -05:00
2024-05-08 17:29:24 -04:00
2024-11-07 16:48:17 -05:00
2024-07-14 19:59:12 -04:00
2024-11-12 03:46:57 -05:00
2024-05-09 16:23:36 -04:00
2024-09-21 11:39:48 -04:00
2024-01-01 11:47:41 -05:00
2024-08-22 02:07:23 -04:00
2024-05-28 17:32:03 -04:00
2024-06-25 17:53:31 -04:00
2024-05-08 17:29:20 -04:00
2024-05-08 17:29:22 -04:00
2024-10-20 16:50:14 -04:00
2024-10-20 16:50:14 -04:00
2024-09-09 09:41:48 -04:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:43 -05:00
2024-01-21 13:27:11 -05:00
2024-10-04 20:25:32 -04:00
2024-10-04 20:25:32 -04:00
2024-07-14 19:00:16 -04:00
2024-10-04 20:25:32 -04:00
2024-08-13 23:00:50 -04:00
2024-09-09 09:41:47 -04:00
2024-05-28 11:29:26 -04:00
2024-03-13 21:37:58 -04:00
2024-07-18 18:33:30 -04:00
2024-05-08 17:29:18 -04:00
2024-10-29 06:34:10 -04:00
2024-01-01 11:47:39 -05:00
2024-10-04 20:25:32 -04:00
2024-11-07 16:48:21 -05:00
2024-10-18 00:49:48 -04:00
2024-07-14 19:00:12 -04:00
2024-07-14 19:00:12 -04:00
2024-01-21 13:27:10 -05:00
2024-10-18 00:49:48 -04:00
2024-08-13 23:00:50 -04:00
2024-09-09 09:41:47 -04:00
2024-09-09 09:41:47 -04:00
2024-10-18 00:49:48 -04:00
2024-11-08 14:07:12 -05:00
2024-11-08 14:07:12 -05:00
2024-03-31 20:36:12 -04:00
2025-07-10 16:05:08 +02:00
2024-04-03 14:46:51 -04:00
2024-01-21 13:27:11 -05:00
2024-09-27 21:46:35 -04:00
2024-08-13 23:00:50 -04:00
2024-09-09 09:41:49 -04:00
2024-07-14 19:00:13 -04:00
2024-10-11 22:20:51 -04:00
2024-09-27 21:46:35 -04:00
2024-09-27 21:46:34 -04:00
2024-01-21 13:27:10 -05:00
2024-05-09 16:23:36 -04:00
2024-01-21 13:27:10 -05:00
2024-05-28 17:32:03 -04:00
2024-10-25 13:17:06 -04:00
2024-07-14 19:00:12 -04:00
2024-11-08 00:05:53 -05:00
2024-05-28 17:33:45 -04:00
2024-09-27 21:46:35 -04:00
2024-09-27 21:46:35 -04:00
2024-11-07 23:31:11 -05:00
2024-05-08 17:29:19 -04:00
2024-11-07 23:31:11 -05:00
2024-09-21 11:39:48 -04:00
2024-06-23 00:57:21 -04:00
2024-10-02 17:23:23 -04:00
2024-09-29 09:17:44 -07:00
2024-01-01 11:47:40 -05:00
2024-01-21 13:27:10 -05:00
2024-10-12 05:02:48 -04:00
2024-10-09 16:42:53 -04:00
2024-10-18 00:49:48 -04:00
2024-03-13 21:22:24 -04:00
2024-09-09 09:41:47 -04:00
2024-10-18 00:49:48 -04:00
2024-10-04 20:25:32 -04:00
2024-05-08 17:29:19 -04:00
2024-10-24 17:41:43 -04:00
2024-05-09 16:23:36 -04:00
2024-11-07 23:31:11 -05:00
2024-01-01 11:47:38 -05:00
2024-09-21 11:39:48 -04:00
2024-11-07 16:48:21 -05:00
2024-07-14 19:00:14 -04:00
2024-09-27 08:18:43 -07:00
2024-07-14 19:00:14 -04:00
2024-09-09 09:41:49 -04:00
2024-09-09 09:41:49 -04:00
2024-08-13 23:00:34 -04:00
2024-09-09 09:41:48 -04:00
2024-07-14 19:00:12 -04:00
2024-10-01 17:20:24 -04:00
2025-07-10 16:05:08 +02:00
2024-10-02 17:23:23 -04:00
2024-01-01 11:47:42 -05:00
2025-05-09 09:50:49 +02:00
2024-10-18 00:49:48 -04:00
2024-08-13 23:00:50 -04:00