proc tty: switch ip2 to ->proc_fops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
444697d61b
commit
cdda7cd92b
1 changed files with 35 additions and 41 deletions
|
@ -139,7 +139,7 @@
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
static const struct file_operations ip2mem_proc_fops;
|
static const struct file_operations ip2mem_proc_fops;
|
||||||
static int ip2_read_proc(char *, char **, off_t, int, int *, void * );
|
static const struct file_operations ip2_proc_fops;
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
|
@ -446,9 +446,9 @@ static const struct tty_operations ip2_ops = {
|
||||||
.stop = ip2_stop,
|
.stop = ip2_stop,
|
||||||
.start = ip2_start,
|
.start = ip2_start,
|
||||||
.hangup = ip2_hangup,
|
.hangup = ip2_hangup,
|
||||||
.read_proc = ip2_read_proc,
|
|
||||||
.tiocmget = ip2_tiocmget,
|
.tiocmget = ip2_tiocmget,
|
||||||
.tiocmset = ip2_tiocmset,
|
.tiocmset = ip2_tiocmset,
|
||||||
|
.proc_fops = &ip2_proc_fops,
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -3029,19 +3029,17 @@ static const struct file_operations ip2mem_proc_fops = {
|
||||||
* different sources including ip2mkdev.c and a couple of other drivers.
|
* different sources including ip2mkdev.c and a couple of other drivers.
|
||||||
* The bugs are all mine. :-) =mhw=
|
* The bugs are all mine. :-) =mhw=
|
||||||
*/
|
*/
|
||||||
static int ip2_read_proc(char *page, char **start, off_t off,
|
static int ip2_proc_show(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int i, j, box;
|
int i, j, box;
|
||||||
int len = 0;
|
|
||||||
int boxes = 0;
|
int boxes = 0;
|
||||||
int ports = 0;
|
int ports = 0;
|
||||||
int tports = 0;
|
int tports = 0;
|
||||||
off_t begin = 0;
|
|
||||||
i2eBordStrPtr pB;
|
i2eBordStrPtr pB;
|
||||||
|
char *sep;
|
||||||
|
|
||||||
len += sprintf(page, "ip2info: 1.0 driver: %s\n", pcVersion );
|
seq_printf(m, "ip2info: 1.0 driver: %s\n", pcVersion);
|
||||||
len += sprintf(page+len, "Driver: SMajor=%d CMajor=%d IMajor=%d MaxBoards=%d MaxBoxes=%d MaxPorts=%d\n",
|
seq_printf(m, "Driver: SMajor=%d CMajor=%d IMajor=%d MaxBoards=%d MaxBoxes=%d MaxPorts=%d\n",
|
||||||
IP2_TTY_MAJOR, IP2_CALLOUT_MAJOR, IP2_IPL_MAJOR,
|
IP2_TTY_MAJOR, IP2_CALLOUT_MAJOR, IP2_IPL_MAJOR,
|
||||||
IP2_MAX_BOARDS, ABS_MAX_BOXES, ABS_BIGGEST_BOX);
|
IP2_MAX_BOARDS, ABS_MAX_BOXES, ABS_BIGGEST_BOX);
|
||||||
|
|
||||||
|
@ -3053,7 +3051,8 @@ static int ip2_read_proc(char *page, char **start, off_t off,
|
||||||
switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
|
switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
|
||||||
{
|
{
|
||||||
case POR_ID_FIIEX:
|
case POR_ID_FIIEX:
|
||||||
len += sprintf( page+len, "Board %d: EX ports=", i );
|
seq_printf(m, "Board %d: EX ports=", i);
|
||||||
|
sep = "";
|
||||||
for( box = 0; box < ABS_MAX_BOXES; ++box )
|
for( box = 0; box < ABS_MAX_BOXES; ++box )
|
||||||
{
|
{
|
||||||
ports = 0;
|
ports = 0;
|
||||||
|
@ -3065,79 +3064,74 @@ static int ip2_read_proc(char *page, char **start, off_t off,
|
||||||
++ports;
|
++ports;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len += sprintf( page+len, "%d,", ports );
|
seq_printf(m, "%s%d", sep, ports);
|
||||||
|
sep = ",";
|
||||||
tports += ports;
|
tports += ports;
|
||||||
}
|
}
|
||||||
|
seq_printf(m, " boxes=%d width=%d", boxes, pB->i2eDataWidth16 ? 16 : 8);
|
||||||
--len; /* Backup over that last comma */
|
|
||||||
|
|
||||||
len += sprintf( page+len, " boxes=%d width=%d", boxes, pB->i2eDataWidth16 ? 16 : 8 );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POR_ID_II_4:
|
case POR_ID_II_4:
|
||||||
len += sprintf(page+len, "Board %d: ISA-4 ports=4 boxes=1", i );
|
seq_printf(m, "Board %d: ISA-4 ports=4 boxes=1", i);
|
||||||
tports = ports = 4;
|
tports = ports = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POR_ID_II_8:
|
case POR_ID_II_8:
|
||||||
len += sprintf(page+len, "Board %d: ISA-8-std ports=8 boxes=1", i );
|
seq_printf(m, "Board %d: ISA-8-std ports=8 boxes=1", i);
|
||||||
tports = ports = 8;
|
tports = ports = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POR_ID_II_8R:
|
case POR_ID_II_8R:
|
||||||
len += sprintf(page+len, "Board %d: ISA-8-RJ11 ports=8 boxes=1", i );
|
seq_printf(m, "Board %d: ISA-8-RJ11 ports=8 boxes=1", i);
|
||||||
tports = ports = 8;
|
tports = ports = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
len += sprintf(page+len, "Board %d: unknown", i );
|
seq_printf(m, "Board %d: unknown", i);
|
||||||
/* Don't try and probe for minor numbers */
|
/* Don't try and probe for minor numbers */
|
||||||
tports = ports = 0;
|
tports = ports = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Don't try and probe for minor numbers */
|
/* Don't try and probe for minor numbers */
|
||||||
len += sprintf(page+len, "Board %d: vacant", i );
|
seq_printf(m, "Board %d: vacant", i);
|
||||||
tports = ports = 0;
|
tports = ports = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tports ) {
|
if( tports ) {
|
||||||
len += sprintf(page+len, " minors=" );
|
seq_puts(m, " minors=");
|
||||||
|
sep = "";
|
||||||
for ( box = 0; box < ABS_MAX_BOXES; ++box )
|
for ( box = 0; box < ABS_MAX_BOXES; ++box )
|
||||||
{
|
{
|
||||||
for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
|
for ( j = 0; j < ABS_BIGGEST_BOX; ++j )
|
||||||
{
|
{
|
||||||
if ( pB->i2eChannelMap[box] & (1 << j) )
|
if ( pB->i2eChannelMap[box] & (1 << j) )
|
||||||
{
|
{
|
||||||
len += sprintf (page+len,"%d,",
|
seq_printf(m, "%s%d", sep,
|
||||||
j + ABS_BIGGEST_BOX *
|
j + ABS_BIGGEST_BOX *
|
||||||
(box+i*ABS_MAX_BOXES));
|
(box+i*ABS_MAX_BOXES));
|
||||||
|
sep = ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
page[ len - 1 ] = '\n'; /* Overwrite that last comma */
|
|
||||||
} else {
|
|
||||||
len += sprintf (page+len,"\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len+begin > off+count)
|
|
||||||
break;
|
|
||||||
if (len+begin < off) {
|
|
||||||
begin += len;
|
|
||||||
len = 0;
|
|
||||||
}
|
}
|
||||||
|
seq_putc(m, '\n');
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
if (i >= IP2_MAX_BOARDS)
|
|
||||||
*eof = 1;
|
|
||||||
if (off >= len+begin)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
*start = page + (off-begin);
|
|
||||||
return ((count < begin+len-off) ? count : begin+len-off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ip2_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, ip2_proc_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations ip2_proc_fops = {
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.open = ip2_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = single_release,
|
||||||
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Function: ip2trace() */
|
/* Function: ip2trace() */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue