diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-08-09 14:35:27 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-18 00:27:18 +0200 |
commit | 5a97027c99163974a16614363dafc18a63b990e0 (patch) | |
tree | 544f2bea96a5d04c238b51b08ffb54b5f87421bf /linux/dev/glue | |
parent | 511300311b1a57ad7279f91ab11d1bcf6fe202da (diff) |
2008-07-29 Zheng Da <zhengda1936@gmail.com>
Manuel Menal <mmenal@hurdfr.org>
* include/device/net_status.h (NET_FLAGS): New macro.
* linux/dev/glue/net.c (device_get_status): Handle NET_FLAGS case.
(device_set_status): Likewise, calls dev_change_flags.
* linux/dev/include/linux/netdevice.h (dev_change_flags): Declare
function.
* linux/dev/net/core/dev.c (dev_change_flags): Add function.
Diffstat (limited to 'linux/dev/glue')
-rw-r--r-- | linux/dev/glue/net.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c index b76e098..20ce754 100644 --- a/linux/dev/glue/net.c +++ b/linux/dev/glue/net.c @@ -533,6 +533,17 @@ static io_return_t device_get_status (void *d, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t *count) { + if (flavor == NET_FLAGS) + { + struct net_data *net = (struct net_data *) d; + + if (*count != sizeof(short)) + return D_INVALID_SIZE; + + *(short *) status = net->dev->flags; + return D_SUCCESS; + } + if(flavor >= SIOCIWFIRST && flavor <= SIOCIWLAST) { /* handle wireless ioctl */ @@ -592,6 +603,21 @@ static io_return_t device_set_status(void *d, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t count) { + if (flavor == NET_FLAGS) + { + if (count != sizeof(short)) + return D_INVALID_SIZE; + + short flags = *(short *) status; + struct net_data *net = (struct net_data *) d; + + dev_change_flags (net->dev, flags); + + /* Change the flags of the Mach device, too. */ + net->ifnet.if_flags = net->dev->flags; + return D_SUCCESS; + } + if(flavor < SIOCIWFIRST || flavor > SIOCIWLAST) return D_INVALID_OPERATION; |