main.c (b22364c8eec89e6b0c081a237f3b6348df87796f) main.c (c376222960ae91d5ffb9197ee36771aaed1d9f90)
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2003 Erez Zadok
5 * Copyright (C) 2001-2003 Stony Brook University
6 * Copyright (C) 2004-2006 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 364 unchanged lines hidden (view full) ---

373 */
374static int
375ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
376{
377 int rc = 0;
378
379 /* Released in ecryptfs_put_super() */
380 ecryptfs_set_superblock_private(sb,
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 *
4 * Copyright (C) 1997-2003 Erez Zadok
5 * Copyright (C) 2001-2003 Stony Brook University
6 * Copyright (C) 2004-2006 International Business Machines Corp.
7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com>
8 * Michael C. Thompson <mcthomps@us.ibm.com>

--- 364 unchanged lines hidden (view full) ---

373 */
374static int
375ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
376{
377 int rc = 0;
378
379 /* Released in ecryptfs_put_super() */
380 ecryptfs_set_superblock_private(sb,
381 kmem_cache_alloc(ecryptfs_sb_info_cache,
381 kmem_cache_zalloc(ecryptfs_sb_info_cache,
382 GFP_KERNEL));
383 if (!ecryptfs_superblock_to_private(sb)) {
384 ecryptfs_printk(KERN_WARNING, "Out of memory\n");
385 rc = -ENOMEM;
386 goto out;
387 }
382 GFP_KERNEL));
383 if (!ecryptfs_superblock_to_private(sb)) {
384 ecryptfs_printk(KERN_WARNING, "Out of memory\n");
385 rc = -ENOMEM;
386 goto out;
387 }
388 memset(ecryptfs_superblock_to_private(sb), 0,
389 sizeof(struct ecryptfs_sb_info));
390 sb->s_op = &ecryptfs_sops;
391 /* Released through deactivate_super(sb) from get_sb_nodev */
392 sb->s_root = d_alloc(NULL, &(const struct qstr) {
393 .hash = 0,.name = "/",.len = 1});
394 if (!sb->s_root) {
395 ecryptfs_printk(KERN_ERR, "d_alloc failed\n");
396 rc = -ENOMEM;
397 goto out;
398 }
399 sb->s_root->d_op = &ecryptfs_dops;
400 sb->s_root->d_sb = sb;
401 sb->s_root->d_parent = sb->s_root;
402 /* Released in d_release when dput(sb->s_root) is called */
403 /* through deactivate_super(sb) from get_sb_nodev() */
404 ecryptfs_set_dentry_private(sb->s_root,
388 sb->s_op = &ecryptfs_sops;
389 /* Released through deactivate_super(sb) from get_sb_nodev */
390 sb->s_root = d_alloc(NULL, &(const struct qstr) {
391 .hash = 0,.name = "/",.len = 1});
392 if (!sb->s_root) {
393 ecryptfs_printk(KERN_ERR, "d_alloc failed\n");
394 rc = -ENOMEM;
395 goto out;
396 }
397 sb->s_root->d_op = &ecryptfs_dops;
398 sb->s_root->d_sb = sb;
399 sb->s_root->d_parent = sb->s_root;
400 /* Released in d_release when dput(sb->s_root) is called */
401 /* through deactivate_super(sb) from get_sb_nodev() */
402 ecryptfs_set_dentry_private(sb->s_root,
405 kmem_cache_alloc(ecryptfs_dentry_info_cache,
403 kmem_cache_zalloc(ecryptfs_dentry_info_cache,
406 GFP_KERNEL));
407 if (!ecryptfs_dentry_to_private(sb->s_root)) {
408 ecryptfs_printk(KERN_ERR,
409 "dentry_info_cache alloc failed\n");
410 rc = -ENOMEM;
411 goto out;
412 }
404 GFP_KERNEL));
405 if (!ecryptfs_dentry_to_private(sb->s_root)) {
406 ecryptfs_printk(KERN_ERR,
407 "dentry_info_cache alloc failed\n");
408 rc = -ENOMEM;
409 goto out;
410 }
413 memset(ecryptfs_dentry_to_private(sb->s_root), 0,
414 sizeof(struct ecryptfs_dentry_info));
415 rc = 0;
416out:
417 /* Should be able to rely on deactivate_super called from
418 * get_sb_nodev */
419 return rc;
420}
421
422/**

--- 400 unchanged lines hidden ---
411 rc = 0;
412out:
413 /* Should be able to rely on deactivate_super called from
414 * get_sb_nodev */
415 return rc;
416}
417
418/**

--- 400 unchanged lines hidden ---