Exemplo n.º 1
0
void
spcfd_start_loop()
{
	Spcfd *s;

	for(s = spcfds; s != NULL; s = s->next)
		spcfd_send_read_request(s);

	sp_poll_loop();
}
Exemplo 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;
}