git sha: 57e248d7f09560f7e7ddd2791269830cedc2a7d6
Author: Eelco Chaudron <[email protected]>
dpif-netdev: Add full name to the dp_netdev structure.

This patch adds a full_name field to the dp_netdev structure to store
the datapath name in "type@name" format. The full name is allocated
during datapath creation and freed during cleanup.

> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 2aeef471f..6324cfb7a 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -271,6 +271,7 @@ enum sched_assignment_type {
>  struct dp_netdev {
>      const struct dpif_class *const class;
>      const char *const name;
> +    const char *const full_name;
>      struct ovs_refcount ref_cnt;
>      atomic_flag destroyed;
>  
> @@ -1886,6 +1887,8 @@ create_dp_netdev(const char *name, const struct 
> dpif_class *class,
>  
>      *CONST_CAST(const struct dpif_class **, &dp->class) = class;
>      *CONST_CAST(const char **, &dp->name) = xstrdup(name);
> +    *CONST_CAST(const char **, &dp->full_name) = xasprintf("%s@%s",
> +                                                           class->type, 
> name);

Could xasprintf fail and return NULL here? The allocation happens early
in the datapath creation without any NULL check on the result.

> @@ -2054,6 +2057,7 @@ dp_netdev_free(struct dp_netdev *dp)
>      free(dp->max_sleep_list);
>      free(dp->pmd_cmask);
>      free(CONST_CAST(char *, dp->name));
> +    free(CONST_CAST(char *, dp->full_name));
>      free(dp);
>  }
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to