root / Whitix / branches / hybrid / net / device.c
| Revision 503, 1.3 kB (checked in by mwhitworth, 4 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* This file is part of Whitix. |
| 2 | * |
| 3 | * Whitix is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * Whitix is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with Whitix; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | #include <init.h> |
| 20 | #include <module.h> |
| 21 | #include <net/network.h> |
| 22 | #include <slab.h> |
| 23 | |
| 24 | struct Cache* netDeviceCache; |
| 25 | |
| 26 | /* Only one device for now! TODO: Add support for multiple devices. */ |
| 27 | struct NetDevice* currDevice; |
| 28 | |
| 29 | struct NetDevice* NetDeviceAlloc() |
| 30 | { |
| 31 | return (struct NetDevice*)MemCacheAlloc(netDeviceCache); |
| 32 | } |
| 33 | |
| 34 | SYMBOL_EXPORT(NetDeviceAlloc); |
| 35 | |
| 36 | int NetDeviceRegister(struct NetDevice* device) |
| 37 | { |
| 38 | currDevice=device; |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | SYMBOL_EXPORT(NetDeviceRegister); |
| 43 | |
| 44 | int NetDeviceInit() |
| 45 | { |
| 46 | netDeviceCache=MemCacheCreate("Network device cache", sizeof(struct NetDevice), NULL, NULL, 0); |
| 47 | return 0; |
| 48 | } |
Note: See TracBrowser
for help on using the browser.
