Don't bother with "mixed" options that would allow both the form with and without argument (i.e. both -o foo and -o foo=bar). Rather than trying to shove both into a single fs_parameter_spec, allow having with-argument and no-argument specs with the same name and teach fs_parse to handle that. There are very few options of that sort, and they are actually easier to handle that way - callers end up with less postprocessing.
Showing the changes to include/linux (1 of 5 files). Show all
Unified · Split
| @@ -49,7 +49,6 @@ struct fs_parameter_spec { · 48 unmodified lines | |||
| 49 | u8 opt; /* Option number (returned by fs_parse()) */ | 49 | u8 opt; /* Option number (returned by fs_parse()) */ |
| 50 | enum fs_parameter_type type:8; /* The desired parameter type */ | 50 | enum fs_parameter_type type:8; /* The desired parameter type */ |
| 51 | unsigned short flags; | 51 | unsigned short flags; |
| 52 | #define fs_param_v_optional 0x0001 /* The value is optional */ | ||
| 53 | #define fs_param_neg_with_no 0x0002 /* "noxxx" is negative param */ | 52 | #define fs_param_neg_with_no 0x0002 /* "noxxx" is negative param */ |
| 54 | #define fs_param_neg_with_empty 0x0004 /* "xxx=" is negative param */ | 53 | #define fs_param_neg_with_empty 0x0004 /* "xxx=" is negative param */ |
| 55 | #define fs_param_deprecated 0x0008 /* The param is deprecated */ | 54 | #define fs_param_deprecated 0x0008 /* The param is deprecated */ |