Find the answer to your Linux question:
Results 1 to 5 of 5
how to read a text config file in the Kernel? can sys_call do it??? thank you....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    cfh
    cfh is offline
    Just Joined!
    Join Date
    Sep 2005
    Posts
    11

    how to read a text config file in the Kernel


    how to read a text config file in the Kernel?

    can sys_call do it???


    thank you.

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    You can create a script that reads the config file, and modprobes/insmods your module with the appropriate parameters.

  3. #3
    cfh
    cfh is offline
    Just Joined!
    Join Date
    Sep 2005
    Posts
    11
    Quote Originally Posted by lakerdonald
    You can create a script that reads the config file, and modprobes/insmods your module with the appropriate parameters.
    I am not quite sure what you mean.....
    I know write a script to read the config, and insert it.
    but the problem is how?

    thank you.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Make all the options module_params in your code, then read the values from the config file and pass them as key=value pairs to insmod:
    Code:
    #foo.conf
    number_of_devs=4
    priority=2
    god="lakerdonald"
    Would be read by the script and pass to insmod:
    Code:
    insmod /foo/bar.ko number_of_devs=4 priority=2 god="lakerdonald"
    for example.

  6. #5
    cfh
    cfh is offline
    Just Joined!
    Join Date
    Sep 2005
    Posts
    11
    thank you...
    sorry I didn't put my question clearly, so it is not really I am looking for, let me rephrase the question.
    I want to read a config file in the kernel, and try to parse it...
    I am trying to read a set of rules from a text file, and there are many of them.
    How can I do it??
    After I have read in, how do I parse it? is there anything that similar to "fgets" that I can call in the kernel???


    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •