Commit recent changes.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5893 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2004-01-03 19:04:12 +00:00
parent bb917ffed7
commit a731d1b178
7 changed files with 15 additions and 16 deletions
Binary file not shown.
@@ -295,6 +295,7 @@ atomize(const void * at, const char *string, int create) {
uint32 high = count; uint32 high = count;
uint32 index = 0; uint32 index = 0;
int test = -1; int test = -1;
/* do a binary search on the vector for a match */ /* do a binary search on the vector for a match */
while (low < high) { while (low < high) {
index = (low + high) / 2; index = (low + high) / 2;
@@ -302,7 +303,7 @@ atomize(const void * at, const char *string, int create) {
if (test < 0) if (test < 0)
high = index; high = index;
else if (test > 0) else if (test > 0)
low = index + 1; low = ++index;
else else
break; break;
} }
@@ -6,10 +6,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/dirent.h> #include <KernelExport.h>
#include <sys/stat.h>
#include <Drivers.h>
#include "net_stack.h" #include "net_stack.h"
@@ -23,13 +20,13 @@ static struct net_stack_module_info *g_stack = NULL;
// ------------------- // -------------------
status_t init(net_layer *me) status_t init(net_layer *me)
{ {
printf("%s: initing layer\n", me->name); dprintf("%s: initing layer\n", me->name);
return B_OK; return B_OK;
} }
status_t uninit(net_layer *me) status_t uninit(net_layer *me)
{ {
printf("loopback: uniniting layer\n"); dprintf("loopback: uniniting layer\n");
return B_OK; return B_OK;
} }
@@ -40,12 +37,13 @@ status_t enable(net_layer *me, bool enable)
} }
status_t output_buffer(net_layer *me, net_buffer *buffer) status_t process_output(net_layer *me, net_buffer *buffer)
{ {
if (!buffer) if (!buffer)
return B_ERROR; return B_ERROR;
return g_stack->push_buffer_up(me, buffer); // Here the magical loopback effect ;-)
return g_stack->send_up(me, buffer);
} }
// #pragma mark - // #pragma mark -
@@ -56,16 +54,16 @@ status_t std_ops(int32 op, ...)
case B_MODULE_INIT: { case B_MODULE_INIT: {
status_t status; status_t status;
printf("loopback: B_MODULE_INIT\n"); dprintf("loopback: B_MODULE_INIT\n");
status = get_module(NET_STACK_MODULE_NAME, (module_info **) &g_stack); status = get_module(NET_STACK_MODULE_NAME, (module_info **) &g_stack);
if (status != B_OK) if (status != B_OK)
return status; return status;
return g_stack->register_layer("*/loopback", &nlmi, NULL, NULL); return g_stack->register_layer("loopback", "loopback/frame", 0, &nlmi, NULL, NULL);
} }
case B_MODULE_UNINIT: case B_MODULE_UNINIT:
printf("loopback: B_MODULE_UNINIT\n"); dprintf("loopback: B_MODULE_UNINIT\n");
put_module(NET_STACK_MODULE_NAME); put_module(NET_STACK_MODULE_NAME);
break; break;
@@ -86,8 +84,8 @@ struct net_layer_module_info nlmi = {
uninit, uninit,
enable, enable,
NULL, // no control() NULL, // no control()
output_buffer, NULL, // interface layer: processing input buffer doesn't make sense!
NULL // interface layer: no input_buffer() process_output
}; };
_EXPORT module_info *modules[] = { _EXPORT module_info *modules[] = {
@@ -256,7 +256,7 @@ status_t delete_pool_node2(memory_pool * pool, void * node)
// #pragma mark - // #pragma mark -
struct memory_pool_module_info mpmi = { memory_pool_module_info mpmi = {
{ {
MEMORY_POOL_MODULE_NAME, MEMORY_POOL_MODULE_NAME,
0, 0,