[libvirt] [PATCH 2/2] nwfilter: enum cleanups in "src/nwfilter/*"
Eric Blake
eblake at redhat.com
Tue Jun 24 19:02:38 UTC 2014
On 06/15/2014 10:32 AM, Julio Faracco wrote:
> As we are doing with the enum structures, a cleanup in
> "src/nwfilter/" directory was done now. All the enums that were
> defined in the header files were converted to typedefs in this
> directory. This patch includes all the adjustments to remove
> conflicts when you do this kind of change. "Enum-to-typedef"'s
> conversions were made in "src/nwfilter/nwfilter_{gentech_driver,
> learnipaddr, tech_driver}.h".
>
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
> src/nwfilter/nwfilter_gentech_driver.c | 12 ++++++------
> src/nwfilter/nwfilter_gentech_driver.h | 4 ++--
> src/nwfilter/nwfilter_learnipaddr.c | 2 +-
> src/nwfilter/nwfilter_learnipaddr.h | 8 ++++----
> src/nwfilter/nwfilter_tech_driver.h | 6 +++---
> 5 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
> index 5bed106..5a4c896 100644
> --- a/src/nwfilter/nwfilter_gentech_driver.c
> +++ b/src/nwfilter/nwfilter_gentech_driver.c
> @@ -332,7 +332,7 @@ static int
> virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
> virNWFilterDefPtr def,
> virNWFilterHashTablePtr vars,
> - enum instCase useNewFilter,
> + instCase useNewFilter,
It would be nice to do a followup patch that renames instCase into
something like virInstCase, to make it obvious that it is an enum type
provided by libvirt...
> +++ b/src/nwfilter/nwfilter_gentech_driver.h
> @@ -32,10 +32,10 @@ virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
> int virNWFilterTechDriversInit(bool privileged);
> void virNWFilterTechDriversShutdown(void);
>
> -enum instCase {
> +typedef enum {
> INSTANTIATE_ALWAYS,
> INSTANTIATE_FOLLOW_NEWFILTER,
> -};
> +} instCase;
...the current naming is too prone to collision with other library's
include files.
>
>
> int virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
> diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
> index 4cea9cf..05bebbb 100644
> --- a/src/nwfilter/nwfilter_learnipaddr.c
> +++ b/src/nwfilter/nwfilter_learnipaddr.c
> @@ -771,7 +771,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
> const char *filtername ATTRIBUTE_UNUSED,
> virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
> virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
> - enum howDetect howDetect ATTRIBUTE_UNUSED)
> + howDetect howdetect ATTRIBUTE_UNUSED)
Same story for howDetect.
>
> -enum techDrvFlags {
> +typedef enum {
> TECHDRV_FLAG_INITIALIZED = (1 << 0),
> -};
> +} techDrvFlags;
Also this enum.
At any rate, your patch is a strict improvement, so ACK and pushed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140624/ded2d2b5/attachment-0001.sig>
More information about the libvir-list
mailing list