Moved the starting of the network stack into the driver (from the socket module)
to allow other protocols (like TCP) using the socket module. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19399 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define NET_STARTER_MODULE_NAME "network/stack/starter/v1"
|
||||||
|
|
||||||
// debugging macros
|
// debugging macros
|
||||||
#define LOGID "net_stack_driver: "
|
#define LOGID "net_stack_driver: "
|
||||||
#define ERROR(format, args...) dprintf(LOGID "ERROR: " format, ## args)
|
#define ERROR(format, args...) dprintf(LOGID "ERROR: " format, ## args)
|
||||||
@@ -161,9 +163,17 @@ net_stack_open(const char *name, uint32 flags, void **_cookie)
|
|||||||
if (atomic_add(&sOpenCount, 1) == 0) {
|
if (atomic_add(&sOpenCount, 1) == 0) {
|
||||||
// When we're opened for the first time, we'll try to load the
|
// When we're opened for the first time, we'll try to load the
|
||||||
// networking stack
|
// networking stack
|
||||||
status_t status = get_module(NET_SOCKET_MODULE_NAME, (module_info **)&sSocket);
|
module_info *module;
|
||||||
|
status_t status = get_module(NET_STARTER_MODULE_NAME, &module);
|
||||||
|
if (status < B_OK) {
|
||||||
|
ERROR("Can't load network stack module: %ld\n", status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = get_module(NET_SOCKET_MODULE_NAME, (module_info **)&sSocket);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
ERROR("Can't load " NET_SOCKET_MODULE_NAME " module: %ld\n", status);
|
ERROR("Can't load " NET_SOCKET_MODULE_NAME " module: %ld\n", status);
|
||||||
|
put_module(NET_STARTER_MODULE_NAME);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,6 +227,7 @@ net_stack_free_cookie(void *_cookie)
|
|||||||
// stack again (it will only be actually unloaded in case there is
|
// stack again (it will only be actually unloaded in case there is
|
||||||
// no interface defined)
|
// no interface defined)
|
||||||
put_module(NET_SOCKET_MODULE_NAME);
|
put_module(NET_SOCKET_MODULE_NAME);
|
||||||
|
put_module(NET_STARTER_MODULE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -892,12 +892,14 @@ socket_std_ops(int32 op, ...)
|
|||||||
switch (op) {
|
switch (op) {
|
||||||
case B_MODULE_INIT:
|
case B_MODULE_INIT:
|
||||||
{
|
{
|
||||||
|
// TODO: this is currently done in the net_stack driver
|
||||||
// initialize the main stack if not done so already
|
// initialize the main stack if not done so already
|
||||||
module_info *module;
|
//module_info *module;
|
||||||
return get_module(NET_STARTER_MODULE_NAME, &module);
|
//return get_module(NET_STARTER_MODULE_NAME, &module);
|
||||||
}
|
}
|
||||||
case B_MODULE_UNINIT:
|
case B_MODULE_UNINIT:
|
||||||
return put_module(NET_STARTER_MODULE_NAME);
|
//return put_module(NET_STARTER_MODULE_NAME);
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user