updated logging for seperate files for main and clone accelerant

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5909 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2004-01-05 12:57:22 +00:00
parent ccbc426cd2
commit a243b54e73
5 changed files with 41 additions and 11 deletions
@@ -4,7 +4,7 @@
Other authors: Other authors:
Mark Watson, Mark Watson,
Rudolf Cornelissen 10/2002-12/2003. Rudolf Cornelissen 10/2002-1/2004.
*/ */
#define MODULE_BIT 0x00800000 #define MODULE_BIT 0x00800000
@@ -254,7 +254,18 @@ status_t CLONE_ACCELERANT(void *data) {
strcat(path, (const char *)data); strcat(path, (const char *)data);
/* open the device, the permissions aren't important */ /* open the device, the permissions aren't important */
fd = open(path, B_READ_WRITE); fd = open(path, B_READ_WRITE);
if (fd < 0) { if (fd < 0)
{
/* we can't use LOG because we didn't get the shared_info struct.. */
char fname[64];
FILE *myhand = NULL;
sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.0.log");
myhand=fopen(fname,"a+");
fprintf(myhand, "CLONE_ACCELERANT: couldn't open kerneldriver %s! Aborting.\n", path);
fclose(myhand);
/* abort with resultcode from open attempt on kerneldriver */
result = fd; result = fd;
goto error0; goto error0;
} }
@@ -3,7 +3,7 @@
This file may be used under the terms of the Be Sample Code License. This file may be used under the terms of the Be Sample Code License.
Other authors for nm driver: Other authors for nm driver:
Rudolf Cornelissen 4/2003-6/2003 Rudolf Cornelissen 4/2003-1/2004
*/ */
#define MODULE_BIT 0x00400000 #define MODULE_BIT 0x00400000
@@ -1,5 +1,6 @@
/* Some commmon support functions */ /* Some commmon support functions */
/* Mark Watson 2/2000 */ /* Mark Watson 2/2000;
* Rudolf Cornelissen 1/2004 */
#define MODULE_BIT 0x00000800 #define MODULE_BIT 0x00000800
@@ -17,10 +18,13 @@ void delay(bigtime_t i)
void nm_log(char *fmt, ...) void nm_log(char *fmt, ...)
{ {
char buffer[1024]; char buffer[1024];
char fname[64];
FILE *myhand; FILE *myhand;
va_list args; va_list args;
myhand=fopen("/boot/home/" DRIVER_PREFIX ".accelerant.log","a+"); sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.%d.log", accelerantIsClone);
myhand=fopen(fname,"a+");
if (myhand == NULL) return; if (myhand == NULL) return;
va_start(args,fmt); va_start(args,fmt);
@@ -4,7 +4,7 @@
Other authors: Other authors:
Mark Watson, Mark Watson,
Rudolf Cornelissen 10/2002-12/2003. Rudolf Cornelissen 10/2002-1/2004.
*/ */
#define MODULE_BIT 0x00800000 #define MODULE_BIT 0x00800000
@@ -240,7 +240,18 @@ status_t CLONE_ACCELERANT(void *data) {
strcat(path, (const char *)data); strcat(path, (const char *)data);
/* open the device, the permissions aren't important */ /* open the device, the permissions aren't important */
fd = open(path, B_READ_WRITE); fd = open(path, B_READ_WRITE);
if (fd < 0) { if (fd < 0)
{
/* we can't use LOG because we didn't get the shared_info struct.. */
char fname[64];
FILE *myhand = NULL;
sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.0.log");
myhand=fopen(fname,"a+");
fprintf(myhand, "CLONE_ACCELERANT: couldn't open kerneldriver %s! Aborting.\n", path);
fclose(myhand);
/* abort with resultcode from open attempt on kerneldriver */
result = fd; result = fd;
goto error0; goto error0;
} }
@@ -1,5 +1,6 @@
/* Some commmon support functions */ /* Some commmon support functions */
/* Mark Watson 2/2000 */ /* Mark Watson 2/2000;
* Rudolf Cornelissen 1/2004 */
#define MODULE_BIT 0x00000800 #define MODULE_BIT 0x00000800
@@ -17,10 +18,13 @@ void delay(bigtime_t i)
void nv_log(char *fmt, ...) void nv_log(char *fmt, ...)
{ {
char buffer[1024]; char buffer[1024];
char fname[64];
FILE *myhand; FILE *myhand;
va_list args; va_list args;
myhand=fopen("/boot/home/" DRIVER_PREFIX ".accelerant.log","a+"); sprintf (fname, "/boot/home/" DRIVER_PREFIX ".accelerant.%d.log", accelerantIsClone);
myhand=fopen(fname,"a+");
if (myhand == NULL) return; if (myhand == NULL) return;
va_start(args,fmt); va_start(args,fmt);