Lines Matching +full:data +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-or-later
18 * @data: Data to write
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
23 * Write data to the lower file.
27 int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, in ecryptfs_write_lower() argument
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
47 * start writing the data
48 * @size: The amount of data from @page_for_lower to write to the
55 * Returns zero on success; non-zero otherwise
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()
78 * @data: Virtual address where data to write is located
80 * data from @data
81 * @size: The number of bytes to write from @data
83 * Write an arbitrary amount of data to an arbitrary location in 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
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
94 size_t size) in ecryptfs_write() argument
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()
148 * If we are at or beyond request, we are writing the *data* 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()
163 (data + data_offset), num_bytes); in ecryptfs_write()
170 if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) in ecryptfs_write()
187 if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) { in ecryptfs_write()
208 * @data: The read data is stored here by this function
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
211 * store into @data
214 * Read @size bytes of data at byte offset @offset from the lower
215 * inode into memory location @data.
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
237 * @size: The number of bytes to write into @page_for_ecryptfs
244 * Returns zero on success; non-zero otherwise
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()