Changeset 503 for Whitix/branches/hybrid

Show
Ignore:
Timestamp:
05/14/08 00:02:22 (2 months ago)
Author:
mwhitworth
Message:

Build the network subsystem as a module.

Location:
Whitix/branches/hybrid/net
Files:
1 added
1 removed
5 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/hybrid/net/Makefile

    r236 r503  
    22include ../make.inc 
    33 
    4 OBJS = local.o socket.o network.o device.o 
     4MODULES = local.sys socket.sys network.sys device.sys eth.sys 
    55 
    6 build: $(OBJS) 
     6build: $(MODULES) 
    77        make -C inet 
     8        ld -r socket.sys network.sys device.sys eth.sys -o net.sys 
     9 
     10modules_install: 
     11        make -C inet modules_install 
     12        cp net.sys local.sys ../CdRoot/System/Modules/Core 
    813 
    914clean: 
    10         rm -f *.o 
     15        rm -f *.o *.sys 
    1116        make -C inet clean 
  • Whitix/branches/hybrid/net/device.c

    r247 r503  
    1818 
    1919#include <init.h> 
     20#include <module.h> 
    2021#include <net/network.h> 
    2122#include <slab.h> 
     
    3132} 
    3233 
     34SYMBOL_EXPORT(NetDeviceAlloc); 
     35 
    3336int NetDeviceRegister(struct NetDevice* device) 
    3437{ 
     
    3740} 
    3841 
     42SYMBOL_EXPORT(NetDeviceRegister); 
     43 
    3944int NetDeviceInit() 
    4045{ 
     
    4247        return 0; 
    4348} 
    44  
    45 NetInit(NetDeviceInit); 
  • Whitix/branches/hybrid/net/inet/Makefile

    r226 r503  
    22include ../../make.inc 
    33 
    4 OBJS = eth.o ipv4.o tcp.o 
     4OBJS = ipv4.o tcp.o 
    55 
    66build: $(OBJS) 
     7        ld -r $(OBJS) -o inet.sys 
     8 
     9modules_install: 
     10        cp inet.sys ../../CdRoot/System/Modules/Core 
    711 
    812clean: 
  • Whitix/branches/hybrid/net/network.c

    r230 r503  
    1818 
    1919#include <console.h> 
     20#include <init.h> 
     21#include <module.h> 
    2022#include <net/socket.h> 
    2123#include <typedefs.h> 
     
    3638int NetworkInit() 
    3739{ 
     40        printf("NETWORK: Initialising network stack.\n"); 
     41 
     42        EthInit(); 
     43 
    3844        return SocketInit(); 
     45        return 0; 
    3946} 
     47 
     48SubSysInit(NetworkInit); 
  • Whitix/branches/hybrid/net/socket.c

    r333 r503  
    2323#include <fs/vfs.h> 
    2424#include <malloc.h> 
     25#include <module.h> 
    2526#include <net/network.h> 
    2627#include <net/socket.h> 
     
    8687 
    8788        if (UNLIKELY(!file)) 
    88                 return -EBADF; 
     89                return; 
    8990 
    9091        file->vNode=NULL; 
     
    167168} 
    168169 
     170/* Make local-only? */ 
    169171int SocketDoAccept(struct Socket* server, struct Socket* client, struct Socket** child) 
    170172{ 
     
    186188} 
    187189 
     190SYMBOL_EXPORT(SocketDoAccept); 
     191 
    188192struct SocketBuffer* SocketAllocateBuffer(const void* buffer, int length) 
    189193{ 
     
    200204} 
    201205 
     206SYMBOL_EXPORT(SocketAllocateBuffer); 
     207 
    202208int SocketDestroyBuffer(struct SocketBuffer* sockBuff) 
    203209{ 
     
    207213} 
    208214 
     215SYMBOL_EXPORT(SocketDestroyBuffer); 
     216 
    209217int SocketPoll(struct File* file, struct PollItem* item, struct PollQueue* pollQueue) 
    210218{ 
     
    221229{ 
    222230        struct VMArea* base, *curr; 
    223         int verifiedLen=0; 
     231        DWORD verifiedLen=0; 
    224232 
    225233        base=VmLookupAddress(current, (DWORD)buffer); 
     
    435443} 
    436444 
     445SYMBOL_EXPORT(SocketRegisterFamily); 
     446 
     447#define NET_SYS_BASE    42 
     448 
    437449int SocketInit() 
    438450{ 
     
    442454                return -ENOMEM; 
    443455 
    444         return 0; 
    445 } 
    446  
     456        /* Register system calls. */ 
     457        SysRegisterCall(NET_SYS_BASE+0, (DWORD)&SysSocketCreate); 
     458        SysRegisterCall(NET_SYS_BASE+1, (DWORD)&SysSocketBind); 
     459        SysRegisterCall(NET_SYS_BASE+2, (DWORD)&SysSocketConnect); 
     460        SysRegisterCall(NET_SYS_BASE+3, (DWORD)&SysSocketListen); 
     461        SysRegisterCall(NET_SYS_BASE+4, (DWORD)&SysSocketAccept); 
     462        SysRegisterCall(NET_SYS_BASE+5, (DWORD)&SysSocketSend); 
     463        SysRegisterCall(NET_SYS_BASE+6, (DWORD)&SysSocketReceive); 
     464        SysRegisterCall(NET_SYS_BASE+7, (DWORD)&SysSocketIoCtl); 
     465        SysRegisterCall(NET_SYS_BASE+8, (DWORD)&SysSocketClose); 
     466 
     467        return 0; 
     468} 
     469