42 struct file *lower_file;
46 lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file;
51 rc =
vfs_write(lower_file, data, size, &offset);
53 mark_inode_dirty_sync(ecryptfs_inode);
74 struct page *page_for_lower,
83 virt =
kmap(page_for_lower);
112 struct page *ecryptfs_page;
114 char *ecryptfs_page_virt;
115 loff_t ecryptfs_file_size = i_size_read(ecryptfs_inode);
120 crypt_stat = &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
125 if (offset > ecryptfs_file_size)
126 pos = ecryptfs_file_size;
129 while (pos < (offset + size)) {
133 loff_t total_remaining_bytes = ((offset +
size) - pos);
135 if (fatal_signal_pending(
current)) {
140 if (num_bytes > total_remaining_bytes)
141 num_bytes = total_remaining_bytes;
144 loff_t total_remaining_zeros = (offset -
pos);
146 if (num_bytes > total_remaining_zeros)
147 num_bytes = total_remaining_zeros;
151 if (IS_ERR(ecryptfs_page)) {
152 rc = PTR_ERR(ecryptfs_page);
154 "index [%ld] from eCryptfs inode "
155 "mapping; rc = [%d]\n", __func__,
156 ecryptfs_page_idx, rc);
167 if (pos < offset || !start_offset_in_page) {
170 memset(((
char *)ecryptfs_page_virt
171 + start_offset_in_page), 0,
177 memcpy(((
char *)ecryptfs_page_virt
178 + start_offset_in_page),
179 (data + data_offset), num_bytes);
184 SetPageUptodate(ecryptfs_page);
191 start_offset_in_page,
196 "page; rc = [%d]\n", __func__, rc);
201 if (pos > ecryptfs_file_size) {
202 i_size_write(ecryptfs_inode, pos);
210 "ecryptfs_write_inode_size_to_metadata; "
236 struct inode *ecryptfs_inode)
238 struct file *lower_file;
242 lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file;
247 rc =
vfs_read(lower_file, data, size, &offset);
270 struct inode *ecryptfs_inode)
277 virt =
kmap(page_for_ecryptfs);
281 kunmap(page_for_ecryptfs);