Пример #1
0
//------------------------------------------------------------------------
//  rfcntl  --  control the remote file server access system
//------------------------------------------------------------------------
int
rfcntl(struct devsw *devptr, int func, char *addr, char *addr2)
{
	long junk;
	int len;

	junk = 0L;
	switch (func) {
	case RFCLEAR:
		// clear port associated with rfserver
		control(Rf.device, DG_CLEAR, 0);
		return OK;

	// Universal file manipulation functions
	case FLACCESS:
		return rfmkpac(FS_ACCESS, addr, &junk, (char *)&junk, 0);
	case FLREMOVE:
		return rfmkpac(FS_UNLINK, addr, &junk, NULLSTR, 0);
	case FLRENAME:
		len = strlen(addr2) + 1;
		return rfmkpac(FS_RENAME, addr, &junk, addr2, len);
	default:
		break;
	}

	return SYSERR;
}
Пример #2
0
/*------------------------------------------------------------------------
 *  rfclose  --  close a remote file by deallocating pseudo device
 *------------------------------------------------------------------------
 */
int
rfclose(struct devsw *pdev)
{
	struct	rfblk	*rfptr;
	char	junk;		/* argument to rfmkpac; not really used	*/

	rfptr = (struct rfblk *)pdev->dvioblk;
	if (rfptr->rf_state == RFREE)
		return SYSERR;
	wait(rfptr->rf_mutex);
	junk = 0L; /* 0L is long zero constant */
	rfmkpac(FS_CLOSE, rfptr->rf_name, &junk, (u_char *)&junk, 0);
	rfptr->rf_state = RFREE;
	signal(rfptr->rf_mutex);
	return OK;
}
Пример #3
0
/*------------------------------------------------------------------------
 *  rfio  --  perform input or output using remote file server
 *------------------------------------------------------------------------
 */
rfio(struct devsw *pdev, int rop, u_char *buff, unsigned len)
{
	struct	rfblk	*rfptr;
	int	retcode;

	rfptr = (struct rfblk *)pdev->dvioblk;
	wait(rfptr->rf_mutex);
	if (rfptr->rf_state == RFREE) {
		signal(rfptr->rf_mutex);
		return SYSERR;
	}
	retcode = rfmkpac(rop, rfptr->rf_name, (char *)&rfptr->rf_pos,
			buff, len);
	signal(rfptr->rf_mutex);
	return retcode;
}
Пример #4
0
//------------------------------------------------------------------------
//  rfio  --  perform input or output using remote file server
//------------------------------------------------------------------------
int
rfio(struct devsw *devptr, int rop, char *buff, int len)
{
    struct rfblk *rfptr;
    int retcode;

    rfptr = (struct rfblk *)devptr->iobuf;
    wait(rfptr->rf_mutex);
    if (len < 0 || rfptr->rf_state == RFREE) {
        signal(rfptr->rf_mutex);
        return SYSERR;
    }
    retcode = rfmkpac(rop, rfptr->rf_name, &rfptr->rf_pos, buff, len);
    signal(rfptr->rf_mutex);

    return retcode;
}