git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modules/UDI - Implimenting UDI support, can load udi_dpt from udiref
[tpg/acess2.git]
/
KernelLand
/
Modules
/
IPStack
/
adapters.c
diff --git
a/KernelLand/Modules/IPStack/adapters.c
b/KernelLand/Modules/IPStack/adapters.c
index
16e0f97
..
e121eca
100644
(file)
--- a/
KernelLand/Modules/IPStack/adapters.c
+++ b/
KernelLand/Modules/IPStack/adapters.c
@@
-20,8
+20,8
@@
void *IPStack_Adapter_Add(const tIPStack_AdapterType *Type, void *Ptr, const void *HWAddr);
void IPStack_Adapter_Del(void *Handle);
// --- VFS API ---
void *IPStack_Adapter_Add(const tIPStack_AdapterType *Type, void *Ptr, const void *HWAddr);
void IPStack_Adapter_Del(void *Handle);
// --- VFS API ---
-
char *Adapter_ReadDir(tVFS_Node *Node, int Pos
);
-tVFS_Node *Adapter_FindDir(tVFS_Node *Node, const char *Name);
+
int Adapter_ReadDir(tVFS_Node *Node, int Pos, char Name[FILENAME_MAX]
);
+tVFS_Node *Adapter_FindDir(tVFS_Node *Node, const char *Name
, Uint Flags
);
int Adapter_DirIOCtl(tVFS_Node *Node, int Num, void *Data);
int Adapter_IOCtl(tVFS_Node *Node, int Num, void *Data);
// --- "Internal" (IPStack) API ---
int Adapter_DirIOCtl(tVFS_Node *Node, int Num, void *Data);
int Adapter_IOCtl(tVFS_Node *Node, int Num, void *Data);
// --- "Internal" (IPStack) API ---
@@
-83,10
+83,16
@@
void *IPStack_Adapter_Add(const tIPStack_AdapterType *Type, void *Ptr, const voi
gpIP_AdapterList_Last->Next = ret;
gpIP_AdapterList_Last = ret;
Mutex_Release( &glIP_Adapters );
gpIP_AdapterList_Last->Next = ret;
gpIP_AdapterList_Last = ret;
Mutex_Release( &glIP_Adapters );
-
+
+ Log_Log("IPStack", "Adapter %i: %s %02x:%02x:%02x:%02x:%02x:%02x",
+ ret->Index, Type->Name,
+ ret->HWAddr[0], ret->HWAddr[1], ret->HWAddr[2],
+ ret->HWAddr[3], ret->HWAddr[4], ret->HWAddr[5]
+ );
+
// Watch the adapter for incoming packets
// Watch the adapter for incoming packets
-
tTID tid
= Proc_SpawnWorker(Adapter_int_WatchThread, ret);
- if(
tid < 0
) {
+
void *worker
= Proc_SpawnWorker(Adapter_int_WatchThread, ret);
+ if(
!worker
) {
Log_Warning("IPStack", "Unable to create watcher thread for %p", ret);
}
Log_Warning("IPStack", "Unable to create watcher thread for %p", ret);
}
@@
-130,13
+136,14
@@
void IPStack_Adapter_Del(void *Handle)
}
// --- VFS API ---
}
// --- VFS API ---
-
char *Adapter_ReadDir(tVFS_Node *Node, int Pos
)
+
int Adapter_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]
)
{
{
- if( Pos < 0 ) return
NUL
L;
+ if( Pos < 0 ) return
-EINVA
L;
// Loopback
if( Pos == 0 ) {
// Loopback
if( Pos == 0 ) {
- return strdup("lo");
+ strcpy(Dest, "lo");
+ return 0;
}
Pos --;
}
Pos --;
@@
-144,7
+151,8
@@
char *Adapter_ReadDir(tVFS_Node *Node, int Pos)
tAdapter *a; int i;\
for(i=0,a=list; i < Pos && a; i ++, a = a->Next ); \
if( a ) { \
tAdapter *a; int i;\
for(i=0,a=list; i < Pos && a; i ++, a = a->Next ); \
if( a ) { \
- return Adapter_GetName(a);\
+ strncpy(Dest, Adapter_GetName(a), FILENAME_MAX);\
+ return 0;\
} \
Pos -= i; \
} while(0);
} \
Pos -= i; \
} while(0);
@@
-152,10
+160,10
@@
char *Adapter_ReadDir(tVFS_Node *Node, int Pos)
CHECK_LIST(gpIP_AdapterList, "eth");
// TODO: Support other types of adapters (wifi, tap, ...)
CHECK_LIST(gpIP_AdapterList, "eth");
// TODO: Support other types of adapters (wifi, tap, ...)
- return
NUL
L;
+ return
-EINVA
L;
}
}
-tVFS_Node *Adapter_FindDir(tVFS_Node *Node, const char *Name)
+tVFS_Node *Adapter_FindDir(tVFS_Node *Node, const char *Name
, Uint Flags
)
{
tAdapter *a = Adapter_GetByName(Name);
if(!a)
{
tAdapter *a = Adapter_GetByName(Name);
if(!a)
UCC
git Repository :: git.ucc.asn.au