kernels/linux-2.4.0/drivers/acorn/scsi/powertec.c
/* Prototype: int powertecscsi_proc_info(char *buffer, char **start, off_t offset,
 *					int length, int host_no, int inout)
 * Purpose  : Return information about the driver to a user process accessing
 *	      the /proc filesystem.
 * Params   : buffer  - a buffer to write information to
 *	      start   - a pointer into this buffer set by this routine to the start
 *		        of the required information.
 *	      offset  - offset into information that we have read upto.
 *	      length  - length of buffer
 *	      host_no - host number to return information for
 *	      inout   - 0 for reading, 1 for writing.
 * Returns  : length of data written to buffer.
 */
int powertecscsi_proc_info(char *buffer, char **start, off_t offset,
int length, int host_no, int inout)
Purpose  : Return information about the driver to a user process accessing
the /proc filesystem.
Params   : buffer  - a buffer to write information to
start   - a pointer into this buffer set by this routine to the start
of the required information.
offset  - offset into information that we have read upto.
length  - length of buffer
host_no - host number to return information for
inout   - 0 for reading, 1 for writing.
Returns  : length of data written to buffer.
int powertecscsi_proc_info ( char * buffer char ** start off_t offset int length int host_no int inout ) Purpose : Return information about the driver to a user process accessing the / proc filesystem . Params : buffer - a buffer to write information to start - a pointer into this buffer set by this routine to the start of the required information . offset - offset into information that we have read upto . length - length of buffer host_no - host number to return information for inout - 0 for reading 1 for writing . Returns : length of data written to buffer .
int powertecscsi_proc_info(char *buffer, char **start, off_t offset,
			    int length, int host_no, int inout)
{
	int pos, begin;
	struct Scsi_Host *host = scsi_hostlist;
	PowerTecScsi_Info *info;
	Scsi_Device *scd;
	while (host) {
		if (host->host_no == host_no)
			break;
		host = host->next;
	}
	if (!host)
		return 0;
	if (inout == 1)
		return powertecscsi_set_proc_info(host, buffer, length);
	info = (PowerTecScsi_Info *)host->hostdata;
	begin = 0;
	pos = sprintf(buffer,
			"PowerTec SCSI driver version %d.%d.%d\n",
			VER_MAJOR, VER_MINOR, VER_PATCH);
	pos += fas216_print_host(&info->info, buffer + pos);
	pos += sprintf(buffer + pos, "Term    : o%s\n",
			info->control.terms ? "n" : "ff");
	pos += fas216_print_stats(&info->info, buffer + pos);
	pos += sprintf(buffer+pos, "\nAttached devices:\n");
	for (scd = host->host_queue; scd; scd = scd->next) {
		pos += fas216_print_device(&info->info, scd, buffer + pos);
		if (pos + begin < offset) {
			begin += pos;
			pos = 0;
		}
		if (pos + begin > offset + length)
			break;
	}
	*start = buffer + (offset - begin);
	pos -= offset - begin;
	if (pos > length)
		pos = length;
	return pos;
}
int powertecscsi_proc_info ( char * buffer , char * * start , off_t offset , int length , int host_no , int inout ) { int pos , begin ; struct Scsi_Host * host = scsi_hostlist ; PowerTecScsi_Info * info ; Scsi_Device * scd ; while ( host ) { if ( host -> host_no == host_no ) break ; host = host -> next ; } if ( ! host ) return 0 ; if ( inout == 1 ) return powertecscsi_set_proc_info ( host , buffer , length ) ; info = ( PowerTecScsi_Info * ) host -> hostdata ; begin = 0 ; pos = sprintf ( buffer , " \n " , VER_MAJOR , VER_MINOR , VER_PATCH ) ; pos += fas216_print_host ( & info -> info , buffer + pos ) ; pos += sprintf ( buffer + pos , " \n " , info -> control . terms ? " " : " " ) ; pos += fas216_print_stats ( & info -> info , buffer + pos ) ; pos += sprintf ( buffer + pos , " \n \n " ) ; for ( scd = host -> host_queue ; scd ; scd = scd -> next ) { pos += fas216_print_device ( & info -> info , scd , buffer + pos ) ; if ( pos + begin < offset ) { begin += pos ; pos = 0 ; } if ( pos + begin > offset + length ) break ; } * start = buffer + ( offset - begin ) ; pos -= offset - begin ; if ( pos > length ) pos = length ; return pos ; }
Prototype: int powertecscsi_proc_info(char *buffer, char **start, off_t offset,
                                      int length, int host_no, int inout)
 Purpose  : Return information about the driver to a user process accessing
            the /proc filesystem.
Prototype : int powertecscsi_proc_info ( char * buffer char ** start off_t offset int length int host_no int inout ) Purpose : Return information about the driver to a user process accessing the / proc filesystem .