mirror of
https://github.com/deadw00d/AROS.git
synced 2025-12-06 13:11:35 +00:00
# inline FreeListVec # disable debug by default.
This commit is contained in:
@ -161,8 +161,5 @@ void UnknownCommand(struct NetInfoDevice *, struct NetInfoReq *, struct NetInfoM
|
||||
|
||||
/* support functions */
|
||||
struct NetInfoMap *CheckUnit(struct NetInfoDevice *, struct Unit *u);
|
||||
void FreeListVec(struct NetInfoDevice *, struct List *list);
|
||||
struct Node *FindNode(struct List *list, struct Node *node);
|
||||
char *strsep(register char **stringp, register const char *delim);
|
||||
|
||||
#endif /* _BASE_H_ */
|
||||
|
||||
@ -7,12 +7,17 @@
|
||||
* Helsinki University of Technology, Finland.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
#define DEBUG 0
|
||||
#include <aros/debug.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
#include "entries.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <string.h>
|
||||
#if defined(DEBUG)
|
||||
@ -20,6 +25,7 @@
|
||||
#include "assert.h"
|
||||
#endif
|
||||
|
||||
#define DENTS(x)
|
||||
|
||||
static struct NetInfoPointer *FindPointer(struct List *list, struct Ent*to);
|
||||
void GetByNameCmd(struct NetInfoDevice *nid, struct NetInfoReq *req, struct NetInfoMap *nim);
|
||||
@ -93,13 +99,16 @@ void DeInitNetInfoMap(struct NetInfoDevice *nid, struct NetInfoMap *nim)
|
||||
*/
|
||||
void GetByNameCmd(struct NetInfoDevice *nid, struct NetInfoReq *req, struct NetInfoMap *nim)
|
||||
{
|
||||
struct Ent *e = InternalSetEnts(nid, nim);
|
||||
const UBYTE *name = (const UBYTE *)
|
||||
((struct NetInfoEnt*)req->io_Data)->nie_name;
|
||||
struct Ent *e;
|
||||
LONG retval = NIERR_NOTFOUND;
|
||||
|
||||
D(bug("[NetInfo] %s()\n", __func__));
|
||||
|
||||
e = InternalSetEnts(nid, nim);
|
||||
D(bug("[NetInfo] %s: Ents @ 0x%p\n", __func__, e));
|
||||
|
||||
while (e = GetNextEnt(e)) {
|
||||
if (strcmp(e->e_name, name) == 0) {
|
||||
if (Method(copy_out, nim)(req, e)) {
|
||||
@ -122,12 +131,15 @@ void GetByNameCmd(struct NetInfoDevice *nid, struct NetInfoReq *req, struct NetI
|
||||
*/
|
||||
void GetByIDCmd(struct NetInfoDevice *nid, struct NetInfoReq *req, struct NetInfoMap *nim)
|
||||
{
|
||||
struct Ent *e = InternalSetEnts(nid, nim);
|
||||
struct Ent *e;
|
||||
LONG id = ((struct NetInfoEnt*)req->io_Data)->nie_id;
|
||||
BYTE retval = NIERR_NOTFOUND;
|
||||
|
||||
D(bug("[NetInfo] %s()\n", __func__));
|
||||
|
||||
e = InternalSetEnts(nid, nim);
|
||||
D(bug("[NetInfo] %s: Ents @ 0x%p\n", __func__, e));
|
||||
|
||||
while (e = GetNextEnt(e)) {
|
||||
if (e->e_id == id) {
|
||||
if (Method(copy_out, nim)(req, e)) {
|
||||
@ -456,7 +468,7 @@ void InternalEndEnts(struct NetInfoDevice *nid, struct NetInfoMap *nim)
|
||||
*/
|
||||
struct Ent *GetNextEnt(struct Ent *e)
|
||||
{
|
||||
D(bug("[NetInfo] %s()\n", __func__));
|
||||
DENTS(bug("[NetInfo] %s()\n", __func__));
|
||||
|
||||
e = (struct Ent *)e->e_node.ln_Succ;
|
||||
|
||||
|
||||
@ -7,6 +7,10 @@
|
||||
* Helsinki University of Technology, Finland.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
#define DEBUG 0
|
||||
#include <aros/debug.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
|
||||
@ -11,36 +11,6 @@
|
||||
|
||||
#include "base.h"
|
||||
|
||||
/*
|
||||
* Free nodes of a list (they should all be allocated with AllocVec())
|
||||
*/
|
||||
void FreeListVec(struct NetInfoDevice *nid, struct List *list)
|
||||
{
|
||||
struct Node *entry, *next;
|
||||
|
||||
for (entry = list->lh_Head; next = entry->ln_Succ; entry = next) {
|
||||
Remove(entry);
|
||||
FreeVec(entry);
|
||||
entry = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure that a node is in list
|
||||
* return node if it is, NULL otherwise
|
||||
*/
|
||||
struct Node *FindNode(struct List *list, struct Node *node)
|
||||
{
|
||||
struct Node *entry, *next;
|
||||
|
||||
for (entry = list->lh_Head; next = entry->ln_Succ; entry = next)
|
||||
if (entry == node) {
|
||||
return node;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get next token from string *stringp, where tokens are nonempty
|
||||
* strings separated by characters from delim.
|
||||
|
||||
28
workbench/devs/netinfo/misc.h
Normal file
28
workbench/devs/netinfo/misc.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* misc.c
|
||||
*
|
||||
* Author: ppessi <Pekka.Pessi@hut.fi>
|
||||
*
|
||||
* Copyright <20> 1993 AmiTCP/IP Group, <AmiTCP-group@hut.fi>
|
||||
* Helsinki University of Technology, Finland.
|
||||
*/
|
||||
|
||||
#include <proto/exec.h>
|
||||
|
||||
#include "base.h"
|
||||
|
||||
/*
|
||||
* Free nodes of a list (they should all be allocated with AllocVec())
|
||||
*/
|
||||
static inline void FreeListVec(struct NetInfoDevice *nid, struct List *list)
|
||||
{
|
||||
struct Node *entry, *next;
|
||||
|
||||
for (entry = list->lh_Head; next = entry->ln_Succ; entry = next) {
|
||||
Remove(entry);
|
||||
FreeVec(entry);
|
||||
entry = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *strsep(register char **stringp, register const char *delim);
|
||||
@ -109,6 +109,10 @@
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
#define DEBUG 0
|
||||
#include <aros/debug.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
##begin config
|
||||
version 3.4
|
||||
version 3.5
|
||||
basename NetInfo
|
||||
libbasetype struct NetInfoDevice
|
||||
residentpri 0
|
||||
|
||||
@ -7,6 +7,10 @@
|
||||
* Helsinki University of Technology, Finland.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
#define DEBUG 0
|
||||
#include <aros/debug.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
@ -260,18 +264,29 @@ static struct Ent *ParsePasswd(struct NetInfoDevice *nid, register UBYTE *p)
|
||||
assert(np != NULL);
|
||||
#endif
|
||||
if (i < PASSWDFIELDS || !np) {
|
||||
if (i < PASSWDFIELDS) {
|
||||
bug("[NetInfo] %s: ERROR: malformed enry\n", __func__);
|
||||
} else {
|
||||
bug("[NetInfo] %s: ERROR: no line-end?\n", __func__);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((i = StrToLong(field[2], &uid)) <= 0 || field[2][i] != '\0')
|
||||
if ((i = StrToLong(field[2], &uid)) <= 0 || field[2][i] != '\0') {
|
||||
bug("[NetInfo] %s: ERROR: failed to parse uid\n", __func__);
|
||||
return NULL;
|
||||
if ((i = StrToLong(field[3], &gid)) <= 0 || field[3][i] != '\0')
|
||||
}
|
||||
if ((i = StrToLong(field[3], &gid)) <= 0 || field[3][i] != '\0') {
|
||||
bug("[NetInfo] %s: ERROR: failed to parse gid\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
txtlen = np - field[0] - (field[4] - field[2]);
|
||||
pe = AllocVec(sizeof(*pe) + txtlen, MEMF_CLEAR);
|
||||
if (!pe)
|
||||
if (!pe) {
|
||||
bug("[NetInfo] %s: Failed to allocate entry storage\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pe->pe_node.ln_Type = ENT_PASSWD;
|
||||
pe->pe_tlen = txtlen;
|
||||
@ -285,6 +300,8 @@ static struct Ent *ParsePasswd(struct NetInfoDevice *nid, register UBYTE *p)
|
||||
to = stpcopy(pe->pe_passwd->pw_dir = to, field[5]);
|
||||
to = stpcopy(pe->pe_passwd->pw_shell = to, field[6]);
|
||||
|
||||
D(bug("[NetInfo] %s: <%d:%d> '%s'\n", __func__, pe->pe_passwd->pw_uid, pe->pe_passwd->pw_gid, pe->pe_passwd->pw_name));
|
||||
|
||||
#if defined(DEBUG)
|
||||
assert(to == pe->pe_passwd->pw_name + txtlen);
|
||||
#endif
|
||||
|
||||
@ -7,6 +7,10 @@
|
||||
* Helsinki University of Technology, Finland.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
#define DEBUG 0
|
||||
#include <aros/debug.h>
|
||||
|
||||
#include <proto/exec.h>
|
||||
|
||||
Reference in New Issue
Block a user