osPfsInit.3p 2.52 KB
.TH osPfsInit 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osPfsInit \- Initialized the file system for the new plugged-in CONTROLLER PAK
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
s32 osPfsInit(OSMesgQueue \(**mq, OSPfs \(**pfs, int controller_no);
.Op
\f1
.fi
.SH DESCRIPTION
A PFS file system is reside on a CONTROLLER PAK. 
The CONTROLLER PAK is divided into a certain number of 32-bytes blocks. The 
current maximum size limit of a PFS file system is 64K bytes. 
.sp
An 
.I OSPfs
data structure acts as a handle by which an individual file system is referenced
by the file system routines. The 
.I osPfsInit
function initializes this structure. The
.I controller_no
specifies the controller where the CONTROLLER PAK is plugged-in.
The message queue
.I mq
must be an initialized message queue associated with the
.I OS_EVENT_SI
event.
See
.IR osSetEventMesg (3P)
for details on how to create this association.
Since the
.I osPfsInit
routine will wait on the message queue
.I mq,
this queue must not be shared.
In addition, it is required that
.IR osContInit (3P)
must be called to initialize the low level synchronization before osPfsInit can be called.
.sp
A value of 0 is returned if the calls succeed, otherwise
one of the following error code is returned.
.PP
.nf
.ta 5 24 
	PFS_ERR_NOPACK	No CONTROLLER PAK is plugged in the specified 
			controller.
.sp
	PFS_ERR_ID_FATAL	The CONTROLLER PAK which is plugged in the 
			specified controller is dead. 
.sp
	PFS_ERR_DEVICE	The device which is plugged in the specified 
			controller is not a CONTROLLER PAK.
.sp
	PFS_ERR_CONTRFAIL	The controller sends data at higher data
			transfer rate than the hardware handling 
			capability or the hardware CRC error occurs.
.fi
.SH EXAMPLE
.nf
.ta 5 18
main()
{
	OSMesgQueue	intMesgQueue;
	OSMesg	intMesgBuf[1];
	OSContStatus	sdata[MAXCONTROLLERS];
	u8	cont_pattern, pak_pattern;
	OSPfs	pfs[MAXCONTROLLERS];
.sp
	osCreateMesgQueue(&intMesgQueue, intMesgBuf, 1);
	osSetEventMesg(OS_EVENT_SI, &intMesgQueue, dummyMessage);
	osContInit(&intMesgQueue, &cont_pattern, &sdata[0]);
	osPfsIsPlug(&intMesgQueue, &pak_pattern);
	for (i = 0; i < MAXCONTROLLERS; i++) {
	    if (pak_pattern & (1<<i)){
	        ret = osPfsInit(&pifMesgQueue, &pfs[i], i);
	    }
	    if ((ret == PFS_ERR_ID_FATAL) ||(ret == PFS_ERR_DEVICE))
	        pak_pattern &= ~(1<<i);
	}
}
.fi
.SH "SEE ALSO"
osContInit (3P),
osPfsAllocateFile (3P),
osPfsChecker (3P),
osPfsFileState (3P),
osPfsFreeBlocks (3P),
osPfsIsPlug (3P),
osPfsReSizeFile (3P),
osPfsReadWriteFile (3P),
osPfsSetLabel (3P)