linux - File read(i.e. using vfs_read()) from LKM init_module() -


i read files lkm "initialization" function can config lkm configuration files.

i'm wondering if not practice read files initialization function of lkm; heard not recommended read files lkm after kernel initialized.

please advice me. thank you.

daum

reading from/writing files kernel not recommended.

the kernel newbies wiki page describes quite nicely.

for several reasons:

  • selecting , in format read/write data policy , policy not belong kernel. userland daemon easier replace 1 receives or sends data on network, generates or converts them from/to different format etc.
  • filesystem operations need user context (i.e.: current != null). can't sure you're in user context can't write (for example) interrupt handler.
  • the kernel allows multiple filesystem namespaces user processes. 1 should use? how make sure indeed uses 1 want?
  • kernel should not depend on particular layout of filesystem nor on availability of writable filesystem. location of file policy decision , policy decisions should done in userspace. maybe want dump kernel output in remote mysql server
    tomorrow, kind of policy easier in userland.
  • kernel code should kept simple , stupid, because bug in have serious consequences. working files requires
    being aware of various locking issues , add unnecessary
    complexity.

if want configure behaviour of kernel module you're writing, can pass module parameters configure on start up. alternatively, module can expose interfaces sysfs can used configure @ run time.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -