aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauricio Günther <mauricio@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-20 15:27:38 +0000
committerMauricio Günther <mauricio@140774ce-b5e7-0310-ab8b-a85725594a96>2012-03-20 15:27:38 +0000
commit72b3524cf9bfb7f55e4416d2a068a93372117d8d (patch)
treee9bbfe6292f281e205466e00d7136f593473352a
parentc7f3b7128015f609f0fe8f67e70bc61c90bf91d0 (diff)
downloadgnunet-fuse-72b3524cf9bfb7f55e4416d2a068a93372117d8d.tar.gz
gnunet-fuse-72b3524cf9bfb7f55e4416d2a068a93372117d8d.zip
-changes
-rw-r--r--src/ext/getattr.c102
-rw-r--r--src/ext/gnunet-fuse.c4
-rw-r--r--src/ext/open.c60
-rw-r--r--src/ext/read.c134
-rw-r--r--src/ext/readdir.c89
5 files changed, 33 insertions, 356 deletions
diff --git a/src/ext/getattr.c b/src/ext/getattr.c
index b6e0341..093cb9a 100644
--- a/src/ext/getattr.c
+++ b/src/ext/getattr.c
@@ -20,16 +20,28 @@
20 20
21int gn_getattr(const char *path, struct stat *stbuf) 21int gn_getattr(const char *path, struct stat *stbuf)
22{ 22{
23 int ret = 0; 23
24
25 memset(stbuf, 0, sizeof(*stbuf));
26 stbuf->st_mode = S_IFDIR | 0555;
27 stbuf->st_nlink = 1;
28 // stbuf->st_size = GNUNET_ECRS_uri_get_file_size(de->de_fi.uri);
29
30
31
32
33
34
35 /* int ret = 0;
24 //GNUNET_break (0); 36 //GNUNET_break (0);
25 memset(stbuf, 0, sizeof(struct stat)); 37 memset(stbuf, 0, sizeof(struct stat));
26 38
27 if(strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0) 39 if(strcmp(path, "") == 0)
28 { 40 {
29 stbuf->st_mode = S_IFDIR | 0755; 41 stbuf->st_mode = S_IFDIR | 0755;
30 stbuf->st_nlink = 1; // changed from 2 42 stbuf->st_nlink = 1; // changed from 2
31 } 43 }
32 44*/
33 45
34 /* 46 /*
35 else if(strcmp(path, directory) == 0) 47 else if(strcmp(path, directory) == 0)
@@ -49,9 +61,9 @@ int gn_getattr(const char *path, struct stat *stbuf)
49 61
50 */ 62 */
51 63
52 else return -ENOENT; 64/* else return -ENOENT;
53 65
54 return ret; 66 return ret; */
55 67
56 68
57 69
@@ -59,83 +71,3 @@ int gn_getattr(const char *path, struct stat *stbuf)
59} 71}
60 72
61 73
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/*
95static const char *archive_path = "/";
96static const char *archive_str = "/Archive\n";
97
98static const char *britney_path = "/Britney Spears";
99static const char *britney_str = "Britney Spears\n";
100
101static const char *britney_br_path = "/Britney Spears/Britney";
102static const char *britney_br_str = "Britney\n";
103
104static const char *b_br_1_path = "/Britney Spears/Britney/I'm a Slave 4 U";
105 static const char *b_br_1_str = "3:23 U\n";
106
107
108int gn_getattr(const char *path, struct stat *stbuf)
109{
110
111int res = 0;
112
113 memset(stbuf, 0, sizeof(struct stat));
114
115 if(strcmp(path, "/") == 0) { //attr. fuer parent vz
116 stbuf->st_mode = S_IFDIR | 0755;
117 stbuf->st_nlink = 3;
118 }
119
120 else if(strcmp(path, britney_path) == 0) { //attr. fuer unterverzeichnis Britney
121 stbuf->st_mode = S_IFDIR | 0755;
122 stbuf->st_nlink = 3;
123 }
124
125 else if(strcmp(path, britney_br_path) == 0) { //Attribute fuer UnterUnterverzeichnis Britney
126 stbuf->st_mode = S_IFDIR | 0755;
127 stbuf->st_nlink = 1;
128
129 }
130 else if(strcmp(path, b_br_1_path) == 0 ){ //Songnummer 1
131 stbuf->st_mode = S_IFREG | 0444;
132 stbuf->st_nlink = 1;
133 stbuf->st_size = strlen(b_br_1_str);
134 }
135
136 else res = -ENOENT;
137
138 return res;
139}
140
141*/
diff --git a/src/ext/gnunet-fuse.c b/src/ext/gnunet-fuse.c
index 097812e..928400c 100644
--- a/src/ext/gnunet-fuse.c
+++ b/src/ext/gnunet-fuse.c
@@ -111,6 +111,7 @@ run (void *cls,
111 return; 111 return;
112 } 112 }
113 113
114 printf("%s\n", directory);
114/* checking for muti- or singlethreading */ 115/* checking for muti- or singlethreading */
115 116
116 if (GNUNET_YES == TESTING) 117 if (GNUNET_YES == TESTING)
@@ -152,6 +153,9 @@ main (int argc, char *const *argv)
152 &GNUNET_GETOPT_set_string, &directory}, 153 &GNUNET_GETOPT_set_string, &directory},
153 GNUNET_GETOPT_OPTION_END }; 154 GNUNET_GETOPT_OPTION_END };
154 155
156
157
158
155 return (GNUNET_OK == 159 return (GNUNET_OK ==
156 GNUNET_PROGRAM_run2(argc, 160 GNUNET_PROGRAM_run2(argc,
157 argv, 161 argv,
diff --git a/src/ext/open.c b/src/ext/open.c
index 0d6399d..b0fdcc7 100644
--- a/src/ext/open.c
+++ b/src/ext/open.c
@@ -35,7 +35,7 @@ int gn_open(const char *path, struct fuse_file_info *fi)
35{ 35{
36 36
37 37
38 if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") | strcmp(path, "/") == 0) 38 if (strcmp(path, "/home/mg/gnunet-fuse2/gnunet-fuse/src/ext/monti") == 0)
39 return 0; 39 return 0;
40 40
41 else if ((fi->flags & 3) != O_RDONLY) 41 else if ((fi->flags & 3) != O_RDONLY)
@@ -48,61 +48,3 @@ int gn_open(const char *path, struct fuse_file_info *fi)
48 48
49 49
50 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/*
84static const char *archive_path = "/";
85static const char *archive_str = "/Archive\n";
86
87static const char *britney_path = "/Britney Spears";
88static const char *britney_str = "Britney Spears\n";
89
90static const char *britney_br_path = "/Britney Spears/Britney";
91static const char *britney_br_str = "Britney\n";
92
93static const char *b_br_1_path = "/Britney Spears/Britney/I'm a Slave 4 U";
94 static const char *b_br_1_str = "3:23 U\n";
95
96
97 if((strcmp(path, archive_path) | strcmp(path, britney_path) | strcmp(path, britney_br_path))==0)
98 // return -ENOENT;
99 return 0;
100
101 else if ( (fi->flags & 3) != O_RDONLY )
102 return -EACCES;
103
104 else return 0;
105
106
107
108*/
diff --git a/src/ext/read.c b/src/ext/read.c
index 32c81d1..8468d99 100644
--- a/src/ext/read.c
+++ b/src/ext/read.c
@@ -30,15 +30,19 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset,
30 struct fuse_file_info *fi) 30 struct fuse_file_info *fi)
31{ 31{
32 size_t len; 32 size_t len;
33 if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0) 33
34//until now read-function isn't used....
35
36
37/* if (strcmp(path, "") == 0)
34 { 38 {
35 len = strlen("/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount"); 39 len = strlen("");
36 40
37 if (offset < len) 41 if (offset < len)
38 { 42 {
39 if (offset + size > len) 43 if (offset + size > len)
40 size = len - offset; 44 size = len - offset;
41 memcpy(buf, "/" + offset, size); 45 memcpy(buf, "" + offset, size);
42 } 46 }
43 else 47 else
44 size = 0; 48 size = 0;
@@ -46,131 +50,9 @@ int gn_read(const char *path, char *buf, size_t size, off_t offset,
46 return size; 50 return size;
47 } 51 }
48 52
49 53*/
50 54
51 55
52} 56}
53 57
54 58
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
97static const char *archive_path = "/";
98static const char *archive_str = "/Archive\n";
99
100static const char *britney_path = "/Britney Spears";
101static const char *britney_str = "Britney Spears\n";
102
103static const char *britney_br_path = "/Britney Spears/Britney";
104static const char *britney_br_str = "Britney\n";
105
106static const char *b_br_1_path = "/Britney Spears/Britney/I'm a Slave 4 U";
107 static const char *b_br_1_str = "3:23 U\n";
108
109
110
111
112size_t len;
113 (void) fi;
114
115
116 if (strcmp(path, archive_path) == 0)
117 {
118 len = strlen(archive_str);
119 if (offset < len)
120 {
121 if (offset + size > len)
122 size = len - offset;
123 memcpy(buf, archive_str + offset, size);
124 }
125 else
126 size = 0;
127
128 return size;
129 }
130
131
132 else if(strcmp(path, britney_path) == 0)
133 {
134 len = strlen(britney_str);
135 if (offset < len) {
136 if (offset + size > len)
137 size = len - offset;
138 memcpy(buf, britney_str + offset, size);
139 }
140 else
141 size = 0;
142
143 return size;
144 }
145
146 else if(strcmp(path, britney_br_path) == 0) // ab hier das verzeichnis britney spears
147 {
148 len = strlen(britney_br_str);
149 if (offset < len) {
150 if (offset + size > len)
151 size = len - offset;
152 memcpy(buf, britney_br_str + offset, size);
153 }
154 else
155 size = 0;
156
157 return size;
158 }
159
160 else if(strcmp(path, b_br_1_path) == 0) // ab hier album Britney-Lied1
161 {
162 len = strlen(b_br_1_str);
163 if (offset < len)
164 {
165 if (offset + size > len)
166 size = len - offset;
167 memcpy(buf, b_br_1_str + offset, size);
168 }
169 else
170 size = 0;
171
172 return size;
173 }
174 else return -ENOENT;
175
176*/
diff --git a/src/ext/readdir.c b/src/ext/readdir.c
index 5f79e67..4e36924 100644
--- a/src/ext/readdir.c
+++ b/src/ext/readdir.c
@@ -51,47 +51,16 @@ int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
51 //int len = strlen(directory); 51 //int len = strlen(directory);
52// GNUNET_asprintf(); 52// GNUNET_asprintf();
53 53
54 if (strcmp(path, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount") == 0)
55 {
56 filler(buf, ".", NULL, 0);
57 filler(buf, "..", NULL, 0);
58 filler(buf, "/home/mg/gnunet-fuse5/gnunet-fuse/src/ext/mount"+1, NULL, 0);
59 return 0;
60 }
61
62 /*
63 54
64 else if (strcmp(path, directory) == 0) // mounted directory with content
65 {
66 filler(buf, ".", NULL, 0); 55 filler(buf, ".", NULL, 0);
67 filler(buf, "..", NULL, 0); 56 filler(buf, "..", NULL, 0);
68 filler(buf, track+len, NULL, 0); // path to directory mal 57 //filler(buf, "/home/mg/gnunet-fuse2/gnunet-fuse/src/ext/monti"+1, NULL, 0);
69 return 0; 58 //return 0;
70 }
71
72 */
73
74 else return -ENOENT;
75
76}
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 59
92 60
93 61
94 62
63}
95 64
96 65
97 66
@@ -102,55 +71,3 @@ int gn_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
102 71
103 72
104 73
105
106
107
108/*
109
110static const char *archive_path = "/";
111static const char *archive_str = "/Archive\n";
112
113static const char *britney_path = "/Britney Spears";
114static const char *britney_str = "Britney Spears\n";
115
116static const char *britney_br_path = "/Britney Spears/Britney";
117static const char *britney_br_str = "Britney\n";
118
119static const char *b_br_1_path = "/Britney Spears/Britney/I'm a Slave 4 U";
120 static const char *b_br_1_str = "3:23 U\n";
121
122
123
124if(strcmp(path, "/") == 0)
125 {
126 filler(buf, ".", NULL, 0);
127 filler(buf, "..", NULL, 0);
128
129 filler(buf, britney_path + 1, NULL, 0);
130 //filler(buf, metallica_path + 1, NULL, 0);
131 return 0;
132 }
133
134 else if(strcmp(path, "/Britney Spears") == 0)
135 {
136 filler(buf, ".", NULL, 0);
137 filler(buf, "..", NULL, 0);
138 //filler(buf, britney_omt_path + 16, NULL, 0);
139 filler(buf, britney_br_path + 16, NULL, 0);
140 return 0;
141 }
142
143 else if(strcmp(path, britney_br_path) == 0) // ab hier das album britney
144 {
145 filler(buf, ".", NULL, 0);
146 filler(buf, "..", NULL, 0);
147 filler(buf, b_br_1_path + 24 , NULL, 0);
148
149 return 0;
150 }
151
152 else return -ENOENT;
153
154
155
156*/