Lines Matching +full:page +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-or-later
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
48 * @size: The amount of data from @page_for_lower to write to the
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()
59 size_t offset_in_page, size_t size) in ecryptfs_write_lower_page_segment() argument
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()
81 * @size: The number of bytes to write from @data
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
94 size_t size) 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()
106 * if we are writing beyond current size, then start pos in ecryptfs_write()
107 * at the current size - we'll fill in zeros from there. 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()
128 loff_t total_remaining_zeros = (offset - pos); in ecryptfs_write()
137 printk(KERN_ERR "%s: Error getting page at " in ecryptfs_write()
149 * If we're in a fresh page beyond eof, zero it in either case 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()
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()
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
237 * @size: The number of bytes to write into @page_for_ecryptfs
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()
248 size_t offset_in_page, size_t size, in ecryptfs_read_lower_page_segment() argument
257 rc = ecryptfs_read_lower(virt, offset, size, ecryptfs_inode); in ecryptfs_read_lower_page_segment()