Lines Matching +full:page +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-or-later
19 * @offset: Byte offset in the lower file to which to write the data
20 * @size: Number of bytes from @data to write at @offset in the lower
28 loff_t offset, size_t size) in ecryptfs_write_lower() argument
33 lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file; in ecryptfs_write_lower()
35 return -EIO; in ecryptfs_write_lower()
36 rc = kernel_write(lower_file, data, size, &offset); in ecryptfs_write_lower()
44 * @page_for_lower: The page containing the data to be written to the
46 * @offset_in_page: The offset in the @page_for_lower from which to
51 * Determines the byte offset in the file for the given page and
52 * offset within the page, maps the page, and makes the call to write
55 * Returns zero on success; non-zero otherwise
58 struct page *page_for_lower, in ecryptfs_write_lower_page_segment()
62 loff_t offset; in ecryptfs_write_lower_page_segment() local
65 offset = ((((loff_t)page_for_lower->index) << PAGE_SHIFT) in ecryptfs_write_lower_page_segment()
68 rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); in ecryptfs_write_lower_page_segment()
79 * @offset: Offset in the eCryptfs file at which to begin writing the
84 * eCryptfs inode page cache. This is done on a page-by-page, and then
85 * by an extent-by-extent, basis; individual extents are encrypted and
86 * written to the lower page cache (via VFS writes). This function
91 * Returns zero on success; non-zero otherwise
93 int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, in ecryptfs_write() argument
96 struct page *ecryptfs_page; in ecryptfs_write()
104 crypt_stat = &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; in ecryptfs_write()
107 * at the current size - we'll fill in zeros from there. in ecryptfs_write()
109 if (offset > ecryptfs_file_size) in ecryptfs_write()
112 pos = offset; in ecryptfs_write()
113 while (pos < (offset + size)) { in ecryptfs_write()
116 size_t num_bytes = (PAGE_SIZE - start_offset_in_page); in ecryptfs_write()
117 loff_t total_remaining_bytes = ((offset + size) - pos); in ecryptfs_write()
120 rc = -EINTR; in ecryptfs_write()
126 if (pos < offset) { in ecryptfs_write()
127 /* remaining zeros to write, up to destination offset */ in ecryptfs_write()
128 loff_t total_remaining_zeros = (offset - pos); in ecryptfs_write()
137 printk(KERN_ERR "%s: Error getting page at " in ecryptfs_write()
146 * pos: where we're now writing, offset: where the request was in ecryptfs_write()
149 * If we're in a fresh page beyond eof, zero it in either case in ecryptfs_write()
151 if (pos < offset || !start_offset_in_page) { in ecryptfs_write()
153 * Fill in zero values to the end of the page */ in ecryptfs_write()
156 PAGE_SIZE - start_offset_in_page); in ecryptfs_write()
159 /* pos >= offset, we are now writing the data request */ in ecryptfs_write()
160 if (pos >= offset) { in ecryptfs_write()
170 if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) in ecryptfs_write()
180 "page; rc = [%d]\n", __func__, rc); in ecryptfs_write()
187 if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) { in ecryptfs_write()
209 * @offset: Byte offset in the lower file from which to read the data
210 * @size: Number of bytes to read from @offset of the lower file and
214 * Read @size bytes of data at byte offset @offset from the lower
219 int ecryptfs_read_lower(char *data, loff_t offset, size_t size, in ecryptfs_read_lower() argument
223 lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file; in ecryptfs_read_lower()
225 return -EIO; in ecryptfs_read_lower()
226 return kernel_read(lower_file, data, size, &offset); in ecryptfs_read_lower()
231 * @page_for_ecryptfs: The page into which data for eCryptfs will be
233 * @page_index: Page index in @page_for_ecryptfs from which to start
235 * @offset_in_page: Offset in @page_for_ecryptfs from which to start
240 * Determines the byte offset in the file for the given page and
241 * offset within the page, maps the page, and makes the call to read
244 * Returns zero on success; non-zero otherwise
246 int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs, in ecryptfs_read_lower_page_segment()
252 loff_t offset; in ecryptfs_read_lower_page_segment() local
255 offset = ((((loff_t)page_index) << PAGE_SHIFT) + offset_in_page); in ecryptfs_read_lower_page_segment()
257 rc = ecryptfs_read_lower(virt, offset, size, ecryptfs_inode); in ecryptfs_read_lower_page_segment()