[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121003194819.GA2490@shutemov.name>
Date: Wed, 3 Oct 2012 22:48:39 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Mauro Carvalho Chehab <mchehab@...hat.com>,
Ming Lei <ming.lei@...onical.com>,
Greg KH <gregkh@...uxfoundation.org>,
Kay Sievers <kay@...y.org>,
Lennart Poettering <lennart@...ttering.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kay Sievers <kay@...hat.com>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
Michael Krufky <mkrufky@...uxtv.org>,
Ivan Kalvachev <ikalvachev@...il.com>
Subject: Access files from kernel
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists