Re: [PATCH 1/2] init: split get_fs_names

From: Al Viro
Date: Mon Jun 21 2021 - 10:51:29 EST


On Mon, Jun 21, 2021 at 02:46:37PM +0000, Al Viro wrote:

> int __init get_filesystem_list(char *buf, bool is_dev)
> {
> int f = is_dev ? FS_REQUIRES_DEV : 0;
> int left = PAGE_SIZE, count = 0;
> struct file_system_type *p;
>
> read_lock(&file_systems_lock);
> for (p = file_systems; p; p = p->next) {
> if ((p->fs_flags & FS_REQUIRES_DEV) == f) {
> size_t len = strlen(p->name) + 1;
> if (len > left)
> break;
> memcpy(buf, p->name, len);
> buf += len;
> left -= len;
> count++;
> }
> }
> read_unlock(&file_systems_lock);
> return count;
> }
>
> Generates NUL-separated list, returns the number of list elements,
> the second argument is "what kind do you want"...

Actually, looking at the rest of the queue, that's only used for
!nodev ones, so might as well drop the flag here...