From 1c3de661e0351828a8b96d4124d983a9e7888382 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 19 Nov 1999 00:00:24 +0000 Subject: 1999-10-01 Roland McGrath * fstab.c (fstypes_get): Check strdup return for ENOMEM failure. (fstypes_find_program): New function, #if 0'd out for now. (fstab_argp, fstab_argp_create, options, parse_opt): New variables and functions. * fstab.h: Misc comment fixes. (struct fstab_argp_params): New type. (fstab_argp, fstab_argp_create): Declare them. * fsck.c (options): Remove --fstab/-F, --search-fmts/-S, --exclude-root/-R, --exclude/-X, --fstype/-t, --all/-A; all of these are now factored out into fstab_argp. (main): Remove parsing code for options now in fstab_argp. Instead, use fstab_argp as an argp_child and use fstab_argp_create to process the option-parsing results into a struct fstab * to process. --- sutils/fstab.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'sutils/fstab.h') diff --git a/sutils/fstab.h b/sutils/fstab.h index ebb6a90a..ddd1656c 100644 --- a/sutils/fstab.h +++ b/sutils/fstab.h @@ -74,10 +74,10 @@ error_t fstypes_create (const char *search_fmts, size_t search_fmts_len, struct fstypes **types); /* Return an fstype entry in TYPES called NAME, in FSTYPE. If there is no - existing entry, an attempt to find a fsck program with the given type, - using the alternatives in the FSCK_SEARCH_FMTS field in TYPES. If - one is found, it is added to TYPES, otherwise an new entry is created - with a NULL PROGRAM field. */ + existing entry, an attempt to find a program with the given type, + using the alternatives in the PROGRAM_SEARCH_FMTS field in TYPES. If + one is found, it is added to TYPES, otherwise a new entry is created + with a null PROGRAM field. */ error_t fstypes_get (struct fstypes *types, const char *name, struct fstype **fstype); @@ -107,7 +107,7 @@ error_t fs_readonly (struct fs *fs, int *readonly); is not mounted at all, then nothing is done. */ error_t fs_set_readonly (struct fs *fs, int readonly); -/* If FS is currently mounted tell lit to remount the device. XXX If FS is +/* If FS is currently mounted tell it to remount the device. XXX If FS is not mounted at all, then nothing is done. */ error_t fs_remount (struct fs *fs); @@ -151,4 +151,28 @@ error_t fstab_read (struct fstab *fstab, const char *name); is greater than PASS, or -1 if there isn't any. */ int fstab_next_pass (const struct fstab *fstab, int pass); + +struct argp; +extern const struct argp fstab_argp; +struct fstab_argp_params +{ + char *fstab_path; + char *program_search_fmts; + size_t program_search_fmts_len; + + int do_all; + char *types; + size_t types_len; + char *exclude; + size_t exclude_len; + + char *names; + size_t names_len; +}; + +struct fstab *fstab_argp_create (struct fstab_argp_params *params, + const char *default_search_fmts, + size_t default_search_fmts_len); + + #endif /* __FSTAB_H__ */ -- cgit v1.2.3