Conversion to file coding style
This commit is contained in:
parent
a0304e96ac
commit
288188d159
44
ksym_mod.c
44
ksym_mod.c
@ -2,6 +2,7 @@
|
||||
ksym_mod.c - functions for building symbol lookup tables for klogd
|
||||
Copyright (c) 1995, 1996 Dr. G.W. Wettstein <greg@wind.rmcc.com>
|
||||
Copyright (c) 1996 Enjellic Systems Development
|
||||
Copyright (c) 1998-2000, 2004,7 Martin Schulze <joey@infodrom.org>
|
||||
|
||||
This file is part of the sysklogd package, a kernel and system log daemon.
|
||||
|
||||
@ -150,7 +151,7 @@ struct Module
|
||||
};
|
||||
|
||||
static int num_modules = 0;
|
||||
struct Module *sym_array_modules = NULL;
|
||||
struct Module *sym_array_modules = (struct Module *) 0;
|
||||
|
||||
static int have_modules = 0;
|
||||
|
||||
@ -203,12 +204,6 @@ extern int InitMsyms()
|
||||
/* Initialize the kernel module symbol table. */
|
||||
FreeModules();
|
||||
|
||||
/*
|
||||
* New style symbol table parser. This uses the newer query_module
|
||||
* function rather than the old obsolete hack of stepping thru
|
||||
* /dev/kmem.
|
||||
*/
|
||||
|
||||
/*
|
||||
* First, we query for the list of loaded modules. We may
|
||||
* have to grow our buffer in size.
|
||||
@ -217,11 +212,12 @@ extern int InitMsyms()
|
||||
modsize += modsize;
|
||||
newbuf = realloc(modbuf, modsize);
|
||||
|
||||
if (newbuf==NULL) {
|
||||
/* Well, that sucks. */
|
||||
if ( newbuf == NULL )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error loading kernel symbols " \
|
||||
"- %s\n", strerror(errno));
|
||||
if (modbuf!=NULL) free(modbuf);
|
||||
if ( modbuf != NULL )
|
||||
free(modbuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -229,7 +225,8 @@ extern int InitMsyms()
|
||||
|
||||
result = query_module(NULL, QM_MODULES, modbuf, modsize, &rtn);
|
||||
|
||||
if (result<0 && errno!=ENOSPC) {
|
||||
if ( result < 0 && errno != ENOSPC )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error querying loaded modules " \
|
||||
"- %s\n", strerror(errno));
|
||||
free(modbuf);
|
||||
@ -237,8 +234,8 @@ extern int InitMsyms()
|
||||
}
|
||||
} while ( result < 0 );
|
||||
|
||||
if ( rtn <= 0 ) {
|
||||
/* No modules??? */
|
||||
if ( rtn <= 0 )
|
||||
{
|
||||
Syslog(LOG_INFO, "No module symbols loaded - "
|
||||
"modules disabled?\n");
|
||||
free(modbuf);
|
||||
@ -272,10 +269,10 @@ extern int InitMsyms()
|
||||
* klogd.
|
||||
*/
|
||||
newbuf = modbuf;
|
||||
for (tmp=rtn-1; tmp>=0; tmp--)
|
||||
for (tmp=0; tmp < rtn; tmp++)
|
||||
{
|
||||
mod_table[tmp] = newbuf;
|
||||
newbuf+=(strlen(newbuf)+1);
|
||||
newbuf += strlen(newbuf)+1;
|
||||
if ( !AddModule(mod_table[tmp]) )
|
||||
{
|
||||
Syslog(LOG_WARNING, "Error adding kernel module table "
|
||||
@ -352,7 +349,8 @@ static void FreeModules()
|
||||
/* Check to see if the module symbol tables need to be cleared. */
|
||||
have_modules = 0;
|
||||
|
||||
if (sym_array_modules != NULL) {
|
||||
if ( sym_array_modules != NULL )
|
||||
{
|
||||
for (nmods = 0; nmods < num_modules; ++nmods)
|
||||
{
|
||||
mp = &sym_array_modules[nmods];
|
||||
@ -434,11 +432,12 @@ static int AddModule(symbol)
|
||||
symsize += symsize;
|
||||
newbuf = realloc(symbuf, symsize);
|
||||
|
||||
if (newbuf==NULL) {
|
||||
/* Well, that sucks. */
|
||||
if ( newbuf == NULL )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error loading kernel symbols " \
|
||||
"- %s\n", strerror(errno));
|
||||
if (symbuf!=NULL) free(symbuf);
|
||||
if ( symbuf != NULL )
|
||||
free(symbuf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -446,7 +445,8 @@ static int AddModule(symbol)
|
||||
|
||||
result = query_module(symbol, QM_SYMBOLS, symbuf, symsize, &rtn);
|
||||
|
||||
if (result<0 && errno!=ENOSPC) {
|
||||
if ( result < 0 && errno != ENOSPC )
|
||||
{
|
||||
Syslog(LOG_ERR, "Error querying symbol list for %s " \
|
||||
"- %s\n", symbol, strerror(errno));
|
||||
free(symbuf);
|
||||
@ -454,8 +454,8 @@ static int AddModule(symbol)
|
||||
}
|
||||
} while ( result < 0 );
|
||||
|
||||
if ( rtn < 0 ) {
|
||||
/* No symbols??? */
|
||||
if ( rtn < 0 )
|
||||
{
|
||||
Syslog(LOG_INFO, "No module symbols loaded - unknown error.\n");
|
||||
free(symbuf);
|
||||
return(0);
|
||||
|
Loading…
Reference in New Issue
Block a user