Access files from kernel

From: Kirill A. Shutemov
Date: Wed Oct 03 2012 - 15:47:58 EST


On Wed, Oct 03, 2012 at 09:38:52AM -0700, Linus Torvalds wrote:
>+static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name)
>+{
>+ int i;
>+ bool success = false;
>+ const char *fw_path[] = { "/lib/firmware/update", "/firmware", "/lib/firmware" };
>+ char *path = __getname();
>+
>+printk("Trying to load fw '%s' ", name);
>+ for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
>+ struct file *file;
>+ snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name);
>+
>+ file = filp_open(path, O_RDONLY, 0);

AFAIK, accessing files on filesystem form kernel directly was no-go for a
long time. What's the new rule here?

Is it worth to introduce an execption, if it's possible to solve the
problem in userspace.

--
Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/