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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
commit 300fc1b78311cf32dce548d9716ada4b961346c5
Author: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Wed Feb 12 11:24:14 2014 +0100
libnetfs: fix receiver lookups in fsys server functions
* mutations.h: Add translation functions.
* netfs.h (struct netfs_control): New declaration.
* priv.h: Define translation functions.
* fsys-get-options.c: Fix receiver lookups.
* fsys-getroot.c: Likewise.
* fsys-goaway.c: Likewise.
* fsys-set-options.c: Likewise.
* fsys-syncfs.c: Likewise.
* fsysstubs.c: Likewise.
diff --git a/libnetfs/fsys-get-options.c b/libnetfs/fsys-get-options.c
index 54bd9a0..836806b 100644
--- a/libnetfs/fsys-get-options.c
+++ b/libnetfs/fsys-get-options.c
@@ -31,7 +31,7 @@
/* Implement fsys_get_options as described in <hurd/fsys.defs>. */
error_t
-netfs_S_fsys_get_options (fsys_t fsys,
+netfs_S_fsys_get_options (struct netfs_control *port,
mach_port_t reply,
mach_msg_type_name_t reply_type,
char **data, mach_msg_type_number_t *data_len)
@@ -39,8 +39,6 @@ netfs_S_fsys_get_options (fsys_t fsys,
error_t err;
char *argz = 0;
size_t argz_len = 0;
- struct port_info *port =
- ports_lookup_port (netfs_port_bucket, fsys, netfs_control_class);
if (!port)
return EOPNOTSUPP;
@@ -63,7 +61,5 @@ netfs_S_fsys_get_options (fsys_t fsys,
else
free (argz);
- ports_port_deref (port);
-
return err;
}
diff --git a/libnetfs/fsys-getroot.c b/libnetfs/fsys-getroot.c
index 0d80111..2d02120 100644
--- a/libnetfs/fsys-getroot.c
+++ b/libnetfs/fsys-getroot.c
@@ -25,7 +25,7 @@
#include <fcntl.h>
error_t
-netfs_S_fsys_getroot (mach_port_t cntl,
+netfs_S_fsys_getroot (struct netfs_control *pt,
mach_port_t reply,
mach_msg_type_name_t reply_type,
mach_port_t dotdot,
@@ -37,8 +37,6 @@ netfs_S_fsys_getroot (mach_port_t cntl,
mach_port_t *retry_port,
mach_msg_type_name_t *retry_port_type)
{
- struct port_info *pt = ports_lookup_port (netfs_port_bucket, cntl,
- netfs_control_class);
struct iouser *cred;
error_t err;
struct protid *newpi;
@@ -51,7 +49,6 @@ netfs_S_fsys_getroot (mach_port_t cntl,
if (!pt)
return EOPNOTSUPP;
- ports_port_deref (pt);
err = iohelp_create_complex_iouser (&cred, uids, nuids, gids, ngids);
if (err)
diff --git a/libnetfs/fsys-goaway.c b/libnetfs/fsys-goaway.c
index 0ac36d3..872d073 100644
--- a/libnetfs/fsys-goaway.c
+++ b/libnetfs/fsys-goaway.c
@@ -26,17 +26,15 @@
#include <hurd/ports.h>
error_t
-netfs_S_fsys_goaway (fsys_t control,
+netfs_S_fsys_goaway (struct netfs_control *pt,
mach_port_t reply,
mach_msg_type_name_t reply_type,
int flags)
{
error_t err;
- struct port_info *pt;
- pt = ports_lookup_port (netfs_port_bucket, control,
- netfs_control_class);
- if (! pt)
+
+ if (!pt)
return EOPNOTSUPP;
err = netfs_shutdown (flags);
@@ -46,7 +44,5 @@ netfs_S_fsys_goaway (fsys_t control,
exit (0);
}
- ports_port_deref (pt);
-
return err;
}
diff --git a/libnetfs/fsys-set-options.c b/libnetfs/fsys-set-options.c
index d7dc743..fb1c87e 100644
--- a/libnetfs/fsys-set-options.c
+++ b/libnetfs/fsys-set-options.c
@@ -31,15 +31,15 @@
/* Implement fsys_set_options as described in <hurd/fsys.defs>. */
error_t
-netfs_S_fsys_set_options (fsys_t fsys,
+netfs_S_fsys_set_options (struct netfs_control *pt,
mach_port_t reply,
mach_msg_type_name_t reply_type,
char *data, mach_msg_type_number_t data_len,
int do_children)
{
error_t err = 0;
- struct port_info *pt =
- ports_lookup_port (netfs_port_bucket, fsys, netfs_control_class);
+ if (!pt)
+ return EOPNOTSUPP;
error_t
helper (struct node *np)
@@ -64,9 +64,6 @@ netfs_S_fsys_set_options (fsys_t fsys,
return error;
}
- if (!pt)
- return EOPNOTSUPP;
-
#if NOT_YET
if (do_children)
{
@@ -87,7 +84,5 @@ netfs_S_fsys_set_options (fsys_t fsys,
#endif
}
- ports_port_deref (pt);
-
return err;
}
diff --git a/libnetfs/fsys-syncfs.c b/libnetfs/fsys-syncfs.c
index f57cb14..e232936 100644
--- a/libnetfs/fsys-syncfs.c
+++ b/libnetfs/fsys-syncfs.c
@@ -22,7 +22,7 @@
#include "fsys_S.h"
error_t
-netfs_S_fsys_syncfs (mach_port_t cntl,
+netfs_S_fsys_syncfs (struct netfs_control *cntl,
mach_port_t reply,
mach_msg_type_name_t reply_type,
int wait,
diff --git a/libnetfs/fsysstubs.c b/libnetfs/fsysstubs.c
index f44155d..a64fd64 100644
--- a/libnetfs/fsysstubs.c
+++ b/libnetfs/fsysstubs.c
@@ -23,7 +23,7 @@
#include "fsys_S.h"
error_t
-netfs_S_fsys_getfile (fsys_t cntl,
+netfs_S_fsys_getfile (struct netfs_control *cntl,
mach_port_t reply,
mach_msg_type_name_t reply_type,
uid_t *uids, mach_msg_type_number_t nuids,
@@ -35,7 +35,7 @@ netfs_S_fsys_getfile (fsys_t cntl,
}
error_t
-netfs_S_fsys_getpriv (fsys_t cntl,
+netfs_S_fsys_getpriv (struct netfs_control *cntl,
mach_port_t reply,
mach_msg_type_name_t reply_type,
mach_port_t *host, mach_msg_type_name_t *hosttp,
@@ -46,7 +46,7 @@ netfs_S_fsys_getpriv (fsys_t cntl,
}
error_t
-netfs_S_fsys_init (fsys_t cntl,
+netfs_S_fsys_init (struct netfs_control *cntl,
mach_port_t reply,
mach_msg_type_name_t reply_type,
mach_port_t proc, auth_t auth)
@@ -55,7 +55,7 @@ netfs_S_fsys_init (fsys_t cntl,
}
error_t
-netfs_S_fsys_forward (fsys_t cntl,
+netfs_S_fsys_forward (mach_port_t cntl,
mach_port_t reply,
mach_msg_type_name_t reply_type,
mach_port_t request,
diff --git a/libnetfs/mutations.h b/libnetfs/mutations.h
index e6700f5..51ca871 100644
--- a/libnetfs/mutations.h
+++ b/libnetfs/mutations.h
@@ -28,6 +28,9 @@
#define IO_INTRAN protid_t begin_using_protid_port (io_t)
#define IO_DESTRUCTOR end_using_protid_port (protid_t)
+#define FSYS_INTRAN control_t begin_using_control_port (fsys_t)
+#define FSYS_DESTRUCTOR end_using_control_port (control_t)
+
#define FILE_IMPORTS import "netfs.h"; import "priv.h";
#define IO_IMPORTS import "netfs.h"; import "priv.h";
#define FSYS_IMPORTS import "netfs.h"; import "priv.h";
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
index 5d50f57..aef4a3d 100644
--- a/libnetfs/netfs.h
+++ b/libnetfs/netfs.h
@@ -100,6 +100,11 @@ struct node
struct dirmod *dirmod_reqs;
};
+struct netfs_control
+{
+ struct port_info pi;
+};
+
/* The user must define this variable. Set this to the name of the
filesystem server. */
extern char *netfs_server_name;
@@ -437,6 +442,7 @@ extern auth_t netfs_auth_server_port;
/* Mig gook. */
typedef struct protid *protid_t;
+typedef struct netfs_control *control_t;
#endif /* _HURD_NETFS_H_ */
diff --git a/libnetfs/priv.h b/libnetfs/priv.h
index 00db9fa..ba31080 100644
--- a/libnetfs/priv.h
+++ b/libnetfs/priv.h
@@ -37,4 +37,18 @@ end_using_protid_port (struct protid *cred)
if (cred)
ports_port_deref (cred);
}
+
+static inline struct netfs_control * __attribute__ ((unused))
+begin_using_control_port (fsys_t port)
+{
+ return ports_lookup_port (netfs_port_bucket, port, netfs_control_class);
+}
+
+static inline void __attribute__ ((unused))
+end_using_control_port (struct netfs_control *cred)
+{
+ if (cred)
+ ports_port_deref (cred);
+}
+
#endif
|