mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
Networking: Add a test to see a device pointer is still valid
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# net/netdev/Make.defs
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,7 +38,7 @@
|
||||
NETDEV_CSRCS += netdev_register.c netdev_ioctl.c netdev_txnotify.c
|
||||
NETDEV_CSRCS += netdev_findbyname.c netdev_findbyaddr.c netdev_count.c
|
||||
NETDEV_CSRCS += netdev_foreach.c netdev_unregister.c netdev_sem.c
|
||||
NETDEV_CSRCS += netdev_carrier.c netdev_default.c
|
||||
NETDEV_CSRCS += netdev_carrier.c netdev_default.c netdev_verify.c
|
||||
|
||||
ifeq ($(CONFIG_NET_RXAVAIL),y)
|
||||
NETDEV_CSRCS += netdev_rxnotify.c
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/net/ip.h>
|
||||
|
||||
@@ -124,6 +125,19 @@ void netdev_semgive(void);
|
||||
void netdev_ifup(FAR struct net_driver_s *dev);
|
||||
void netdev_ifdown(FAR struct net_driver_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: netdev_verify
|
||||
*
|
||||
* Description:
|
||||
* Verify that the specified device still exists
|
||||
*
|
||||
* Assumptions:
|
||||
* The caller has locked the network.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool netdev_verify(FAR struct net_driver_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: netdev_findbyname
|
||||
*
|
||||
|
||||
@@ -89,9 +89,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct net_driver_s *netdev_findbyname(const char *ifname)
|
||||
FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname)
|
||||
{
|
||||
struct net_driver_s *dev;
|
||||
FAR struct net_driver_s *dev;
|
||||
if (ifname)
|
||||
{
|
||||
netdev_semtake();
|
||||
|
||||
Reference in New Issue
Block a user