LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-10-2012, 06:10 AM   #1
gangadhar
LQ Newbie
 
Registered: Nov 2011
Posts: 12

Rep: Reputation: Disabled
add a module in kernel copy one file to another file


i want add a modules in kernel
1.read a file add a module in kernel.
2.write a file add a module in kernel
3.read and write file add a module in kernel
4.copy one file to another file add a module in kernel
please help me
provide some tutorials kernel programing
 
Old 01-18-2012, 01:23 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866
This came up on a simple Google search for linux kernel programming tutorials:
http://tldp.org/LDP/lkmpg/2.6/html/
http://crashcourse.ca/introduction-l...tu-free-lesson
 
Old 01-18-2012, 11:17 PM   #3
gangadhar
LQ Newbie
 
Registered: Nov 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
i already studied these materials

from this tutorials i added a simple helloworld program.
And i add a character and block device driver for read and write a data ,and i also open a file but am unabling to copy one file to other file. for this i want source code
thanks in advance
 
Old 01-18-2012, 11:42 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866Reputation: 4866
If you are able to open files and read/write data then you have all you need to copy files, I would think. Open the file that you want to copy, open/create the destination file and simply write the data you read from the first to the latter.
 
Old 01-19-2012, 12:11 AM   #5
gangadhar
LQ Newbie
 
Registered: Nov 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
copy file1 to another file2

yes i open a file1 from userspace i want to create a destination file2. in file2 i want copy a file1.

in details what i done is
1. insmod module.ko
2. and create a device file using mknod
mknod /dev/newmodule c 249 0(249-major,0-minor)
3.i write a data into this module like echo hello to everyone >/dev/newmodule
4.i read a data using cat /dev/newmodule
5.finally i saw dmesg
here showing how many bytes read and write data
6.this program have problem that is size, i declare as #define BUFF_LEN 80
i want to allocate a dynamicaly i think it is possible with kmalloc but i donot how to used.

finally what i want to say is
file1=/home/gangadhar/fs.txt
fs.txt(file1) copy to another file(create and copy fssss.txt(file2=/home/gangadhar/fssss.txt)


normally we write a c program for copy one file1 to file2 like that program i want to add a module in kernel .
Thanks for u reply
thanks in advance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to mmap file in kernel module shreyasw Linux - Newbie 3 09-25-2008 02:04 AM
Building kernel module from multiple source file in 2.6 kernel yogeshwar_s Programming 1 12-20-2004 10:31 AM
add new kernel module/file system blackzone Linux - General 1 11-08-2004 12:14 AM
Suse 9 and Kernel 2.6.1 - Copy the.config file? talkingwires Linux - Software 2 01-15-2004 11:16 PM
Is there any way to copy a kernel config file? Kramer Linux - General 4 11-05-2003 10:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration