On 24 November 2014 06:54, Maxim Uvarov <[email protected]> wrote:
> Signed-off-by: Maxim Uvarov <[email protected]> > --- > platform/linux-generic/include/api/odp_packet_io.h | 10 ++++++++++ > platform/linux-generic/odp_packet_io.c | 11 +++++++++++ > 2 files changed, 21 insertions(+) > > diff --git a/platform/linux-generic/include/api/odp_packet_io.h > b/platform/linux-generic/include/api/odp_packet_io.h > index 667395c..b3b7ea6 100644 > --- a/platform/linux-generic/include/api/odp_packet_io.h > +++ b/platform/linux-generic/include/api/odp_packet_io.h > @@ -148,6 +148,16 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu); > */ > int odp_pktio_mtu(odp_pktio_t id); > > +/* > + * Return the interface name from a pktio handle. This is the > + * name that was passed to the odp_pktio_open() call. > + * > + * @param[in] id ODP Packet IO handle. > + * > + * @return pointer to the iface name or NULL. > I think it adds value to describe what may cause the NULL, also presumably this will always return a terminated string can an application rely on that? @retval Pointer to the interface name. @retval NULL if packet handle is invalid > + */ > +const char *odp_pktio_get_name(odp_pktio_t id); > + > /** > * @} > */ > diff --git a/platform/linux-generic/odp_packet_io.c > b/platform/linux-generic/odp_packet_io.c > index c523350..9ceb989 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -542,3 +542,14 @@ int odp_pktio_mtu(odp_pktio_t id) > > return ifr.ifr_mtu; > } > + > +const char *odp_pktio_get_name(odp_pktio_t id) > +{ > + pktio_entry_t *entry; > + > + entry = get_entry(id); > + if (entry == NULL) > + return NULL; > + > Ensuring it is a terminated string with a removable runtime assert might be valuable. Is there a max size that this should be check against in an assert? > + return entry->s.name; > +} > -- > 1.8.5.1.163.gd7aced9 > > > _______________________________________________ > lng-odp mailing list > [email protected] > http://lists.linaro.org/mailman/listinfo/lng-odp > -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP
_______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
