summaryrefslogtreecommitdiff
path: root/packages/linux-uml/linux-uml-2.4.26/unbreak-hostfs.patch
blob: 3c77dae72813b64f90bcfbbd5e721c817344439f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- linux-2.4.26/arch/um/fs/hostfs/externfs.c~unbreak-hostfs	2004-05-18 22:01:16.000000000 +0200
+++ linux-2.4.26/arch/um/fs/hostfs/externfs.c	2004-05-18 22:43:11.000000000 +0200
@@ -1133,7 +1133,7 @@
 	if((mount_arg != NULL) && (*mount_arg != '\0'))
 		root = mount_arg;
 
-	return(uml_strdup(mount_arg));
+	return(uml_strdup(root));
 }
 
 struct super_block *hostfs_read_super(struct super_block *sb, void *data, 
--- linux-2.4.26/arch/um/fs/hostfs/host_file.c~unbreak-hostfs	2004-05-18 22:01:16.000000000 +0200
+++ linux-2.4.26/arch/um/fs/hostfs/host_file.c	2004-05-18 22:45:17.000000000 +0200
@@ -72,28 +72,21 @@
 {
 	char tmp[HOSTFS_BUFSIZE], *file;
 	int mode = 0, err;
+	struct openflags flags = OPENFLAGS();
 
-	if(r && !w) 
-		mode = O_RDONLY;
-	else if(!r && w) 
-		mode = O_WRONLY;
-	else if(r && w) 
-		mode = O_RDWR;
-	else {
-	  	printk("Impossible mode in host_open_file - r = %d, w = %d", 
-		       r, w);
-		return(-EINVAL);
-	}
-
+	if (r)
+		flags = of_read(flags);
+	if (w)
+		flags = of_write(flags);
 	if(append)
-		mode |= O_APPEND;
+		flags = of_append(flags);
 
 	err = -ENOMEM;
 	file = get_path(path, tmp, sizeof(tmp));
 	if(file == NULL)
 		goto out;
 	
-	err = open_filehandle(file, of_create(of_rdwr(OPENFLAGS())), mode, fh);
+	err = open_filehandle(file, flags, 0, fh);
  out:
 	free_path(file, tmp);
 	return(err);
--- linux-2.4.26/arch/um/fs/hostfs/host_fs.c~unbreak-hostfs	2004-05-18 22:01:16.000000000 +0200
+++ linux-2.4.26/arch/um/fs/hostfs/host_fs.c	2004-05-18 22:50:11.000000000 +0200
@@ -111,10 +111,13 @@
 {
 	const char *path[] = { jail_dir, mount, file, NULL };
 	int uid;
+	int gid;
+	int rc;
 
 	*uid_out = 0;
+	*gid_out = 0;
 	return(host_stat_file(path, dev_out, inode_out, mode_out, nlink_out, 
-			      &uid, gid_out, size_out, atime_out, mtime_out, 
+			      &uid, &gid, size_out, atime_out, mtime_out, 
 			      ctime_out, blksize_out, blocks_out));
 }
 
@@ -138,6 +141,12 @@
 		goto out;
 
 	err = host_open_file(path, 1, 1, fh);
+	if (err == -EISDIR) {
+		kfree(fh);
+		return NULL;
+	}
+	if (err == -EPERM)
+		err = host_open_file(path, 1, 0, fh);
 	if(err)
 		goto out_free;
 
@@ -175,10 +184,9 @@
 				len - ignore_end);
 
  out:
-	if(err < 0)
-		(*completion)(buf, err, arg);
-	else err = 0;
-
+	(*completion)(buf, err, arg);
+	if (err > 0)
+		err = 0;
 	return(err);
 }
 
@@ -191,8 +199,9 @@
 
 	err = write_file(fh, offset + start, buf + start, len);
 
-	if(err < 0)
-		(*completion)((char *) buf, err, arg);
+	(*completion)((char *) buf, err, arg);
+	if (err > 0)
+		err = 0;
 	return(err);
 }