kernels/linux-2.4.0/net/wanrouter/wanproc.c
/*
 *	Prepare data for reading 'Status' entry.
 *	Return length of data.
 */
Prepare data for reading 'Status' entry.
Return length of data.
Prepare data for reading ' Status ' entry . Return length of data .
static int status_get_info(char* buf, char** start, off_t offs, int len)
{
	int cnt = 0;
	wan_device_t* wandev;
	cnt += sprintf(&buf[cnt], "\nSTATUS FOR PORT 0\n\n");
	strcpy(&buf[cnt], stat_hdr);
	cnt += sizeof(stat_hdr) - 1;
	for (wandev = router_devlist;
	     wandev && (cnt < (PROC_BUFSZ - 80));
	     wandev = wandev->next) {
		if (!wandev->state) continue;
		cnt += sprintf(&buf[cnt],
			"%-15s|%-7s|%-9s|%-8s|%9u|%5u|%3u |",
			wandev->name,
			wandev->station ? " DCE" : " DTE",
			wandev->interface ? " V.35" : " RS-232",
			wandev->clocking ? "internal" : "external",
			wandev->bps,
			wandev->mtu,
			wandev->ndev);
		switch (wandev->state) {
		case WAN_UNCONFIGURED:
			cnt += sprintf(&buf[cnt], "%-12s\n", "unconfigured");
			break;
		case WAN_DISCONNECTED:
			cnt += sprintf(&buf[cnt], "%-12s\n", "disconnected");
			break;
		case WAN_CONNECTING:
			cnt += sprintf(&buf[cnt], "%-12s\n", "connecting");
			break;
		case WAN_CONNECTED:
			cnt += sprintf(&buf[cnt], "%-12s\n", "connected");
			break;
		default:
			cnt += sprintf(&buf[cnt], "%-12s\n", "invalid");
			break;
		}
	}
	return cnt;
}
static int status_get_info ( char * buf , char * * start , off_t offs , int len ) { int cnt = 0 ; wan_device_t * wandev ; cnt += sprintf ( & buf [ cnt ] , " \n \n \n " ) ; strcpy ( & buf [ cnt ] , stat_hdr ) ; cnt += sizeof ( stat_hdr ) - 1 ; for ( wandev = router_devlist ; wandev && ( cnt < ( PROC_BUFSZ - 80 ) ) ; wandev = wandev -> next ) { if ( ! wandev -> state ) continue ; cnt += sprintf ( & buf [ cnt ] , " " , wandev -> name , wandev -> station ? " " : " " , wandev -> interface ? " " : " " , wandev -> clocking ? " " : " " , wandev -> bps , wandev -> mtu , wandev -> ndev ) ; switch ( wandev -> state ) { case WAN_UNCONFIGURED : cnt += sprintf ( & buf [ cnt ] , " \n " , " " ) ; break ; case WAN_DISCONNECTED : cnt += sprintf ( & buf [ cnt ] , " \n " , " " ) ; break ; case WAN_CONNECTING : cnt += sprintf ( & buf [ cnt ] , " \n " , " " ) ; break ; case WAN_CONNECTED : cnt += sprintf ( & buf [ cnt ] , " \n " , " " ) ; break ; default : cnt += sprintf ( & buf [ cnt ] , " \n " , " " ) ; break ; } } return cnt ; }
Prepare data for reading 'Status' entry.
Prepare data for reading ' Status ' entry .