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

Commit 0c6cc257 authored by Michael Halcrow's avatar Michael Halcrow Committed by Mohamad Ayyash
Browse files

ext4 crypto: export ext4_empty_dir()



Required for future encryption xattr changes.

Change-Id: Ieaff30ae755d76f562c6c4b110bc0c1c59ea4dfd
Signed-off-by: default avatarMichael Halcrow <mhalcrow@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@google.com>
parent 6e8b0597
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2192,6 +2192,7 @@ extern int ext4_generic_delete_entry(handle_t *handle,
				     void *entry_buf,
				     void *entry_buf,
				     int buf_size,
				     int buf_size,
				     int csum_size);
				     int csum_size);
extern int ext4_empty_dir(struct inode *inode);


/* resize.c */
/* resize.c */
extern int ext4_group_add(struct super_block *sb,
extern int ext4_group_add(struct super_block *sb,
+6 −5
Original line number Original line Diff line number Diff line
@@ -2450,7 +2450,7 @@ out_stop:
/*
/*
 * routine to check that the specified directory is empty (for rmdir)
 * routine to check that the specified directory is empty (for rmdir)
 */
 */
static int empty_dir(struct inode *inode)
int ext4_empty_dir(struct inode *inode)
{
{
	unsigned int offset;
	unsigned int offset;
	struct buffer_head *bh;
	struct buffer_head *bh;
@@ -2718,7 +2718,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
		goto end_rmdir;
		goto end_rmdir;


	retval = -ENOTEMPTY;
	retval = -ENOTEMPTY;
	if (!empty_dir(inode))
	if (!ext4_empty_dir(inode))
		goto end_rmdir;
		goto end_rmdir;


	handle = ext4_journal_start(dir, EXT4_HT_DIR,
	handle = ext4_journal_start(dir, EXT4_HT_DIR,
@@ -3273,7 +3273,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
	if (S_ISDIR(old.inode->i_mode)) {
	if (S_ISDIR(old.inode->i_mode)) {
		if (new.inode) {
		if (new.inode) {
			retval = -ENOTEMPTY;
			retval = -ENOTEMPTY;
			if (!empty_dir(new.inode))
			if (!ext4_empty_dir(new.inode))
				goto end_rename;
				goto end_rename;
		} else {
		} else {
			retval = -EMLINK;
			retval = -EMLINK;
@@ -3347,8 +3347,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,


		ext4_dec_count(handle, old.dir);
		ext4_dec_count(handle, old.dir);
		if (new.inode) {
		if (new.inode) {
			/* checked empty_dir above, can't have another parent,
			/* checked ext4_empty_dir above, can't have another
			 * ext4_dec_count() won't work for many-linked dirs */
			 * parent, ext4_dec_count() won't work for many-linked
			 * dirs */
			clear_nlink(new.inode);
			clear_nlink(new.inode);
		} else {
		} else {
			ext4_inc_count(handle, new.dir);
			ext4_inc_count(handle, new.dir);