Writing Device Drivers

read(9E) and write(9E)

SunOS 4.1 system:

	int xxread(dev, uio)
 	int xxwrite(dev, uio)
 	dev_t		dev;
 	struct uio *uio;

SunOS 5.7 system:

	int xxread(dev_t dev, uio_t *uiop, cred_t *credp);
 	int xxwrite(dev_t dev, uio_t *uiop, cred_t *credp);

physio(9F) should no longer be called with the address of a statically allocated buf(9S) structure. Instead, pass a NULL pointer as the second argument, which causes physio(9F) to allocate a buf structure. The address of the allocated buf structure should always be saved in strategy(9E), as it is needed to call biodone(9F). An alternative is to use getrbuf(9F) to allocate the buf(9S) structure, and freerbuf(9F) to free it.