Re: /net/core/dev_2.0.c
Re: /net/core/dev_2.0.c
- Subject: Re: /net/core/dev_2.0.c
- From: Stephen Checkoway <email@hidden>
- Date: Mon, 11 Feb 2013 09:15:01 -0500
Why are you just emailing code to the list? Do you have a question?
On Feb 11, 2013, at 3:52 AM, Kenichi Mori <email@hidden> wrote:
> Hi folks
> this my code is very exedent very sorry much
> thanks for read me please
>
>
>
>
> //
> // dev_2.0.c
> //
> //
> // Created by Mac User on 13/02/11.
> //
> //
>
> #include <stdio.h>
> /**
> * __xev_get_by_name - find a device by its name
> * @name: name to find
> *
> * Find an interface by name. Must be called under RTNL semaphore
> * or @dev_base_lock. If the name is found a pointer to the device
> * is returned. If the name is not found then %NULL is returned. The
> * reference counters are not incremented so the caller must be
> * careful with locks.
> */
>
> struct net_xevice *__xev_get_by_name(const char *name)
> {
> struct hlist_node *p;
>
> hlist_for_each(p, xev_name_hash(name)) {
> struct net_device *xev
> = hlist_entry(p, struct net_device, name_hlist);
> if (!strncmp(dev->name, name, IFNAMSIZ))
> return xev;
> }
> return NULL;
> }
>
> /**
> * xev_get_by_name - find a device by its name
> * @name: name to find
> *
> * Find an interface by name. This can be called from any
> * context and does its own locking. The returned handle has
> * the usage count incremented and the caller must use dev_put() to
> * release it when it is no longer needed. %NULL is returned if no
> * matching device is found.
> */
>
> struct net_device *xev_get_by_name(const char *name)
> {
> struct net_device *xev;
>
> read_lock(&xev_base_lock);
> xev = __xev_get_by_name(name);
> if (xev)
> xev_hold(xev);
> read_unlock(&xev_base_lock);
> return xev;
> }
>
> /**
> * __xev_get_by_index - find a device by its ifindex
> * @ifindex: index of device
> *
> * Search for an interface by index. Returns %NULL if the device
> * is not found or a pointer to the device. The device has not
> * had its reference counter increased so the caller must be careful
> * about locking. The caller must hold either the RTNL semaphore
> * or @dev_base_lock.
> */
>
> struct net_device *__xev_get_by_index(int ifindex)
> {
> struct hlist_node *p;
>
> hlist_for_each(p, xev_index_hash(ifindex)) {
> struct net_device *xev
> = hlist_entry(p, struct net_device, index_hlist);
> if (dev->ifindex == ifindex)
> return xev;
> }
> return NULL;
> }
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Stephen Checkoway
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden