A: http://en.wikipedia.org/wiki/Top_post Q: Where do I find info about this thing called top-posting? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I leave quotations after my reply? On Mon, Dec 18, 2006 at 10:21:01AM -0800, Junhan Zhang (junhan) wrote: > I read the FAQ. Technically, it is right, but useless.8-( You're right, reading/writing from kernel is indeed useless :) > I have a kernel module to do the statistic for compactflash partition > 1, and have to save to partition 2. I have no idea what you mean with "do the statistic for partition 1", but if you want to know what reads/writes to that partition, have a look at Jens Axboe's blktrace (see Google). > I am using kernel 2.6.11 .Do you have any good idea to do it? Sure, add a device to your module, then have a userspace program that basically boils down to: int infd, outfd; char buf[BUFLEN]; int got; infd = open("/dev/mydevice", O_RDONLY); outfd = open("/mnt/secondpartition/outfile", O_WRONLY | O_CREAT, 0666); while((got = read(infd, buf, BUFLEN)) > 0) { write(outfd, buf, got); } /* something went wrong */ if(got < 0) { perror("read(infd)"); exit(1); } close(outfd); close(infd); Needs some more error handling, but you got my point. (yeah, that code looks a lot like cat, cp, and dd :) Support for blktrace got merged in 2.6.18, IIRC (it most certainly is in 2.6.19.1). If blktrace gives enough information, you can do anything you need in userland. Erik -- They're all fools. Don't worry. Darwin may be slow, but he'll eventually get them. -- Matthew Lammers in alt.sysadmin.recovery -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/