Esempio n. 1
0
File: dvma.c Progetto: MarginC/kame
char *
dvma_alloc(int len)
{
	char *mem;

	mem = alloc(len);
	if (!mem)
		return (mem);
	return (dvma_mapin(mem, len));
}
Esempio n. 2
0
int 
tape_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf,
    size_t *rsize)
{
	struct saioreq *si;
	struct boottab *ops;
	char *dmabuf;
	int	si_flag, xcnt;

	si = devdata;
	ops = si->si_boottab;

#ifdef DEBUG
	if (debug > 1)
		printf("tape_strategy: size=%d dblk=%d\n", size, dblk);
#endif

	dmabuf = dvma_mapin(buf, size);
	
	si->si_bn = dblk;
	si->si_ma = dmabuf;
	si->si_cc = size;

	si_flag = (flag == F_READ) ? SAIO_F_READ : SAIO_F_WRITE;
	xcnt = (*ops->b_strategy)(si, si_flag);
	dvma_mapout(dmabuf, size);

#ifdef DEBUG
	if (debug > 1)
		printf("tape_strategy: xcnt = %x\n", xcnt);
#endif

	/* At end of tape, xcnt == 0 (not an error) */
	if (xcnt < 0)
		return (EIO);

	*rsize = xcnt;
	return (0);
}