Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e024f6a authored by Daniel Rosenberg's avatar Daniel Rosenberg
Browse files

ANDROID: sdcardfs: Fix formatting



This fixes various spacing and bracket related issues
pointed out by checkpatch.

Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Bug: 35331000
Change-Id: I6e248833a7a04e3899f3ae9462d765cfcaa70c96
parent 9608a4aa
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@ static int sdcardfs_d_revalidate(struct dentry *dentry, unsigned int flags)
	spin_unlock(&dentry->d_lock);

	/* check uninitialized obb_dentry and
	 * whether the base obbpath has been changed or not */
	 * whether the base obbpath has been changed or not
	 */
	if (is_obbpath_invalid(dentry)) {
		d_drop(dentry);
		return 0;
@@ -106,12 +107,10 @@ static int sdcardfs_d_revalidate(struct dentry *dentry, unsigned int flags)
static void sdcardfs_d_release(struct dentry *dentry)
{
	/* release and reset the lower paths */
	if(has_graft_path(dentry)) {
	if (has_graft_path(dentry))
		sdcardfs_put_reset_orig_path(dentry);
	}
	sdcardfs_put_reset_lower_path(dentry);
	free_dentry_private_data(dentry);
	return;
}

static int sdcardfs_hash_ci(const struct dentry *dentry,
@@ -167,7 +166,9 @@ static int sdcardfs_cmp_ci(const struct dentry *dentry,
	return 1;
}

static void sdcardfs_canonical_path(const struct path *path, struct path *actual_path) {
static void sdcardfs_canonical_path(const struct path *path,
				struct path *actual_path)
{
	sdcardfs_get_real_lower(path->dentry, actual_path);
}

+31 −24
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ static void inherit_derived_state(struct inode *parent, struct inode *child)

/* helper function for derived state */
void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid,
                        uid_t uid, bool under_android, struct inode *top)
						uid_t uid, bool under_android,
						struct inode *top)
{
	struct sdcardfs_inode_info *info = SDCARDFS_I(inode);

@@ -50,8 +51,11 @@ void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid,
	set_top(info, top);
}

/* While renaming, there is a point where we want the path from dentry, but the name from newdentry */
void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, const struct qstr *name)
/* While renaming, there is a point where we want the path from dentry,
 * but the name from newdentry
 */
void get_derived_permission_new(struct dentry *parent, struct dentry *dentry,
				const struct qstr *name)
{
	struct sdcardfs_inode_info *info = SDCARDFS_I(d_inode(dentry));
	struct sdcardfs_inode_info *parent_info = SDCARDFS_I(d_inode(parent));
@@ -118,9 +122,8 @@ void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, co
	case PERM_ANDROID_MEDIA:
		info->perm = PERM_ANDROID_PACKAGE;
		appid = get_appid(name->name);
		if (appid != 0 && !is_excluded(name->name, parent_info->userid)) {
		if (appid != 0 && !is_excluded(name->name, parent_info->userid))
			info->d_uid = multiuser_get_uid(parent_info->userid, appid);
		}
		set_top(info, &info->vfs_inode);
		break;
	case PERM_ANDROID_PACKAGE:
@@ -257,7 +260,8 @@ static int descendant_may_need_fixup(struct sdcardfs_inode_info *info, struct li
	return 0;
}

static int needs_fixup(perm_t perm) {
static int needs_fixup(perm_t perm)
{
	if (perm == PERM_ANDROID_DATA || perm == PERM_ANDROID_OBB
			|| perm == PERM_ANDROID_MEDIA)
		return 1;
@@ -365,7 +369,8 @@ int is_obbpath_invalid(struct dentry *dent)

	/* check the base obbpath has been changed.
	 * this routine can check an uninitialized obb dentry as well.
	 * regarding the uninitialized obb, refer to the sdcardfs_mkdir() */
	 * regarding the uninitialized obb, refer to the sdcardfs_mkdir()
	 */
	spin_lock(&di->lock);
	if (di->orig_path.dentry) {
		if (!di->lower_path.dentry) {
@@ -423,7 +428,8 @@ int is_base_obbpath(struct dentry *dentry)
/* The lower_path will be stored to the dentry's orig_path
 * and the base obbpath will be copyed to the lower_path variable.
 * if an error returned, there's no change in the lower_path
 * returns: -ERRNO if error (0: no error) */
 * returns: -ERRNO if error (0: no error)
 */
int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
{
	int err = 0;
@@ -446,7 +452,8 @@ int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
		 * setup the lower_path with its orig_path.
		 * but, the current implementation just returns an error
		 * because the sdcard daemon also regards this case as
		 * a lookup fail. */
		 * a lookup fail.
		 */
		printk(KERN_INFO "sdcardfs: the sbi->obbpath is not available\n");
	}
	return err;
+1 −2
Original line number Diff line number Diff line
@@ -248,9 +248,8 @@ static int sdcardfs_open(struct inode *inode, struct file *file)

	if (err)
		kfree(SDCARDFS_F(file));
	else {
	else
		sdcardfs_copy_and_fix_attrs(inode, sdcardfs_lower_inode(inode));
	}

out_revert_cred:
	REVERT_CRED(saved_cred);
+18 −10
Original line number Diff line number Diff line
@@ -240,13 +240,14 @@ static int sdcardfs_symlink(struct inode *dir, struct dentry *dentry,
}
#endif

static int touch(char *abs_path, mode_t mode) {
static int touch(char *abs_path, mode_t mode)
{
	struct file *filp = filp_open(abs_path, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, mode);

	if (IS_ERR(filp)) {
		if (PTR_ERR(filp) == -EEXIST) {
			return 0;
		}
		else {
		} else {
			printk(KERN_ERR "sdcardfs: failed to open(%s): %ld\n",
						abs_path, PTR_ERR(filp));
			return PTR_ERR(filp);
@@ -322,12 +323,14 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
			/* if the sbi->obbpath is not available, the lower_path won't be
			 * changed by setup_obb_dentry() but the lower path is saved to
			 * its orig_path. this dentry will be revalidated later.
			 * but now, the lower_path should be NULL */
			 * but now, the lower_path should be NULL
			 */
			sdcardfs_put_reset_lower_path(dentry);

			/* the newly created lower path which saved to its orig_path or
			 * the lower_path is the base obbpath.
			 * therefore, an additional path_get is required */
			 * therefore, an additional path_get is required
			 */
			path_get(&lower_path);
		} else
			make_nomedia_in_obb = 1;
@@ -391,7 +394,8 @@ static int sdcardfs_rmdir(struct inode *dir, struct dentry *dentry)
	OVERRIDE_CRED(SDCARDFS_SB(dir->i_sb), saved_cred, SDCARDFS_I(dir));

	/* sdcardfs_get_real_lower(): in case of remove an user's obb dentry
	 * the dentry on the original path should be deleted. */
	 * the dentry on the original path should be deleted.
	 */
	sdcardfs_get_real_lower(dentry, &lower_path);

	lower_dentry = lower_path.dentry;
@@ -660,6 +664,7 @@ static int sdcardfs_permission(struct vfsmount *mnt, struct inode *inode, int ma
		 * we check it with AID_MEDIA_RW permission
		 */
		struct inode *lower_inode;

		OVERRIDE_CRED(SDCARDFS_SB(inode->sb));

		lower_inode = sdcardfs_lower_inode(inode);
@@ -730,7 +735,8 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
	/* prepare our own lower struct iattr (with the lower file) */
	memcpy(&lower_ia, ia, sizeof(lower_ia));
	/* Allow touch updating timestamps. A previous permission check ensures
	 * we have write access. Changes to mode, owner, and group are ignored*/
	 * we have write access. Changes to mode, owner, and group are ignored
	 */
	ia->ia_valid |= ATTR_FORCE;
	err = setattr_prepare(&tmp_d, ia);

@@ -816,10 +822,12 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
	return err;
}

static int sdcardfs_fillattr(struct vfsmount *mnt, struct inode *inode, struct kstat *stat)
static int sdcardfs_fillattr(struct vfsmount *mnt,
				struct inode *inode, struct kstat *stat)
{
	struct sdcardfs_inode_info *info = SDCARDFS_I(inode);
	struct inode *top = grab_top(info);

	if (!top)
		return -EINVAL;

+16 −14
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ static int sdcardfs_inode_test(struct inode *inode, void *candidate_data/*void *
{
	struct inode *current_lower_inode = sdcardfs_lower_inode(inode);
	userid_t current_userid = SDCARDFS_I(inode)->userid;

	if (current_lower_inode == ((struct inode_data *)candidate_data)->lower_inode &&
			current_userid == ((struct inode_data *)candidate_data)->id)
		return 1; /* found a match */
@@ -213,8 +214,8 @@ struct sdcardfs_name_data {
	bool found;
};

static int sdcardfs_name_match(struct dir_context *ctx, const char *name, int namelen,
		loff_t offset, u64 ino, unsigned int d_type)
static int sdcardfs_name_match(struct dir_context *ctx, const char *name,
		int namelen, loff_t offset, u64 ino, unsigned int d_type)
{
	struct sdcardfs_name_data *buf = container_of(ctx, struct sdcardfs_name_data, ctx);
	struct qstr candidate = QSTR_INIT(name, namelen);
@@ -303,7 +304,8 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
	if (!err) {
		/* check if the dentry is an obb dentry
		 * if true, the lower_inode must be replaced with
		 * the inode of the graft path */
		 * the inode of the graft path
		 */

		if (need_graft_path(dentry)) {

@@ -311,7 +313,8 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
			 * The lower_path will be stored to the dentry's orig_path
			 * and the base obbpath will be copyed to the lower_path variable.
			 * if an error returned, there's no change in the lower_path
			 * 		returns: -ERRNO if error (0: no error) */
			 * returns: -ERRNO if error (0: no error)
			 */
			err = setup_obb_dentry(dentry, &lower_path);

			if (err) {
@@ -319,7 +322,8 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
				 * setup the lower_path with its orig_path.
				 * but, the current implementation just returns an error
				 * because the sdcard daemon also regards this case as
				 * a lookup fail. */
				 * a lookup fail.
				 */
				printk(KERN_INFO "sdcardfs: base obbpath is not available\n");
				sdcardfs_put_reset_orig_path(dentry);
				goto out;
@@ -412,9 +416,7 @@ struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry,

	ret = __sdcardfs_lookup(dentry, flags, &lower_parent_path, SDCARDFS_I(dir)->userid);
	if (IS_ERR(ret))
	{
		goto out;
	}
	if (ret)
		dentry = ret;
	if (d_inode(dentry)) {
Loading