Welcome! Log In Create A New Profile

Advanced

Replacing file_read and file_write function

Posted by dhawalthakker 
Replacing file_read and file_write function
February 07, 2008 06:52PM
Hello all,

I am trying to replace the generic_file_read and generic_file_write with my own custom read and write in my file system.

Having my own custom read and write calls, i can copy the file, read the file, write the file. But i CANNOT EXECUTE any program on it.

Description of read and write function:

I use sb_bread to read a block. I think this is fine.

To write: i call sb_bread to read a block and then write data to the buffer return by sb_bread, using memcpy. And then use mark_buffer_dirty(bh); to write back the data to disk. I dont think this is an ideal way to do it. As i have to read data for each write ??? (Please suggest me)

Problem in executing file:

After doing bit of reading, i realized that i am not mapping buffer to the page in my read and write calls. Is it necessary, I was referring to generic_file_buffered_write.

Even i am not calling any other function such as fs_prepare_write( block_prepare_write(page, from, to, ux_get_block); ) , fs_writepage ( block_write_full_page(page, ux_get_block, wbc); )from my custom read and write function.

Could anyone please guide me/ example, how could i replace generic_read and generic_write function, so that i can execute files on it.

The problem i am having is understanding paging. Do i have to map each block to the page when i do read and write. Is it something like first do, sb_bread and then map the page using some function get_user_page ? and then invalidate the page.

Any guidance will be highly appreciated. If in doubt or have any question, please do ask.

Thanks,
Dhawal.
fsadfsdfwse
Re: Replacing file_read and file_write function
July 29, 2019 12:14PM
You may congratulate me because I've got an exceptional job offer. I wrote an engineering cover letter and got an offer in an hour! Isn't this an amazing luck?
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 9 plus 7?
Message: