summaryrefslogtreecommitdiff
path: root/debian/patches/fs_unification0001-libnetfs-rename-error-to-err.patch
blob: 93649c03596a2302850538f34e0af9f9589852fe (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
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
From 74b05fd9f95bed2d4fecf9939d304cbacaa905b5 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
Date: Mon, 18 Apr 2016 19:00:31 +0200
Subject: [PATCH hurd 1/5] libnetfs: rename 'error' to 'err'

* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Rename 'error' to 'err'.
---
 libnetfs/dir-lookup.c | 92 +++++++++++++++++++++++++--------------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index cbe2941..9a92c29 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -48,7 +48,7 @@ netfs_S_dir_lookup (struct protid *diruser,
   struct node *dnp, *np;
   char *nextname;
   char *relpath;
-  error_t error;
+  error_t err;
   struct protid *newpi = NULL;
   struct iouser *user;
 
@@ -132,7 +132,7 @@ netfs_S_dir_lookup (struct protid *diruser,
 	      strcpy (retry_name, "/");
 	    else if (!lastcomp)
 	      strcpy (retry_name, nextname);
-	    error = 0;
+	    err = 0;
 	    pthread_mutex_unlock (&dnp->lock);
 	    goto out;
 	  }
@@ -148,40 +148,40 @@ netfs_S_dir_lookup (struct protid *diruser,
 	      strcpy (retry_name, "/");
 	    else if (!lastcomp)
 	      strcpy (retry_name, nextname);
-	    error = 0;
+	    err = 0;
 	    pthread_mutex_unlock (&dnp->lock);
 	    goto out;
 	  }
 	else
 	  /* We are global root */
 	  {
-	    error = 0;
+	    err = 0;
 	    np = dnp;
 	    netfs_nref (np);
 	  }
       else
 	/* Attempt a lookup on the next pathname component. */
-	error = netfs_attempt_lookup (diruser->user, dnp, filename, &np);
+	err = netfs_attempt_lookup (diruser->user, dnp, filename, &np);
 
       /* At this point, DNP is unlocked */
 
       /* Implement O_EXCL flag here */
-      if (lastcomp && create && excl && !error)
-	error = EEXIST;
+      if (lastcomp && create && excl && !err)
+	err = EEXIST;
 
       /* Create the new node if necessary */
-      if (lastcomp && create && error == ENOENT)
+      if (lastcomp && create && err == ENOENT)
 	{
 	  mode &= ~(S_IFMT | S_ISPARE | S_ISVTX);
 	  mode |= S_IFREG;
 	  pthread_mutex_lock (&dnp->lock);
-	  error = netfs_attempt_create_file (diruser->user, dnp,
-					     filename, mode, &np);
+	  err = netfs_attempt_create_file (diruser->user, dnp,
+					   filename, mode, &np);
 
 	  /* If someone has already created the file (between our lookup
 	     and this create) then we just got EEXIST.  If we are
 	     EXCL, that's fine; otherwise, we have to retry the lookup. */
-	  if (error == EEXIST && !excl)
+	  if (err == EEXIST && !excl)
 	    {
 	      pthread_mutex_lock (&dnp->lock);
 	      goto retry_lookup;
@@ -191,11 +191,11 @@ netfs_S_dir_lookup (struct protid *diruser,
 	}
 
       /* All remaining errors get returned to the user */
-      if (error)
+      if (err)
 	goto out;
 
-      error = netfs_validate_stat (np, diruser->user);
-      if (error)
+      err = netfs_validate_stat (np, diruser->user);
+      if (err)
 	goto out;
 
       if ((((flags & O_NOTRANS) == 0) || !lastcomp || mustbedir)
@@ -251,21 +251,21 @@ netfs_S_dir_lookup (struct protid *diruser,
 
 	  /* Create an unauthenticated port for DNP, and then
 	     unlock it. */
-	  error = iohelp_create_empty_iouser (&user);
-	  if (! error)
+	  err = iohelp_create_empty_iouser (&user);
+	  if (! err)
 	    {
 	      newpi = netfs_make_protid (netfs_make_peropen (dnp, 0,
 							     diruser->po),
 					 user);
 	      if (! newpi)
 	        {
-		  error = errno;
+		  err = errno;
 		  iohelp_free_iouser (user);
 		}
 	    }
 
 	  boolean_t register_translator = 0;
-	  if (! error)
+	  if (! err)
 	    {
 	      dirport = ports_get_send_right (newpi);
 
@@ -275,24 +275,24 @@ netfs_S_dir_lookup (struct protid *diruser,
 		 translators.  */
 	      register_translator = np->transbox.active == MACH_PORT_NULL;
 
-	      error = fshelp_fetch_root (&np->transbox, diruser->po,
-					 dirport,
-					 diruser->user,
-					 lastcomp ? flags : 0,
-					 ((np->nn_translated & S_IPTRANS)
-					 ? _netfs_translator_callback1
-					   : short_circuited_callback1),
-					 _netfs_translator_callback2,
-					 do_retry, retry_name, retry_port);
+	      err = fshelp_fetch_root (&np->transbox, diruser->po,
+				       dirport,
+				       diruser->user,
+				       lastcomp ? flags : 0,
+				       ((np->nn_translated & S_IPTRANS)
+					? _netfs_translator_callback1
+					: short_circuited_callback1),
+				       _netfs_translator_callback2,
+				       do_retry, retry_name, retry_port);
 	      /* fetch_root copies DIRPORT for success, so we always should
 		 deallocate our send right.  */
 	      mach_port_deallocate (mach_task_self (), dirport);
 	    }
 
-	  if (error != ENOENT)
+	  if (err != ENOENT)
 	    {
 	      *retry_port_type = MACH_MSG_TYPE_MOVE_SEND;
-	      if (!error)
+	      if (!err)
 		{
 		  char *end = strchr (retry_name, '\0');
 		  if (mustbedir)
@@ -326,12 +326,12 @@ netfs_S_dir_lookup (struct protid *diruser,
 		  else
 		      asprintf (&complete_path, "%s/%s", diruser->po->path, translator_path);
 
-		  error = fshelp_set_active_translator (&newpi->pi,
-							complete_path,
-							np->transbox.active);
+		  err = fshelp_set_active_translator (&newpi->pi,
+						      complete_path,
+						      np->transbox.active);
 		  if (complete_path != translator_path)
 		    free(complete_path);
-		  if (error)
+		  if (err)
 		    {
 		      ports_port_deref (newpi);
 		      goto out;
@@ -346,7 +346,7 @@ netfs_S_dir_lookup (struct protid *diruser,
 
 	  /* ENOENT means there was a hiccup, and the translator vanished
 	     while NP was unlocked inside fshelp_fetch_root; continue as normal. */
-	  error = 0;
+	  err = 0;
 	}
 
       if (S_ISLNK (np->nn_translated)
@@ -360,7 +360,7 @@ netfs_S_dir_lookup (struct protid *diruser,
 	  /* Handle symlink interpretation */
 	  if (nsymlinks++ > netfs_maxsymlinks)
 	    {
-	      error = ELOOP;
+	      err = ELOOP;
 	      goto out;
 	    }
 
@@ -370,8 +370,8 @@ netfs_S_dir_lookup (struct protid *diruser,
 	  newnamelen = nextnamelen + linklen + 1 + 1;
 	  linkbuf = alloca (newnamelen);
 
-	  error = netfs_attempt_readlink (diruser->user, np, linkbuf);
-	  if (error)
+	  err = netfs_attempt_readlink (diruser->user, np, linkbuf);
+	  if (err)
 	    goto out;
 
 	  if (nextname)
@@ -436,19 +436,19 @@ netfs_S_dir_lookup (struct protid *diruser,
       netfs_validate_stat (np, diruser->user);
       if (!S_ISDIR (np->nn_stat.st_mode))
 	{
-	  error = ENOTDIR;
+	  err = ENOTDIR;
 	  goto out;
 	}
     }
-  error = netfs_check_open_permissions (diruser->user, np,
-					flags, newnode);
-  if (error)
+  err = netfs_check_open_permissions (diruser->user, np,
+				      flags, newnode);
+  if (err)
     goto out;
 
   flags &= ~OPENONLY_STATE_MODES;
 
-  error = iohelp_dup_iouser (&user, diruser->user);
-  if (error)
+  err = iohelp_dup_iouser (&user, diruser->user);
+  if (err)
     goto out;
 
   newpi = netfs_make_protid (netfs_make_peropen (np, flags, diruser->po),
@@ -456,7 +456,7 @@ netfs_S_dir_lookup (struct protid *diruser,
   if (! newpi)
     {
       iohelp_free_iouser (user);
-      error = errno;
+      err = errno;
       goto out;
     }
 
@@ -474,7 +474,7 @@ netfs_S_dir_lookup (struct protid *diruser,
     }
 
   if (! newpi->po->path)
-    error = errno;
+    err = errno;
 
   *retry_port = ports_get_right (newpi);
   ports_port_deref (newpi);
@@ -485,5 +485,5 @@ netfs_S_dir_lookup (struct protid *diruser,
   if (dnp)
     netfs_nrele (dnp);
   free (relpath);
-  return error;
+  return err;
 }
-- 
2.1.4