mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
kernfs: simplify kernfs_name_hash()
In 'kernfs_name_hash()', 'name' is NUL-terminated so it may be directly scanned up to end without an extra call to 'strlen()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Link: https://patch.msgid.link/20260617073941.472337-1-dmantipov@yandex.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
32e21e9509
commit
d996995a0f
|
|
@ -330,8 +330,8 @@ static unsigned int kernfs_name_hash(const char *name,
|
|||
const struct ns_common *ns)
|
||||
{
|
||||
unsigned long hash = init_name_hash(kernfs_ns_id(ns));
|
||||
unsigned int len = strlen(name);
|
||||
while (len--)
|
||||
|
||||
while (*name)
|
||||
hash = partial_name_hash(*name++, hash);
|
||||
hash = end_name_hash(hash);
|
||||
hash &= 0x7fffffffU;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user