Esempio n. 1
0
Spsrv *
ufs_create_srv(int *port)
{
    extern int spc_chatty;
    Spsrv *srv;

    srv = sp_socksrv_create_tcp(port);
    if (!srv)
        return NULL;

    srv->dotu = 1;
    srv->msize = 32792;
    srv->connopen = ufs_connopen;
    srv->connclose = ufs_connclose;
    srv->attach = ufs_attach;
    srv->clone = ufs_clone;
    srv->walk = ufs_walk;
    srv->open = ufs_open;
    srv->create = ufs_create;
    srv->read = ufs_read;
    srv->write = ufs_write;
    srv->clunk = ufs_clunk;
    srv->remove = ufs_remove;
    srv->stat = ufs_stat;
    srv->wstat = ufs_wstat;
    srv->fiddestroy = ufs_fiddestroy;
    srv->debuglevel = spc_chatty;

    sp_srv_start(srv);

    return srv;
}
Esempio n. 2
0
int
main(int argc, char **argv)
{
	int c;
	int port, nwthreads;
	char *s;

	port = 564;
	nwthreads = 16;
	while ((c = getopt(argc, argv, "dsmp:w:")) != -1) {
		switch (c) {
		case 'd':
			debuglevel = 1;
			break;

		case 'p':
			port = strtol(optarg, &s, 10);
			if (*s != '\0')
				usage();
			break;

		case 'w':
			nwthreads = strtol(optarg, &s, 10);
			if (*s != '\0')
				usage();
			break;

		case 's':
			sameuser = 1;
			break;

		case 'm':
			mmapreads = 1;
			break;

		default:
			usage();
		}
	}

	srv = sp_socksrv_create_tcp(&port);

	if (!srv)
		return -1;

	srv->dotu = 1;
	srv->attach = npfs_attach;
	srv->clone = npfs_clone;
	srv->walk = npfs_walk;
	srv->open = npfs_open;
	srv->create = npfs_create;
	srv->read = npfs_read;
	srv->write = npfs_write;
	srv->clunk = npfs_clunk;
	srv->remove = npfs_remove;
	srv->stat = npfs_stat;
	srv->wstat = npfs_wstat;
	srv->fiddestroy = npfs_fiddestroy;
	srv->debuglevel = debuglevel;

	sp_srv_start(srv);
	sp_poll_loop();
	return 0;
}