From 078edb2d6e4188963938b7be076db5382f6f802b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 11 Jan 2010 13:33:06 +0100 Subject: libmount: add optls (options container) Signed-off-by: Karel Zak --- shlibs/mount/src/mountP.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'shlibs/mount/src/mountP.h') diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index ef3c1a661..62a5eca9e 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -98,4 +98,55 @@ struct _mnt_iter { (itr)->p->next : (itr)->p->prev; \ } while(0) -#endif + +/* + * mnt_optls entry + */ +struct _mnt_optent { + char *name; /* option name (allcocated when mapent is NULL) */ + char *value; /* option argument value */ + + int mask; /* MNT_{INVMASK,MDATA,MFLAG,NOMTAB,NOSYS} + * modifiable flags (initial value comes from map->mask) + */ + const struct mnt_optmap *mapent;/* the option description (msp entry) */ + const struct mnt_optmap *map; /* head of the map */ + + struct list_head opts; /* list of options */ +}; + +/* + * Container (list) for mount options + */ +struct _mnt_optls { + struct mnt_optmap const **maps; /* array with option maps */ + size_t nmaps; /* number of maps */ + + struct list_head opts; /* list of options */ +}; + +/* optmap.c */ +extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps, + int nmaps, const char *name, + size_t namelen, const struct mnt_optmap **mapent); +extern int mnt_optmap_enum_to_number(const struct mnt_optmap *mapent, + const char *rawdata, size_t len); +extern const char *mnt_optmap_get_type(const struct mnt_optmap *mapent); +extern int mnt_optmap_require_value(const struct mnt_optmap *mapent); + +/* optent.c */ + +/* private option masks -- see mount.h.in for the publick masks */ +#define MNT_HASVAL (1 << 10) + +extern mnt_optent *mnt_new_optent(const char *name, size_t namesz, + const char *value, size_t valsz, + struct mnt_optmap const **maps, int nmaps); +extern void mnt_free_optent(mnt_optent *op); +extern mnt_optent *mnt_new_optent_from_optstr(char **optstr, + struct mnt_optmap const **maps, int nmaps); +extern int mnt_optent_assign_map(mnt_optent *op, + struct mnt_optmap const **maps, int nmaps); + + +#endif /* _LIBMOUNT_PRIVATE_H */ -- cgit v1.2.3-55-g7522