@@ -124,21 +124,24 @@ static const match_table_t tokens = {
124
124
{Opt_err , NULL }
125
125
};
126
126
127
- static int parse_options (char * options , int * pipefd , kuid_t * uid , kgid_t * gid ,
128
- int * pgrp , bool * pgrp_set , unsigned int * type ,
129
- int * minproto , int * maxproto )
127
+ static int parse_options (char * options ,
128
+ struct inode * root , int * pgrp , bool * pgrp_set ,
129
+ struct autofs_sb_info * sbi )
130
130
{
131
131
char * p ;
132
132
substring_t args [MAX_OPT_ARGS ];
133
133
int option ;
134
+ int pipefd = -1 ;
135
+ kuid_t uid ;
136
+ kgid_t gid ;
134
137
135
- * uid = current_uid ();
136
- * gid = current_gid ();
138
+ root -> i_uid = current_uid ();
139
+ root -> i_gid = current_gid ();
137
140
138
- * minproto = AUTOFS_MIN_PROTO_VERSION ;
139
- * maxproto = AUTOFS_MAX_PROTO_VERSION ;
141
+ sbi -> min_proto = AUTOFS_MIN_PROTO_VERSION ;
142
+ sbi -> max_proto = AUTOFS_MAX_PROTO_VERSION ;
140
143
141
- * pipefd = -1 ;
144
+ sbi -> pipefd = -1 ;
142
145
143
146
if (!options )
144
147
return 1 ;
@@ -152,22 +155,25 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
152
155
token = match_token (p , tokens , args );
153
156
switch (token ) {
154
157
case Opt_fd :
155
- if (match_int (args , pipefd ))
158
+ if (match_int (args , & pipefd ))
156
159
return 1 ;
160
+ sbi -> pipefd = pipefd ;
157
161
break ;
158
162
case Opt_uid :
159
163
if (match_int (args , & option ))
160
164
return 1 ;
161
- * uid = make_kuid (current_user_ns (), option );
162
- if (!uid_valid (* uid ))
165
+ uid = make_kuid (current_user_ns (), option );
166
+ if (!uid_valid (uid ))
163
167
return 1 ;
168
+ root -> i_uid = uid ;
164
169
break ;
165
170
case Opt_gid :
166
171
if (match_int (args , & option ))
167
172
return 1 ;
168
- * gid = make_kgid (current_user_ns (), option );
169
- if (!gid_valid (* gid ))
173
+ gid = make_kgid (current_user_ns (), option );
174
+ if (!gid_valid (gid ))
170
175
return 1 ;
176
+ root -> i_gid = gid ;
171
177
break ;
172
178
case Opt_pgrp :
173
179
if (match_int (args , & option ))
@@ -178,35 +184,34 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
178
184
case Opt_minproto :
179
185
if (match_int (args , & option ))
180
186
return 1 ;
181
- * minproto = option ;
187
+ sbi -> min_proto = option ;
182
188
break ;
183
189
case Opt_maxproto :
184
190
if (match_int (args , & option ))
185
191
return 1 ;
186
- * maxproto = option ;
192
+ sbi -> max_proto = option ;
187
193
break ;
188
194
case Opt_indirect :
189
- set_autofs_type_indirect (type );
195
+ set_autofs_type_indirect (& sbi -> type );
190
196
break ;
191
197
case Opt_direct :
192
- set_autofs_type_direct (type );
198
+ set_autofs_type_direct (& sbi -> type );
193
199
break ;
194
200
case Opt_offset :
195
- set_autofs_type_offset (type );
201
+ set_autofs_type_offset (& sbi -> type );
196
202
break ;
197
203
default :
198
204
return 1 ;
199
205
}
200
206
}
201
- return (* pipefd < 0 );
207
+ return (sbi -> pipefd < 0 );
202
208
}
203
209
204
210
int autofs_fill_super (struct super_block * s , void * data , int silent )
205
211
{
206
212
struct inode * root_inode ;
207
213
struct dentry * root ;
208
214
struct file * pipe ;
209
- int pipefd ;
210
215
struct autofs_sb_info * sbi ;
211
216
struct autofs_info * ino ;
212
217
int pgrp = 0 ;
@@ -262,9 +267,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
262
267
root -> d_fsdata = ino ;
263
268
264
269
/* Can this call block? */
265
- if (parse_options (data , & pipefd , & root_inode -> i_uid , & root_inode -> i_gid ,
266
- & pgrp , & pgrp_set , & sbi -> type , & sbi -> min_proto ,
267
- & sbi -> max_proto )) {
270
+ if (parse_options (data , root_inode , & pgrp , & pgrp_set , sbi )) {
268
271
pr_err ("called with bogus options\n" );
269
272
goto fail_dput ;
270
273
}
@@ -303,8 +306,9 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
303
306
root_inode -> i_fop = & autofs_root_operations ;
304
307
root_inode -> i_op = & autofs_dir_inode_operations ;
305
308
306
- pr_debug ("pipe fd = %d, pgrp = %u\n" , pipefd , pid_nr (sbi -> oz_pgrp ));
307
- pipe = fget (pipefd );
309
+ pr_debug ("pipe fd = %d, pgrp = %u\n" ,
310
+ sbi -> pipefd , pid_nr (sbi -> oz_pgrp ));
311
+ pipe = fget (sbi -> pipefd );
308
312
309
313
if (!pipe ) {
310
314
pr_err ("could not open pipe file descriptor\n" );
@@ -314,7 +318,6 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
314
318
if (ret < 0 )
315
319
goto fail_fput ;
316
320
sbi -> pipe = pipe ;
317
- sbi -> pipefd = pipefd ;
318
321
sbi -> catatonic = 0 ;
319
322
320
323
/*
0 commit comments