Esempio n. 1
0
int16_t _write(void)
{
	inoptr ino;
	uint8_t flag;

	if (!valaddr(buf, nbytes))
	        return -1;
	/* Set up u_base, u_offset, ino; check permissions, file num. */
	if ((ino = rwsetup(false, &flag)) == NULLINODE)
		return (-1);	/* bomb out if error */

	writei(ino, flag);
	updoff();

	return (udata.u_count);
}
Esempio n. 2
0
arg_t _read(void)
{
	inoptr ino;
	uint8_t flag;

	if (!nbytes)
	        return 0;

	if (!valaddr(buf, nbytes))
	        return -1;
	/* Set up u_base, u_offset, ino; check permissions, file num. */
	if ((ino = rwsetup(true, &flag)) == NULLINODE)
		return -1;	/* bomb out if error */

	readi(ino, flag);
	updoff();

	return (udata.u_count);
}