diff options
author | Tyler Hicks <tyhicks@canonical.com> | 2012-01-18 16:09:43 -0500 |
---|---|---|
committer | Tyler Hicks <tyhicks@canonical.com> | 2012-01-25 15:43:41 -0500 |
commit | f2cb933501ebc066bf3c4b1836fd8428f8fe9863 (patch) | |
tree | d179547c3156df94cb0f0b5a91e9691bfc3d7a89 /fs/ecryptfs/read_write.c | |
parent | a261a03904849c3df50bd0300efb7fb3f865137d (diff) |
eCryptfs: Remove unused ecryptfs_read()
ecryptfs_read() has been ifdef'ed out for years now and it was
apparently unused before then. It is time to get rid of it for good.
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Diffstat (limited to 'fs/ecryptfs/read_write.c')
-rw-r--r-- | fs/ecryptfs/read_write.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index 608c1c3fde1b..5c0106f75775 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -282,76 +282,3 @@ int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs, | |||
282 | flush_dcache_page(page_for_ecryptfs); | 282 | flush_dcache_page(page_for_ecryptfs); |
283 | return rc; | 283 | return rc; |
284 | } | 284 | } |
285 | |||
286 | #if 0 | ||
287 | /** | ||
288 | * ecryptfs_read | ||
289 | * @data: The virtual address into which to write the data read (and | ||
290 | * possibly decrypted) from the lower file | ||
291 | * @offset: The offset in the decrypted view of the file from which to | ||
292 | * read into @data | ||
293 | * @size: The number of bytes to read into @data | ||
294 | * @ecryptfs_file: The eCryptfs file from which to read | ||
295 | * | ||
296 | * Read an arbitrary amount of data from an arbitrary location in the | ||
297 | * eCryptfs page cache. This is done on an extent-by-extent basis; | ||
298 | * individual extents are decrypted and read from the lower page | ||
299 | * cache (via VFS reads). This function takes care of all the | ||
300 | * address translation to locations in the lower filesystem. | ||
301 | * | ||
302 | * Returns zero on success; non-zero otherwise | ||
303 | */ | ||
304 | int ecryptfs_read(char *data, loff_t offset, size_t size, | ||
305 | struct file *ecryptfs_file) | ||
306 | { | ||
307 | struct inode *ecryptfs_inode = ecryptfs_file->f_dentry->d_inode; | ||
308 | struct page *ecryptfs_page; | ||
309 | char *ecryptfs_page_virt; | ||
310 | loff_t ecryptfs_file_size = i_size_read(ecryptfs_inode); | ||
311 | loff_t data_offset = 0; | ||
312 | loff_t pos; | ||
313 | int rc = 0; | ||
314 | |||
315 | if ((offset + size) > ecryptfs_file_size) { | ||
316 | rc = -EINVAL; | ||
317 | printk(KERN_ERR "%s: Attempt to read data past the end of the " | ||
318 | "file; offset = [%lld]; size = [%td]; " | ||
319 | "ecryptfs_file_size = [%lld]\n", | ||
320 | __func__, offset, size, ecryptfs_file_size); | ||
321 | goto out; | ||
322 | } | ||
323 | pos = offset; | ||
324 | while (pos < (offset + size)) { | ||
325 | pgoff_t ecryptfs_page_idx = (pos >> PAGE_CACHE_SHIFT); | ||
326 | size_t start_offset_in_page = (pos & ~PAGE_CACHE_MASK); | ||
327 | size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page); | ||
328 | size_t total_remaining_bytes = ((offset + size) - pos); | ||
329 | |||
330 | if (num_bytes > total_remaining_bytes) | ||
331 | num_bytes = total_remaining_bytes; | ||
332 | ecryptfs_page = ecryptfs_get_locked_page(ecryptfs_inode, | ||
333 | ecryptfs_page_idx); | ||
334 | if (IS_ERR(ecryptfs_page)) { | ||
335 | rc = PTR_ERR(ecryptfs_page); | ||
336 | printk(KERN_ERR "%s: Error getting page at " | ||
337 | "index [%ld] from eCryptfs inode " | ||
338 | "mapping; rc = [%d]\n", __func__, | ||
339 | ecryptfs_page_idx, rc); | ||
340 | goto out; | ||
341 | } | ||
342 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); | ||
343 | memcpy((data + data_offset), | ||
344 | ((char *)ecryptfs_page_virt + start_offset_in_page), | ||
345 | num_bytes); | ||
346 | kunmap_atomic(ecryptfs_page_virt, KM_USER0); | ||
347 | flush_dcache_page(ecryptfs_page); | ||
348 | SetPageUptodate(ecryptfs_page); | ||
349 | unlock_page(ecryptfs_page); | ||
350 | page_cache_release(ecryptfs_page); | ||
351 | pos += num_bytes; | ||
352 | data_offset += num_bytes; | ||
353 | } | ||
354 | out: | ||
355 | return rc; | ||
356 | } | ||
357 | #endif /* 0 */ | ||