[U-Boot] [PATCH 3/3] btrfs: removed btrfs_mangle_name

Stefan Agner stefan at agner.ch
Mon Jul 1 21:17:09 CEST 2013


The function btrfs_mangle_name limited path lenght to 20 characters. 
Since
the command parsing already checks spaces, the function is not needed at 
all.
---
  fs/btrfs/btrfs.c | 44 +-------------------------------------------
  1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index e4dfd67..84184f1 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -906,46 +906,6 @@ void btrfs_close_file(struct file *file)
  	free_file(file);
  }

-void btrfs_mangle_name(char *dst, const char *src)
-{
-	char *p = dst, ch, len;
-	int i = BTRFS_FILENAME_MAX-1;
-
-	len = strlen(src);
-	ch = *src;
-	while (!isspace(ch)) {
-		if (*src == '/') {
-			if (src[1] == '/') {
-				src++;
-				i--;
-				continue;
-			}
-		}
-		if (!len)
-			break;
-		i--;
-		len--;
-		*dst++ = *src++;
-		ch = *src;
-	}
-	while (1) {
-		if (dst == p)
-			break;
-		if (dst[-1] != '/')
-			break;
-		if ((dst[-1] == '/') && ((dst - 1) == p))
-			break;
-
-		dst--;
-		i++;
-	}
-
-	i++;
-	for (; i > 0; i--)
-		*dst++ = '\0';
-
-}
-
  int searchdir(const char *name)
  {
  	struct inode *inode = NULL;
@@ -1088,10 +1048,8 @@ int btrfs_open_file(const char *name, struct 
com32_filedata *filedata)
  {
  	int rv;
  	struct file *file;
-	char mangled_name[BTRFS_FILENAME_MAX];

-	btrfs_mangle_name(mangled_name, name);
-	rv = searchdir(mangled_name);
+	rv = searchdir(name);
  	if (rv < 0)
  		return rv;

-- 
1.8.3.1




More information about the U-Boot mailing list