Re: request_firmware() example ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 13, 2004 at 03:42:08AM +0900, aq wrote:
> > > >From what I read in the mailing list, the principle of "never doing
> > > this or that from inside the kernel" is repeated thousand times a day.
> > > We highly appreciate the tireless education of gurus in the list to
> > > the newbies like us ;-)
> > >
> > > For example, to read/write to file from kernelspace is always
> > > undesired. And there is a solution I got from the list: to use
> > > request_firmware() instead.
> > >
> > > But how to use request_firmware() for that trick (to read/write to
> > > file)? Is that encouraged/usual solution? I looked for some examples
> > > about the technique, but to no avail.
> > 
> > request_firmware() is for a specific case of loading data that hardware
> > devices need to operate.
> > 
> > For different things you want different solutions.
> > 
> > If you just want to load or save a configuration, you probably want to
> > talk to a user-space process instead. You can use proc file, device or
> > netlink socket for that. You can even start the process with
> > call_usermodehelper() if there is no suitable process waiting on your
> > proc-file/device/netlink-socket.
> > 
> > The reason is, that the user-mode helper can then implement various
> > policies without modifying the kernel. Eg. there might be no writable
> > filesystem, but the helper can send the data to a server. If you
> > insisted on writing to a file, it would be a problem.
> 
> OK, let me show an example. I just supposed somehow I modify the ELF
> loader (by patching the kernel), and I want the new loader, after
> loading the executable into memory, to write the memory process to
> somewhere on the disk. How can I do this, if I cannot use read/write
> syscall from inside the kernel?
> 
> I am sorry if the above example is silly. I just suppose it is the
> case to clarify my confusion ;-)

It is a silly example :)

Don't be writing anything from the kernel to a disk file.
request_firmware() is for requesting firmware to be downloaded to a
device (as the documentation says...)  It has nothing to do with writing
a file.

good luck,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux