diff options
Diffstat (limited to 'src/include/ipxe/params.h')
-rw-r--r-- | src/include/ipxe/params.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/include/ipxe/params.h b/src/include/ipxe/params.h index d78adf5..c2d82d9 100644 --- a/src/include/ipxe/params.h +++ b/src/include/ipxe/params.h @@ -14,6 +14,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); /** A form parameter list */ struct parameters { + /** Reference count */ + struct refcnt refcnt; /** List of all parameter lists */ struct list_head list; /** Name */ @@ -32,6 +34,43 @@ struct parameter { const char *value; }; +/** + * Increment form parameter list reference count + * + * @v params Parameter list, or NULL + * @ret params Parameter list as passed in + */ +static inline __attribute__ (( always_inline )) struct parameters * +params_get ( struct parameters *params ) { + ref_get ( ¶ms->refcnt ); + return params; +} + +/** + * Decrement form parameter list reference count + * + * @v params Parameter list, or NULL + */ +static inline __attribute__ (( always_inline )) void +params_put ( struct parameters *params ) { + ref_put ( ¶ms->refcnt ); +} + +/** + * Claim ownership of form parameter list + * + * @v params Parameter list + * @ret params Parameter list + */ +static inline __attribute__ (( always_inline )) struct parameters * +claim_parameters ( struct parameters *params ) { + + /* Remove from list of parameter lists */ + list_del ( ¶ms->list ); + + return params; +} + /** Iterate over all form parameters in a list */ #define for_each_param( param, params ) \ list_for_each_entry ( (param), &(params)->entries, list ) @@ -40,7 +79,5 @@ extern struct parameters * find_parameters ( const char *name ); extern struct parameters * create_parameters ( const char *name ); extern struct parameter * add_parameter ( struct parameters *params, const char *key, const char *value ); -extern void destroy_parameters ( struct parameters *params ); -extern void claim_parameters ( struct parameters *params ); #endif /* _IPXE_PARAMS_H */ |