Ejemplo n.º 1
0
int
main(int argc, char *argv[])
{
	int fd;
	int err;

	prop_dictionary_t dict_in, dict_out;
	struct plistref prefp;
	char *xml;
	
	err = rump_init();
	if (err != 0)
		printf("rump_init failed with %s\n", strerror(err));
	
	fd = rump_sys_open("/dev/mapper/control", O_RDWR, 0);
	if (fd == -1)
		printf("Cannot open control device.\n");

	dict_in  = prop_dictionary_internalize_from_file("prop2.plist");
	dict_out = prop_dictionary_create();
	
	prop_dictionary_externalize_to_pref(dict_in, &prefp);
	
	err = rump_sys_ioctl(fd, NETBSD_DM_IOCTL, &prefp);
	if ( err < 0)
		printf("ioctl failed %d\n", err);

	dict_out = prop_dictionary_internalize(prefp.pref_plist);
	
	xml = prop_dictionary_externalize(dict_out);
	printf("%s\n",xml);
	
	rump_sys_close(fd);
}
Ejemplo n.º 2
0
int
npf_sessions_send(int fd, const char *fpath)
{
	prop_dictionary_t sdict;
	int error;

	if (fpath) {
		sdict = prop_dictionary_internalize_from_file(fpath);
		if (sdict == NULL) {
			return errno;
		}
	} else {
		/* Empty: will flush the sessions. */
		prop_array_t selist = prop_array_create();
		sdict = prop_dictionary_create();
		prop_dictionary_set(sdict, "session-list", selist);
		prop_object_release(selist);
	}
	error = prop_dictionary_send_ioctl(sdict, fd, IOC_NPF_SESSIONS_LOAD);
	prop_object_release(sdict);
	return error;
}
Ejemplo n.º 3
0
bool
wsdv_keymap_load(char *file)
{
	pd = prop_dictionary_internalize_from_file(file);
	return pd;
}