-
-extern struct proc_dir_entry *proc_net_eicon;
-static struct proc_dir_entry *maint_proc_entry = NULL;
-
-/*
- Read function is provided for compatibility reason - this allows
- to read unstructured traces, formated as ascii string only
- */
-static ssize_t
-maint_read(struct file *file, char __user *buf, size_t count, loff_t * off)
-{
- diva_dbg_entry_head_t *pmsg = NULL;
- diva_os_spin_lock_magic_t old_irql;
- word size;
- char *pstr, *dli_label = "UNK";
- int str_length;
- int *str_msg;
-
- if (!file->private_data) {
- for (;;) {
- while (
- (pmsg =
- diva_maint_get_message(&size,
- &old_irql))) {
- if (!(pmsg->facility == MSG_TYPE_STRING)) {
- diva_maint_ack_message(1,
- &old_irql);
- } else {
- break;
- }
- }
-
- if (!pmsg) {
- if (file->f_flags & O_NONBLOCK) {
- return (-EAGAIN);
- }
- interruptible_sleep_on(&msgwaitq);
- if (signal_pending(current)) {
- return (-ERESTARTSYS);
- }
- } else {
- break;
- }
- }
- /*
- The length of message that shoule be read is:
- pmsg->data_length + label(25) + DrvID(2) + byte CR + trailing zero
- */
- if (!
- (str_msg =
- (int *) diva_os_malloc_tbuffer(0,
- pmsg->data_length +
- 29 + 2 * sizeof(int)))) {
- diva_maint_ack_message(0, &old_irql);
- return (-ENOMEM);
- }
- pstr = (char *) &str_msg[2];
-
- switch (pmsg->dli) {
- case DLI_LOG:
- dli_label = "LOG";
- break;
- case DLI_FTL:
- dli_label = "FTL";
- break;
- case DLI_ERR:
- dli_label = "ERR";
- break;
- case DLI_TRC:
- dli_label = "TRC";
- break;
- case DLI_REG:
- dli_label = "REG";
- break;
- case DLI_MEM:
- dli_label = "MEM";
- break;
- case DLI_SPL:
- dli_label = "SPL";
- break;
- case DLI_IRP:
- dli_label = "IRP";
- break;
- case DLI_TIM:
- dli_label = "TIM";
- break;
- case DLI_TAPI:
- dli_label = "TAPI";
- break;
- case DLI_NDIS:
- dli_label = "NDIS";
- break;
- case DLI_CONN:
- dli_label = "CONN";
- break;
- case DLI_STAT:
- dli_label = "STAT";
- break;
- case DLI_PRV0:
- dli_label = "PRV0";
- break;
- case DLI_PRV1:
- dli_label = "PRV1";
- break;
- case DLI_PRV2:
- dli_label = "PRV2";
- break;
- case DLI_PRV3:
- dli_label = "PRV3";
- break;
- }
- str_length = sprintf(pstr, "%s %02x %s\n",
- dli_label, (byte) pmsg->drv_id,
- (char *) &pmsg[1]);
- str_msg[0] = str_length;
- str_msg[1] = 0;
- file->private_data = str_msg;
- diva_maint_ack_message(1, &old_irql);
- } else {
- str_msg = (int *) file->private_data;
- pstr = (char *) &str_msg[2];
- pstr += str_msg[1]; /* head + offset */
- str_length = str_msg[0] - str_msg[1]; /* length - offset */
- }
- str_length = MIN(str_length, count);
-
- if (diva_os_copy_to_user(NULL, buf, pstr, str_length)) {
- diva_os_free_tbuffer(0, str_msg);
- file->private_data = NULL;
- return (-EFAULT);
- }
- str_msg[1] += str_length;
- if ((str_msg[0] - str_msg[1]) <= 0) {
- diva_os_free_tbuffer(0, str_msg);
- file->private_data = NULL;
- }
-
- return (str_length);
-}
-
-static ssize_t
-maint_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
-{
- return (-ENODEV);
-}
-