Messages in this thread | | | Date | Wed, 3 Oct 2012 22:48:39 +0300 | From | "Kirill A. Shutemov" <> | 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
| |