Solved

Writing into a file from device driver

Posted on 2006-11-22
4
245 Views
Last Modified: 2012-05-05
Hello experts!

I am writing a simple character device driver in C. I wanted to know if there is a way that I can open a text file and then read/write into it from within the driver.

To summarize, I want to:
1. open a text file from within device driver
2. write some debug data into the file
3. close the text file

I am new to linux kernel programming. Please let me know if there is a way to achieve the above tasks.

Regards,
Vikram
0
Comment
Question by:Vikram_B
  • 2
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17996763
AFAIK you have to use printk() for that
0
 
LVL 27

Accepted Solution

by:
Nopius earned 25 total points
ID: 18000510
Short answer: NO WAY.
Long answer: probably possible but is _very_ difficult and highly unrecommended.

Read here an answer: http://uwsg.iu.edu/hypermail/linux/kernel/0005.3/0061.html
0
 

Author Comment

by:Vikram_B
ID: 18001086
Thanks Nopius! U saved a lot of my time and effort :)
0
 
LVL 27

Expert Comment

by:Nopius
ID: 18001298
Vikram_B: that was all about files. But as ahoffman say, printk() may help to debug driver. Using this function you can generate kernel log messages, that you may log via syslog or read with 'dmesg' command.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question