kernel-fxtec-pro1x/fs/sdcardfs/main.c

520 lines
12 KiB
C
Raw Normal View History

/*
* fs/sdcardfs/main.c
*
* Copyright (c) 2013 Samsung Electronics Co. Ltd
* Authors: Daeho Jeong, Woojoong Lee, Seunghwan Hyun,
* Sunghwan Yun, Sungjong Seo
*
* This program has been developed as a stackable file system based on
* the WrapFS which written by
*
* Copyright (c) 1998-2011 Erez Zadok
* Copyright (c) 2009 Shrikar Archak
* Copyright (c) 2003-2011 Stony Brook University
* Copyright (c) 2003-2011 The Research Foundation of SUNY
*
* This file is dual licensed. It may be redistributed and/or modified
* under the terms of the Apache 2.0 License OR version 2 of the GNU
* General Public License.
*/
#include "sdcardfs.h"
#include <linux/fscrypt.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/parser.h>
enum {
Opt_fsuid,
Opt_fsgid,
Opt_gid,
Opt_debug,
Opt_mask,
Opt_multiuser,
Opt_userid,
Opt_reserved_mb,
Opt_gid_derivation,
Opt_default_normal,
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
Opt_nocache,
Opt_unshared_obb,
Opt_err,
};
static const match_table_t sdcardfs_tokens = {
{Opt_fsuid, "fsuid=%u"},
{Opt_fsgid, "fsgid=%u"},
{Opt_gid, "gid=%u"},
{Opt_debug, "debug"},
{Opt_mask, "mask=%u"},
{Opt_userid, "userid=%d"},
{Opt_multiuser, "multiuser"},
{Opt_gid_derivation, "derive_gid"},
{Opt_default_normal, "default_normal"},
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
{Opt_unshared_obb, "unshared_obb"},
{Opt_reserved_mb, "reserved_mb=%u"},
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
{Opt_nocache, "nocache"},
{Opt_err, NULL}
};
static int parse_options(struct super_block *sb, char *options, int silent,
int *debug, struct sdcardfs_vfsmount_options *vfsopts,
struct sdcardfs_mount_options *opts)
{
char *p;
substring_t args[MAX_OPT_ARGS];
int option;
/* by default, we use AID_MEDIA_RW as uid, gid */
opts->fs_low_uid = AID_MEDIA_RW;
opts->fs_low_gid = AID_MEDIA_RW;
vfsopts->mask = 0;
opts->multiuser = false;
opts->fs_user_id = 0;
vfsopts->gid = 0;
/* by default, 0MB is reserved */
opts->reserved_mb = 0;
/* by default, gid derivation is off */
opts->gid_derivation = false;
opts->default_normal = false;
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
opts->nocache = false;
*debug = 0;
if (!options)
return 0;
while ((p = strsep(&options, ",")) != NULL) {
int token;
if (!*p)
continue;
token = match_token(p, sdcardfs_tokens, args);
switch (token) {
case Opt_debug:
*debug = 1;
break;
case Opt_fsuid:
if (match_int(&args[0], &option))
return 0;
opts->fs_low_uid = option;
break;
case Opt_fsgid:
if (match_int(&args[0], &option))
return 0;
opts->fs_low_gid = option;
break;
case Opt_gid:
if (match_int(&args[0], &option))
return 0;
vfsopts->gid = option;
break;
case Opt_userid:
if (match_int(&args[0], &option))
return 0;
opts->fs_user_id = option;
break;
case Opt_mask:
if (match_int(&args[0], &option))
return 0;
vfsopts->mask = option;
break;
case Opt_multiuser:
opts->multiuser = true;
break;
case Opt_reserved_mb:
if (match_int(&args[0], &option))
return 0;
opts->reserved_mb = option;
break;
case Opt_gid_derivation:
opts->gid_derivation = true;
break;
case Opt_default_normal:
opts->default_normal = true;
break;
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
case Opt_nocache:
opts->nocache = true;
break;
case Opt_unshared_obb:
opts->unshared_obb = true;
break;
/* unknown option */
default:
if (!silent)
pr_err("Unrecognized mount option \"%s\" or missing value", p);
return -EINVAL;
}
}
if (*debug) {
pr_info("sdcardfs : options - debug:%d\n", *debug);
pr_info("sdcardfs : options - uid:%d\n",
opts->fs_low_uid);
pr_info("sdcardfs : options - gid:%d\n",
opts->fs_low_gid);
}
return 0;
}
int parse_options_remount(struct super_block *sb, char *options, int silent,
struct sdcardfs_vfsmount_options *vfsopts)
{
char *p;
substring_t args[MAX_OPT_ARGS];
int option;
int debug;
if (!options)
return 0;
while ((p = strsep(&options, ",")) != NULL) {
int token;
if (!*p)
continue;
token = match_token(p, sdcardfs_tokens, args);
switch (token) {
case Opt_debug:
debug = 1;
break;
case Opt_gid:
if (match_int(&args[0], &option))
return 0;
vfsopts->gid = option;
break;
case Opt_mask:
if (match_int(&args[0], &option))
return 0;
vfsopts->mask = option;
break;
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
case Opt_unshared_obb:
case Opt_default_normal:
case Opt_multiuser:
case Opt_userid:
case Opt_fsuid:
case Opt_fsgid:
case Opt_reserved_mb:
pr_warn("Option \"%s\" can't be changed during remount\n", p);
ANDROID: sdcardfs: Add sdcardfs filesystem Bug: 11118565 Bug: 27915347 Bug: 27992761 Bug: 28024488 Bug: 30013843 Bug: 30954918 Bug: 34133558 Bug: 34262585 Bug: 34542611 Bug: 34691169 Bug: 34723223 Bug: 35307857 Bug: 35331000 Bug: 35633782 Bug: 35643557 Bug: 35666680 bug: 35766959 Bug: 35766959 Bug: 35848445 Bug: 36004503 Bug: 36007653 Bug: 36138424 Bug: 36160015 Bug: 37193650 Bug: 37231161 Bug: 37488099 Bug: 37516160 Bug: 38045152 Bug: 38117720 Bug: 38502532 Bug: 62390017 Bug: 63245673 Bug: 63260873 Bug: 63785372 Bug: 64672411 Bug: 70278506 Bug: 72007585 Bug: 73055997 Bug: 73287721 Bug: 75987238 Bug: 77923821 Bug: 78262592 Bug: 111641492 Bug: 111642636 Bug: 111860541 Bug: 120446149 Change-Id: Ic1e01e602ce335d97342be54f3da0c5c65c087cc Signed-off-by: Daniel Rosenberg <drosen@google.com> [astrachan: Folded the following changes into this patch: 903cea7ab0b2 ("ANDROID: Included sdcardfs source code for kernel 3.0") 612a725e3d97 ("ANDROID: Port of sdcardfs to 4.4") e4187c55208b ("ANDROID: Changed type-casting in packagelist management") cf76072a5cd8 ("ANDROID: sdcardfs: Bring up to date with Android M permissions:") a43aa502c608 ("ANDROID: sdcardfs: Add support for d_canonical_path") d8fefbf85af2 ("ANDROID: sdcardfs: remove effectless config option") 416677409336 ("ANDROID: sdcardfs: Remove unused code") 8e49a570d351 ("ANDROID: sdcardfs: remove unneeded __init and __exit") 40ee0e93f1d7 ("ANDROID: sdcardfs: Truncate packages_gid.list on overflow") b1d9602aa3fe ("ANDROID: sdcardfs: fix itnull.cocci warnings") 60a177f5a167 ("ANDROID: sdcardfs: override umask on mkdir and create") efb3d2695203 ("ANDROID: sdcardfs: Check for other cases on path lookup") 0da87f63666f ("ANDROID: sdcardfs: Fix locking for permission fix up") 75b93060655e ("ANDROID: sdcardfs: Switch package list to RCU") 657b0a00f497 ("ANDROID: sdcardfs: Added top to sdcardfs_inode_info") 5008d91cba25 ("ANDROID: sdcardfs: fix external storage exporting incorrect uid") e06c452d0d07 ("ANDROID: sdcardfs: Move directory unlock before touch") 72e5443a2816 ("ANDROID: sdcardfs: User new permission2 functions") ae8be7da556d ("ANDROID: sdcardfs: Add gid and mask to private mount data") 151a3efe57a6 ("ANDROID: sdcardfs: Use per mount permissions") cff865a370f3 ("ANDROID: sdcardfs: Switch ->d_inode to d_inode()") 065ac66804bf ("ANDROID: sdcardfs: Fix locking issue with permision fix up") 31ea603eb3c4 ("ANDROID: sdcardfs: use wrappers to access i_mutex") c25c2f5018a2 ("ANDROID: sdcardfs: add parent pointer into dentry name hash") 58616bb4ec68 ("ANDROID: sdcardfs: get rid of 'parent' argument of ->d_compare()") 1654d7ffdd20 ("ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()") 39335cac1d2f ("ANDROID: sdcardfs: make it use new .rename i_op") 7622bb3fcc79 ("ANDROID: sdcardfs: eliminate the offset argument to ->direct_IO") 843bd7295ee0 ("ANDROID: sdcardfs: Allow non-owners to touch") e3d74804d174 ("ANDROID: sdcardfs: Refactor configfs interface") 5833eda87a72 ("ANDROID: sdcardfs: add support for user permission isolation") d83fb1f41dd4 ("ANDROID: sdcardfs: Remove redundant operation") 8767af17c0e5 ("ANDROID: sdcardfs: Add GID Derivation to sdcardfs") 7119d96ad3ee ("ANDROID: sdcardfs: switch to full_name_hash and qstr") 778e02a54859 ("ANDROID: sdcardfs: Switch strcasecmp for internal call") cd4965d04404 ("ANDROID: sdcardfs: Fix incorrect hash") 40a2ee053505 ("ANDROID: sdcardfs: Add missing path_put") da5342bac57a ("ANDROID: sdcardfs: Don't bother deleting freelist") c91857b01e05 ("ANDROID: sdcardfs: implement vm_ops->page_mkwrite") f62b3906044b ("ANDROID: sdcardfs: support direct-IO (DIO) operations") c2e216d36d63 ("ANDROID: sdcardfs: Fix case insensitive lookup") 57b92ab6f774 ("ANDROID: sdcardfs: rate limit warning print") 8534cee39a81 ("ANDROID: sdcardfs: Replace get/put with d_lock") 156085b2fccf ("ANDROID: sdcardfs: Use spin_lock_nested") 8a260cabac4e ("ANDROID: sdcardfs: Switch to internal case insensitive compare") a8d51569573c ("ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve") 932a6071de63 ("ANDROID: sdcardfs: Get the blocksize from the lower fs") 0ad4c0f87527 ("ANDROID: sdcardfs: declare MODULE_ALIAS_FS") b97c83b5b683 ("ANDROID: sdcardfs: Use case insensitive hash function") 9920dfb08265 ("ANDROID: sdcardfs: move path_put outside of spinlock") f9a25348b233 ("ANDROID: sdcardfs: Remove uninformative prints") 720d9030bea1 ("ANDROID: sdcardfs: Fix gid issue") 4cbb7fa6e66c ("ANDROID: sdcardfs: correct order of descriptors") 6cff6cc301ed ("ANDROID: sdcardfs: Fix formatting") ac2a40412e26 ("ANDROID: sdcardfs: Fix style issues with comments") 2212bb8ec064 ("ANDROID: sdcardfs: remove unneeded null check") 4c1a0add8d21 ("ANDROID: sdcardfs: Use pr_[...] instead of printk") 74535fe211ac ("ANDROID: sdcardfs: Use to kstrout") e6cf8dffd014 ("ANDROID: sdcardfs: Use seq_puts over seq_printf") 2b1ac93a90b6 ("ANDROID: sdcardfs: Fix style issues in macros") bab6d117426f ("ANDROID: sdcardfs: remove unnecessary call to do_munmap") 1c0bf09f19b6 ("ANDROID: sdcardfs: copy lower inode attributes in ->ioctl") 42f3db55942b ("ANDROID: sdcardfs: fix ->llseek to update upper and lower offset") 97ad6205055e ("ANDROID: sdcardfs: add read_iter/write_iter opeations") be9abc81332b ("ANDROID: sdcardfs: use d_splice_alias") 4e90114cb1b4 ("ANDROID: sdcardfs: update module info") 0e1f7ab14924 ("ANDROID: sdcardfs: Directly pass lower file for mmap") 28be4beb43f9 ("ANDROID: sdcardfs: Change cache GID value") 9fc2c452aefe ("ANDROID: sdcardfs: ->iget fixes") 9bb72cf15cbc ("ANDROID: sdcardfs: Don't do d_add for lower fs") 1bc21a04c11b ("ANDROID: sdcardfs: Don't complain in fixup_lower_ownership") 0fb5b10b28a9 ("ANDROID: sdcardfs: Use filesystem specific hash") 30e2f0aadce2 ("ANDROID: sdcardfs: Copy meta-data from lower inode") f748c7053194 ("ANDROID: sdcardfs: Avoid setting GIDs outside of valid ranges") 3d38f08bacdb ("ANDROID: sdcardfs: Call lower fs's revalidate") 2d1f1c203978 ("ANDROID: sdcardfs: Don't iput if we didn't igrab") 857fc5e717fc ("ANDROID: sdcardfs: fix sdcardfs_destroy_inode for the inode RCU approach") 4fceeccf1d23 ("ANDROID: sdcardfs: Move top to its own struct") f51470044a15 ("ANDROID: sdcardfs: Check for NULL in revalidate") 8c7f6c97ac81 ("ANDROID: sdcardfs: d_splice_alias can return error values") 17da01b37d61 ("ANDROID: sdcardfs: remove dead function open_flags_to_access_mode()") 16662dd604be ("ANDROID: sdcardfs: use mount_nodev and fix a issue in sdcardfs_kill_sb") 43c0dca6039a ("ANDROID: sdcardfs: Remove unnecessary lock") 48960c25cdc1 ("ANDROID: sdcardfs: override credential for ioctl to lower fs") 5d6410b9a88d ("ANDROID: Sdcardfs: Move gid derivation under flag") c7dd98431f83 ("ANDROID: sdcardfs: Add default_normal option") db9bf31a5d86 ("ANDROID: sdcardfs: port to 4.14") c70c9d1e82d2 ("ANDROID: sdcardfs: Use lower getattr times/size") 04e961477d62 ("ANDROID: sdcardfs: Protect set_top") 1ed04b79d281 ("ANDROID: sdcardfs: Hold i_mutex for i_size_write") 77f52fc10982 ("ANDROID: sdcardfs: Set num in extension_details during make_item") d71596efa247 ("ANDROID: sdcardfs: fix lock issue on 32 bit/SMP architectures") ee6b07fced4a ("ANDROID: sdcardfs: Fix sdcardfs to stop creating cases-sensitive duplicate entries.") ce12807d5b75 ("ANDROID: sdcardfs: Check for private data earlier") c080450304cd ("ANDROID: sdcardfs: d_make_root calls iput") 900e77796781 ("ANDROID: sdcardfs: Set s_root to NULL after putting") 49092e89ffa4 ("ANDROID: sdcardfs: Don't d_drop in d_revalidate") e1f978bc9b9c ("ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero") faa148eaf8ed ("ANDROID: sdcardfs: Check stacked filesystem depth") 6edd721e972c ("ANDROID: sdcardfs: Don't use OVERRIDE_CRED macro") 11ca578b4336 ("ANDROID: sdcardfs: Change current->fs under lock") 83dea6ba6ea7 ("ANDROID: sdcardfs: Use inode iversion helpers") 12064f3a794e ("ANDROID: sdcardfs: Add option to drop unused dentries") d9fe221bbf84 ("ANDROID: sdcardfs: Add sandbox") f544ad0b1547 ("ANDROID: sdcardfs: Add option to not link obb")] Signed-off-by: Alistair Strachan <astrachan@google.com>
2015-07-20 17:23:50 -06:00
case Opt_gid_derivation:
if (!silent)
pr_warn("Option \"%s\" can't be changed during remount\n", p);
break;
/* unknown option */
default:
if (!silent)
pr_err("Unrecognized mount option \"%s\" or missing value", p);
return -EINVAL;
}
}
if (debug) {
pr_info("sdcardfs : options - debug:%d\n", debug);
pr_info("sdcardfs : options - gid:%d\n", vfsopts->gid);
pr_info("sdcardfs : options - mask:%d\n", vfsopts->mask);
}
return 0;
}
#if 0
/*
* our custom d_alloc_root work-alike
*
* we can't use d_alloc_root if we want to use our own interpose function
* unchanged, so we simply call our own "fake" d_alloc_root
*/
static struct dentry *sdcardfs_d_alloc_root(struct super_block *sb)
{
struct dentry *ret = NULL;
if (sb) {
static const struct qstr name = {
.name = "/",
.len = 1
};
ret = d_alloc(NULL, &name);
if (ret) {
d_set_d_op(ret, &sdcardfs_ci_dops);
ret->d_sb = sb;
ret->d_parent = ret;
}
}
return ret;
}
#endif
DEFINE_MUTEX(sdcardfs_super_list_lock);
EXPORT_SYMBOL_GPL(sdcardfs_super_list_lock);
LIST_HEAD(sdcardfs_super_list);
EXPORT_SYMBOL_GPL(sdcardfs_super_list);
/*
* There is no need to lock the sdcardfs_super_info's rwsem as there is no
* way anyone can have a reference to the superblock at this point in time.
*/
static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb,
const char *dev_name, void *raw_data, int silent)
{
int err = 0;
int debug;
struct super_block *lower_sb;
struct path lower_path;
struct sdcardfs_sb_info *sb_info;
struct sdcardfs_vfsmount_options *mnt_opt = mnt->data;
struct inode *inode;
pr_info("sdcardfs version 2.0\n");
if (!dev_name) {
pr_err("sdcardfs: read_super: missing dev_name argument\n");
err = -EINVAL;
goto out;
}
pr_info("sdcardfs: dev_name -> %s\n", dev_name);
pr_info("sdcardfs: options -> %s\n", (char *)raw_data);
pr_info("sdcardfs: mnt -> %p\n", mnt);
/* parse lower path */
err = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY,
&lower_path);
if (err) {
pr_err("sdcardfs: error accessing lower directory '%s'\n", dev_name);
goto out;
}
/* allocate superblock private data */
sb->s_fs_info = kzalloc(sizeof(struct sdcardfs_sb_info), GFP_KERNEL);
if (!SDCARDFS_SB(sb)) {
pr_crit("sdcardfs: read_super: out of memory\n");
err = -ENOMEM;
goto out_free;
}
sb_info = sb->s_fs_info;
/* parse options */
err = parse_options(sb, raw_data, silent, &debug, mnt_opt, &sb_info->options);
if (err) {
pr_err("sdcardfs: invalid options\n");
goto out_freesbi;
}
/* set the lower superblock field of upper superblock */
lower_sb = lower_path.dentry->d_sb;
atomic_inc(&lower_sb->s_active);
sdcardfs_set_lower_super(sb, lower_sb);
sb->s_stack_depth = lower_sb->s_stack_depth + 1;
if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {
pr_err("sdcardfs: maximum fs stacking depth exceeded\n");
err = -EINVAL;
goto out_sput;
}
/* inherit maxbytes from lower file system */
sb->s_maxbytes = lower_sb->s_maxbytes;
/*
* Our c/m/atime granularity is 1 ns because we may stack on file
* systems whose granularity is as good.
*/
sb->s_time_gran = 1;
sb->s_magic = SDCARDFS_SUPER_MAGIC;
sb->s_op = &sdcardfs_sops;
/* get a new inode and allocate our root dentry */
inode = sdcardfs_iget(sb, d_inode(lower_path.dentry), 0);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto out_sput;
}
sb->s_root = d_make_root(inode);
if (!sb->s_root) {
err = -ENOMEM;
goto out_sput;
}
d_set_d_op(sb->s_root, &sdcardfs_ci_dops);
/* link the upper and lower dentries */
sb->s_root->d_fsdata = NULL;
err = new_dentry_private_data(sb->s_root);
if (err)
goto out_freeroot;
/* set the lower dentries for s_root */
sdcardfs_set_lower_path(sb->s_root, &lower_path);
/*
* No need to call interpose because we already have a positive
* dentry, which was instantiated by d_make_root. Just need to
* d_rehash it.
*/
d_rehash(sb->s_root);
/* setup permission policy */
sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
mutex_lock(&sdcardfs_super_list_lock);
if (sb_info->options.multiuser) {
setup_derived_state(d_inode(sb->s_root), PERM_PRE_ROOT,
sb_info->options.fs_user_id, AID_ROOT);
snprintf(sb_info->obbpath_s, PATH_MAX, "%s/obb", dev_name);
} else {
setup_derived_state(d_inode(sb->s_root), PERM_ROOT,
sb_info->options.fs_user_id, AID_ROOT);
snprintf(sb_info->obbpath_s, PATH_MAX, "%s/Android/obb", dev_name);
}
fixup_tmp_permissions(d_inode(sb->s_root));
sb_info->sb = sb;
list_add(&sb_info->list, &sdcardfs_super_list);
mutex_unlock(&sdcardfs_super_list_lock);
sb_info->fscrypt_nb.notifier_call = sdcardfs_on_fscrypt_key_removed;
fscrypt_register_key_removal_notifier(&sb_info->fscrypt_nb);
if (!silent)
pr_info("sdcardfs: mounted on top of %s type %s\n",
dev_name, lower_sb->s_type->name);
goto out; /* all is well */
/* no longer needed: free_dentry_private_data(sb->s_root); */
out_freeroot:
dput(sb->s_root);
sb->s_root = NULL;
out_sput:
/* drop refs we took earlier */
atomic_dec(&lower_sb->s_active);
out_freesbi:
kfree(SDCARDFS_SB(sb));
sb->s_fs_info = NULL;
out_free:
path_put(&lower_path);
out:
return err;
}
struct sdcardfs_mount_private {
struct vfsmount *mnt;
const char *dev_name;
void *raw_data;
};
static int __sdcardfs_fill_super(
struct super_block *sb,
void *_priv, int silent)
{
struct sdcardfs_mount_private *priv = _priv;
return sdcardfs_read_super(priv->mnt,
sb, priv->dev_name, priv->raw_data, silent);
}
static struct dentry *sdcardfs_mount(struct vfsmount *mnt,
struct file_system_type *fs_type, int flags,
const char *dev_name, void *raw_data)
{
struct sdcardfs_mount_private priv = {
.mnt = mnt,
.dev_name = dev_name,
.raw_data = raw_data
};
return mount_nodev(fs_type, flags,
&priv, __sdcardfs_fill_super);
}
static struct dentry *sdcardfs_mount_wrn(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data)
{
WARN(1, "sdcardfs does not support mount. Use mount2.\n");
return ERR_PTR(-EINVAL);
}
void *sdcardfs_alloc_mnt_data(void)
{
return kmalloc(sizeof(struct sdcardfs_vfsmount_options), GFP_KERNEL);
}
void sdcardfs_kill_sb(struct super_block *sb)
{
struct sdcardfs_sb_info *sbi;
if (sb->s_magic == SDCARDFS_SUPER_MAGIC && sb->s_fs_info) {
sbi = SDCARDFS_SB(sb);
fscrypt_unregister_key_removal_notifier(&sbi->fscrypt_nb);
mutex_lock(&sdcardfs_super_list_lock);
list_del(&sbi->list);
mutex_unlock(&sdcardfs_super_list_lock);
}
kill_anon_super(sb);
}
static struct file_system_type sdcardfs_fs_type = {
.owner = THIS_MODULE,
.name = SDCARDFS_NAME,
.mount = sdcardfs_mount_wrn,
.mount2 = sdcardfs_mount,
.alloc_mnt_data = sdcardfs_alloc_mnt_data,
.kill_sb = sdcardfs_kill_sb,
.fs_flags = 0,
};
MODULE_ALIAS_FS(SDCARDFS_NAME);
static int __init init_sdcardfs_fs(void)
{
int err;
pr_info("Registering sdcardfs " SDCARDFS_VERSION "\n");
err = sdcardfs_init_inode_cache();
if (err)
goto out;
err = sdcardfs_init_dentry_cache();
if (err)
goto out;
err = packagelist_init();
if (err)
goto out;
err = register_filesystem(&sdcardfs_fs_type);
out:
if (err) {
sdcardfs_destroy_inode_cache();
sdcardfs_destroy_dentry_cache();
packagelist_exit();
}
return err;
}
static void __exit exit_sdcardfs_fs(void)
{
sdcardfs_destroy_inode_cache();
sdcardfs_destroy_dentry_cache();
packagelist_exit();
unregister_filesystem(&sdcardfs_fs_type);
pr_info("Completed sdcardfs module unload\n");
}
/* Original wrapfs authors */
MODULE_AUTHOR("Erez Zadok, Filesystems and Storage Lab, Stony Brook University (http://www.fsl.cs.sunysb.edu/)");
/* Original sdcardfs authors */
MODULE_AUTHOR("Woojoong Lee, Daeho Jeong, Kitae Lee, Yeongjin Gil System Memory Lab., Samsung Electronics");
/* Current maintainer */
MODULE_AUTHOR("Daniel Rosenberg, Google");
MODULE_DESCRIPTION("Sdcardfs " SDCARDFS_VERSION);
MODULE_LICENSE("GPL");
module_init(init_sdcardfs_fs);
module_exit(exit_sdcardfs_fs);