LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   need information on Address space operation (https://www.linuxquestions.org/questions/linux-software-2/need-information-on-address-space-operation-4175497120/)

vinayak099 03-05-2014 08:47 AM

need information on Address space operation
 
Hi,

actually I am going through ecryptfs code in which
they are using address_space_operations and they are gettig called whenever I write a file or read a file.

my queries are

1. I am not able to understand who is triggering those.

2. actually field .write = do_sync_write; and .read = do_synd_read in struct file_operations. so call should be delagated to do_sync_write and do_sync_read whenever I do write and read call. but address space operations are getting called.

code part :
const struct file_operations ecryptfs_main_fops = {
.llseek = generic_file_llseek,
.read = do_sync_read,
.aio_read = ecryptfs_read_update_atime,
.write = do_sync_write,
--
}

3. Is call to address space operations happening from do_sync_write and do_sync_read from read_write.c ?

code part from read_write.c
ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
{
--
--
ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos);

--
}

4. basically what function will be called when I do
filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos);

I searched for it but did not get where the function pointer is assigned

Can anybody please expalin me the flow or guide me little.

its for your reference.

--------------------------------------------------------

const struct address_space_operations ecryptfs_aops = {
.writepage = ecryptfs_writepage,
.readpage = ecryptfs_readpage,
.write_begin = ecryptfs_write_begin,
.write_end = ecryptfs_write_end,
.bmap = ecryptfs_bmap,
};

and during mount they set the inode with these operations

static int ecryptfs_inode_set(struct inode *inode, void *opaque)
{
--- (some other code)

inode->i_mapping->a_ops = &ecryptfs_aops;

---
}


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