diff options
author | Michael Halcrow <mhalcrow@us.ibm.com> | 2007-10-16 04:28:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:12 -0400 |
commit | b6c1d8fcbadeb9bb4c3dbca57a007629d0483544 (patch) | |
tree | ba786993ce9b16f0dcc25cdab05af8a3fef636ed /fs/ecryptfs/crypto.c | |
parent | 035241d30e273519195a9987e6eb56bbe2297872 (diff) |
eCryptfs: remove unused functions and kmem_cache
The switch to read_write.c routines and the persistent file make a number of
functions unnecessary. This patch removes them.
Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 9408ea484164..a9ca373c6107 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -353,119 +353,6 @@ out: | |||
353 | return rc; | 353 | return rc; |
354 | } | 354 | } |
355 | 355 | ||
356 | static void | ||
357 | ecryptfs_extent_to_lwr_pg_idx_and_offset(unsigned long *lower_page_idx, | ||
358 | int *byte_offset, | ||
359 | struct ecryptfs_crypt_stat *crypt_stat, | ||
360 | unsigned long extent_num) | ||
361 | { | ||
362 | unsigned long lower_extent_num; | ||
363 | int extents_occupied_by_headers_at_front; | ||
364 | int bytes_occupied_by_headers_at_front; | ||
365 | int extent_offset; | ||
366 | int extents_per_page; | ||
367 | |||
368 | bytes_occupied_by_headers_at_front = | ||
369 | (crypt_stat->extent_size | ||
370 | * crypt_stat->num_header_extents_at_front); | ||
371 | extents_occupied_by_headers_at_front = | ||
372 | ( bytes_occupied_by_headers_at_front | ||
373 | / crypt_stat->extent_size ); | ||
374 | lower_extent_num = extents_occupied_by_headers_at_front + extent_num; | ||
375 | extents_per_page = PAGE_CACHE_SIZE / crypt_stat->extent_size; | ||
376 | (*lower_page_idx) = lower_extent_num / extents_per_page; | ||
377 | extent_offset = lower_extent_num % extents_per_page; | ||
378 | (*byte_offset) = extent_offset * crypt_stat->extent_size; | ||
379 | ecryptfs_printk(KERN_DEBUG, " * crypt_stat->extent_size = " | ||
380 | "[%d]\n", crypt_stat->extent_size); | ||
381 | ecryptfs_printk(KERN_DEBUG, " * crypt_stat->" | ||
382 | "num_header_extents_at_front = [%d]\n", | ||
383 | crypt_stat->num_header_extents_at_front); | ||
384 | ecryptfs_printk(KERN_DEBUG, " * extents_occupied_by_headers_at_" | ||
385 | "front = [%d]\n", extents_occupied_by_headers_at_front); | ||
386 | ecryptfs_printk(KERN_DEBUG, " * lower_extent_num = [0x%.16x]\n", | ||
387 | lower_extent_num); | ||
388 | ecryptfs_printk(KERN_DEBUG, " * extents_per_page = [%d]\n", | ||
389 | extents_per_page); | ||
390 | ecryptfs_printk(KERN_DEBUG, " * (*lower_page_idx) = [0x%.16x]\n", | ||
391 | (*lower_page_idx)); | ||
392 | ecryptfs_printk(KERN_DEBUG, " * extent_offset = [%d]\n", | ||
393 | extent_offset); | ||
394 | ecryptfs_printk(KERN_DEBUG, " * (*byte_offset) = [%d]\n", | ||
395 | (*byte_offset)); | ||
396 | } | ||
397 | |||
398 | static int ecryptfs_write_out_page(struct ecryptfs_page_crypt_context *ctx, | ||
399 | struct page *lower_page, | ||
400 | struct inode *lower_inode, | ||
401 | int byte_offset_in_page, int bytes_to_write) | ||
402 | { | ||
403 | int rc = 0; | ||
404 | |||
405 | if (ctx->mode == ECRYPTFS_PREPARE_COMMIT_MODE) { | ||
406 | rc = ecryptfs_commit_lower_page(lower_page, lower_inode, | ||
407 | ctx->param.lower_file, | ||
408 | byte_offset_in_page, | ||
409 | bytes_to_write); | ||
410 | if (rc) { | ||
411 | ecryptfs_printk(KERN_ERR, "Error calling lower " | ||
412 | "commit; rc = [%d]\n", rc); | ||
413 | goto out; | ||
414 | } | ||
415 | } else { | ||
416 | rc = ecryptfs_writepage_and_release_lower_page(lower_page, | ||
417 | lower_inode, | ||
418 | ctx->param.wbc); | ||
419 | if (rc) { | ||
420 | ecryptfs_printk(KERN_ERR, "Error calling lower " | ||
421 | "writepage(); rc = [%d]\n", rc); | ||
422 | goto out; | ||
423 | } | ||
424 | } | ||
425 | out: | ||
426 | return rc; | ||
427 | } | ||
428 | |||
429 | static int ecryptfs_read_in_page(struct ecryptfs_page_crypt_context *ctx, | ||
430 | struct page **lower_page, | ||
431 | struct inode *lower_inode, | ||
432 | unsigned long lower_page_idx, | ||
433 | int byte_offset_in_page) | ||
434 | { | ||
435 | int rc = 0; | ||
436 | |||
437 | if (ctx->mode == ECRYPTFS_PREPARE_COMMIT_MODE) { | ||
438 | /* TODO: Limit this to only the data extents that are | ||
439 | * needed */ | ||
440 | rc = ecryptfs_get_lower_page(lower_page, lower_inode, | ||
441 | ctx->param.lower_file, | ||
442 | lower_page_idx, | ||
443 | byte_offset_in_page, | ||
444 | (PAGE_CACHE_SIZE | ||
445 | - byte_offset_in_page)); | ||
446 | if (rc) { | ||
447 | ecryptfs_printk( | ||
448 | KERN_ERR, "Error attempting to grab, map, " | ||
449 | "and prepare_write lower page with index " | ||
450 | "[0x%.16x]; rc = [%d]\n", lower_page_idx, rc); | ||
451 | goto out; | ||
452 | } | ||
453 | } else { | ||
454 | *lower_page = grab_cache_page(lower_inode->i_mapping, | ||
455 | lower_page_idx); | ||
456 | if (!(*lower_page)) { | ||
457 | rc = -EINVAL; | ||
458 | ecryptfs_printk( | ||
459 | KERN_ERR, "Error attempting to grab and map " | ||
460 | "lower page with index [0x%.16x]; rc = [%d]\n", | ||
461 | lower_page_idx, rc); | ||
462 | goto out; | ||
463 | } | ||
464 | } | ||
465 | out: | ||
466 | return rc; | ||
467 | } | ||
468 | |||
469 | /** | 356 | /** |
470 | * ecryptfs_lower_offset_for_extent | 357 | * ecryptfs_lower_offset_for_extent |
471 | * | 358 | * |
@@ -1306,43 +1193,6 @@ int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code) | |||
1306 | return rc; | 1193 | return rc; |
1307 | } | 1194 | } |
1308 | 1195 | ||
1309 | /** | ||
1310 | * ecryptfs_read_header_region | ||
1311 | * @data: The virtual address to write header region data into | ||
1312 | * @dentry: The lower dentry | ||
1313 | * @mnt: The lower VFS mount | ||
1314 | * | ||
1315 | * Returns zero on success; non-zero otherwise | ||
1316 | */ | ||
1317 | static int ecryptfs_read_header_region(char *data, struct dentry *dentry, | ||
1318 | struct vfsmount *mnt) | ||
1319 | { | ||
1320 | struct file *lower_file; | ||
1321 | mm_segment_t oldfs; | ||
1322 | int rc; | ||
1323 | |||
1324 | rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, O_RDONLY); | ||
1325 | if (rc) { | ||
1326 | printk(KERN_ERR | ||
1327 | "Error opening lower_file to read header region\n"); | ||
1328 | goto out; | ||
1329 | } | ||
1330 | lower_file->f_pos = 0; | ||
1331 | oldfs = get_fs(); | ||
1332 | set_fs(get_ds()); | ||
1333 | rc = lower_file->f_op->read(lower_file, (char __user *)data, | ||
1334 | ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos); | ||
1335 | set_fs(oldfs); | ||
1336 | rc = ecryptfs_close_lower_file(lower_file); | ||
1337 | if (rc) { | ||
1338 | printk(KERN_ERR "Error closing lower_file\n"); | ||
1339 | goto out; | ||
1340 | } | ||
1341 | rc = 0; | ||
1342 | out: | ||
1343 | return rc; | ||
1344 | } | ||
1345 | |||
1346 | int ecryptfs_read_and_validate_header_region(char *data, | 1196 | int ecryptfs_read_and_validate_header_region(char *data, |
1347 | struct inode *ecryptfs_inode) | 1197 | struct inode *ecryptfs_inode) |
1348 | { | 1198 | { |