Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859Ab2JCTsH (ORCPT ); Wed, 3 Oct 2012 15:48:07 -0400 Received: from shutemov.name ([176.9.204.213]:59706 "EHLO shutemov.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752363Ab2JCTsF convert rfc822-to-8bit (ORCPT ); Wed, 3 Oct 2012 15:48:05 -0400 Date: Wed, 3 Oct 2012 22:48:39 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds Cc: Mauro Carvalho Chehab , Ming Lei , Greg KH , Kay Sievers , Lennart Poettering , Linux Kernel Mailing List , Kay Sievers , Linux Media Mailing List , Michael Krufky , Ivan Kalvachev Subject: Access files from kernel Message-ID: <20121003194819.GA2490@shutemov.name> References: <4FE8CED5.104@redhat.com> <20120625223306.GA2764@kroah.com> <4FE9169D.5020300@redhat.com> <20121002100319.59146693@redhat.com> <20121002221239.GA30990@kroah.com> <20121002222333.GA32207@kroah.com> <506C562E.5090909@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 988 Lines: 28 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/