autofs parser simplified
PATCH 1/1 autofs parser simplified
Andrew,
Here's a patch to avoid int parse redundancy in autofs.
Could you apply ?
Regards,
Fabian
fs/autofs/inode.c +5 -14
@@ -58,7 +58,7 @@ {Opt_err, NULL} }; -static int parse_options (char *options,int *pipefd,uid_t *uid,gid_t *gid,pid_t *pgrp,int *minproto,int *maxproto) +static int parse_options (char *options,int *pipefd,uid_t *uid,gid_t *gid,pid_t *pgrp,int *minproto,int *maxproto) {char *p;substring_t args[MAX_OPT_ARGS ];
@@ -79,37 +79,28 @@int token;if (!*p)continue ; - token =match_token (p, autofs_tokens, args); + +/*We only have %u tokens so...*/ +if (match_int (&args[0 ], &option)) +return 1 ;switch (token) {case Opt_fd: -if (match_int (&args[0 ], &option)) -return 1 ; *pipefd = option;break ;case Opt_uid: -if (match_int (&args[0 ], &option)) -return 1 ; *uid = option;break ;case Opt_gid: -if (match_int (&args[0 ], &option)) -return 1 ; *gid = option;break ;case Opt_pgrp: -if (match_int (&args[0 ], &option)) -return 1 ; *pgrp = option;break ;case Opt_minproto: -if (match_int (&args[0 ], &option)) -return 1 ; *minproto = option;break ;case Opt_maxproto: -if (match_int (&args[0 ], &option)) -return 1 ; *maxproto = option;break ;default :
On Wed, 21 Apr 2004 21:00:47 +0200 FabF wrote:
| Andrew, | | Here's a patch to avoid int parse redundancy in autofs. | Could you apply ?
No need to add a trailing space to the function def. line though... Bad $EDITOR.
--
~Randy
"We have met the enemy and he is us." -- Pogo (by Walt Kelly) (Again. Sometimes I think ln -s /usr/src/linux/.config .signature)