diff options
Diffstat (limited to 'sutils/fstab.h')
-rw-r--r-- | sutils/fstab.h | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/sutils/fstab.h b/sutils/fstab.h index b8616185..ddd1656c 100644 --- a/sutils/fstab.h +++ b/sutils/fstab.h @@ -1,6 +1,6 @@ /* Fstab filesystem frobbing - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1999 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -28,7 +28,7 @@ struct fs { - struct fstab *fstab; /* Containg fstab. */ + struct fstab *fstab; /* Containing fstab. */ struct mntent mntent; /* Mount entry from fstab file. */ char *storage; /* Storage for strings in MNTENT. */ struct fstype *type; /* Only set if fs_type called. */ @@ -70,20 +70,21 @@ error_t fstab_create (struct fstypes *types, struct fstab **fstab); void fstab_free (struct fstab *fstab); /* Return a new fstypes structure in TYPES. SEARCH_FMTS is copied. */ -error_t fstypes_create (char *search_fmts, size_t search_fmts_len, +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. */ -error_t fstypes_get (struct fstypes *types, char *name, struct fstype **fstype); + 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); /* Copy MNTENT into FS, copying component strings as well. */ -error_t fs_set_mntent (struct fs *fs, struct mntent *mntent); +error_t fs_set_mntent (struct fs *fs, const struct mntent *mntent); -/* Returns an fstype for FS in TYPE, trying to fillin FS's type field if +/* Returns an fstype for FS in TYPE, trying to fill in FS's type field if necessary. */ error_t fs_type (struct fs *fs, struct fstype **type); @@ -106,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); @@ -115,26 +116,27 @@ void fs_free (struct fs *fs); /* Returns the FS entry in FSTAB with the device field NAME (there can only be one such entry). */ -struct fs *fstab_find_device (struct fstab *fstab, char *name); +struct fs *fstab_find_device (const struct fstab *fstab, const char *name); /* Returns the FS entry in FSTAB with the mount point NAME (there can only be one such entry). */ -struct fs *fstab_find_mount (struct fstab *fstab, char *name); +struct fs *fstab_find_mount (const struct fstab *fstab, const char *name); /* Returns the FS entry in FSTAB with the device or mount point NAME (there can only be one such entry). */ -struct fs *fstab_find (struct fstab *fstab, char *name); +struct fs *fstab_find (const struct fstab *fstab, const char *name); /* Add an entry for MNTENT to FSTAB, removing any existing entries that conflict (in either the device or mount point). If RESULT is non-zero, the - new entry is returne in it. */ -error_t fstab_add_mntent (struct fstab *fstab, struct mntent *mntent, + new entry is returned in it. */ +error_t fstab_add_mntent (struct fstab *fstab, const struct mntent *mntent, struct fs **result); /* Copy the entry FS (which should belong to another fstab than DST) into DST. If DST & SRC have different TYPES fields, EINVAL is returned. If COPY is non-zero, the copy is returned in it. */ -error_t fstab_add_fs (struct fstab *dst, struct fs *fs, struct fs **copy); +error_t fstab_add_fs (struct fstab *dst, const struct fs *fs, + struct fs **copy); /* Merge SRC into DST, as if by calling fstab_add_fs on DST with every entry in SRC, and then deallocating SRC. If DST & SRC have different @@ -143,10 +145,34 @@ error_t fstab_merge (struct fstab *dst, struct fstab *src); /* Reads fstab-format entries into FSTAB from the file NAME. Any entries duplicating one already in FS_LIST supersede the existing entry. */ -error_t fstab_read (struct fstab *fstab, char *name); +error_t fstab_read (struct fstab *fstab, const char *name); /* Return the next pass number that applies to any filesystem in FSTAB that is greater than PASS, or -1 if there isn't any. */ -int fstab_next_pass (struct fstab *fstab, int pass); +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__ */ |