commit 95dba60de607dd8d2cbef9e147e0e5116d56da96
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Sat May 19 16:52:03 2007 -0400
cleanup: eliminate wrapper function copyup_dentry
Eliminate simple wrapper function copyup_dentry which trivially called
copyup_named_dentry with 2 more args derived from the caller. Instead,
remove the wrapper, rename copyup_named_dentry to copyup_dentry, and make
everyone call copyup_dentry directly. This clarifies the code a bit more
and saves a bit on stack space.
Conflicts:
fs/unionfs/inode.c
fs/unionfs/rename.c
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index
4bf51b28d4c1061bf33aaa01f7642db3d99a23c2..4528f9de9f71cc0c708a026c9065de568234b70d
100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -24,10 +24,6 @@ #include "union.h"
*/
/* forward definitions */
-static int copyup_named_dentry(struct inode *dir, struct dentry *dentry,
- int bstart, int new_bindex, const char *name,
- int namelen, struct file **copyup_file,
- loff_t len);
static struct dentry *create_parents_named(struct inode *dir,
struct dentry *dentry,
const char *name, int bindex);
@@ -128,15 +124,6 @@ static int copyup_permissions(struct sup
return err;
}
-int copyup_dentry(struct inode *dir, struct dentry *dentry,
- int bstart, int new_bindex,
- struct file **copyup_file, loff_t len)
-{
- return copyup_named_dentry(dir, dentry, bstart, new_bindex,
- dentry->d_name.name,
- dentry->d_name.len, copyup_file, len);
-}
-
/*
* create the new device/file/directory - use copyup_permission to copyup
* times, and mode
@@ -351,10 +338,9 @@ static void __clear(struct dentry *dentr
* @copyup_file: the "struct file" to return (optional)
* @len: how many bytes to copy-up?
*/
-static int copyup_named_dentry(struct inode *dir, struct dentry *dentry,
- int bstart, int new_bindex, const char *name,
- int namelen, struct file **copyup_file,
- loff_t len)
+int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
+ int new_bindex, const char *name, int namelen,
+ struct file **copyup_file, loff_t len)
{
struct dentry *new_hidden_dentry;
struct dentry *old_hidden_dentry = NULL;
@@ -535,9 +521,8 @@ int copyup_named_file(struct inode *dir,
int err = 0;
struct file *output_file = NULL;
- err = copyup_named_dentry(dir, file->f_dentry, bstart,
- new_bindex, name, strlen(name), &output_file,
- len);
+ err = copyup_dentry(dir, file->f_dentry, bstart, new_bindex,
+ name, strlen(name), &output_file, len);
if (!err) {
fbstart(file) = new_bindex;
unionfs_set_lower_file_idx(file, new_bindex, output_file);
@@ -555,8 +540,10 @@ int copyup_file(struct inode *dir, struc
{
int err = 0;
struct file *output_file = NULL;
+ struct dentry *dentry = file->f_dentry;
- err = copyup_dentry(dir, file->f_dentry, bstart, new_bindex,
+ err = copyup_dentry(dir, dentry, bstart, new_bindex,
+ dentry->d_name.name, dentry->d_name.len,
&output_file, len);
if (!err) {
fbstart(file) = new_bindex;
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index
4e33e74eabf8716a6b443168cf76410a086fb5ed..6573adb81804d68885631812060f219a2afe5648
100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -213,10 +213,11 @@ docopyup:
int old_bstart = dbstart(old_dentry);
int bindex = 0;
- err = copyup_dentry(old_dentry->d_parent->
- d_inode, old_dentry,
- old_bstart, bindex, NULL,
- old_dentry->d_inode->i_size);
+ err = copyup_dentry(old_dentry->d_parent->d_inode,
+ old_dentry, old_bstart, bindex,
+ old_dentry->d_name.name,
+ old_dentry->d_name.len,
+ NULL, old_dentry->d_inode->i_size);
if (!err) {
hidden_new_dentry =
create_parents(dir, new_dentry, bindex);
@@ -762,8 +763,10 @@ static int unionfs_setattr(struct dentry
if (ia->ia_valid & ATTR_SIZE)
size = ia->ia_size;
err = copyup_dentry(dentry->d_parent->d_inode,
- dentry, bstart, i, NULL,
- size);
+ dentry, bstart, i,
+ dentry->d_name.name,
+ dentry->d_name.len,
+ NULL, size);
if (!err) {
copyup = 1;
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index
4e106b65756e11107686a7e64b6dd5d2485e9d4c..2c72d89f1cfdae1a86183d1b14335c7d20aa7ad5
100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -201,8 +201,10 @@ static int do_unionfs_rename(struct inod
else {
/* otherwise do regular copyup & rename */
err = copyup_dentry(old_dentry->d_parent->d_inode,
- old_dentry, old_bstart, bindex, NULL,
- old_dentry->d_inode->i_size);
+ old_dentry, old_bstart, bindex,
+ old_dentry->d_name.name,
+ old_dentry->d_name.len,
+ NULL, old_dentry->d_inode->i_size);
if (!err)
err = __unionfs_rename(old_dir, old_dentry,
new_dir,
new_dentry, bindex);
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index
189f581ffe24a1a5f84d9be6c8b977fa79bc16ff..319520165ccfbc285dcbd1e74960be51dec17287
100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -274,9 +274,9 @@ extern int copyup_named_file(struct inod
char *name, int bstart, int new_bindex,
loff_t len);
/* copies a dentry from dbstart to newbindex branch */
-extern int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
- int new_bindex, struct file **copyup_file,
- loff_t len);
+extern int copyup_dentry(struct inode *dir, struct dentry *dentry,
+ int bstart, int new_bindex, const char *name,
+ int namelen, struct file **copyup_file, loff_t len);
/* helper functions for post-copyup cleanup */
extern void unionfs_inherit_mnt(struct dentry *dentry);
extern void unionfs_purge_extras(struct dentry *dentry);
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs