Module Name:    src
Committed By:   haad
Date:           Sat Dec  5 10:38:27 UTC 2009

Modified Files:
        src/share/examples/rump/dmtest: Makefile dmt.c

Log Message:
Fix some small bugs pointed out byt po...@. Remove not needed -D defines and
do not include private kernel header files. Instead copy part of it to test
program.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/dmtest/Makefile \
    src/share/examples/rump/dmtest/dmt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/examples/rump/dmtest/Makefile
diff -u src/share/examples/rump/dmtest/Makefile:1.1 src/share/examples/rump/dmtest/Makefile:1.2
--- src/share/examples/rump/dmtest/Makefile:1.1	Fri Dec  4 22:18:30 2009
+++ src/share/examples/rump/dmtest/Makefile	Sat Dec  5 10:38:27 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2009/12/04 22:18:30 haad Exp $
+#	$NetBSD: Makefile,v 1.2 2009/12/05 10:38:27 haad Exp $
 PROG=   dmt
 SRCS=   dmt.c
 
@@ -8,7 +8,6 @@
 
 CFLAGS+= -g -fno-inline
 
-CPPFLAGS+=      -DRUMP_ACTION -DRUMP_SYS_IOCTL -DRUMP_SYS_CLOSE -I${NETBSDSRCDIR}/sys/dev/dm
 LDADD+=         -lrumpdev_disk -lrumpdev_dm -lrumpdev -lprop
 LDADD+=         -lrumpvfs -lrump -lrumpuser -lpthread
 DBG=            -g
Index: src/share/examples/rump/dmtest/dmt.c
diff -u src/share/examples/rump/dmtest/dmt.c:1.1 src/share/examples/rump/dmtest/dmt.c:1.2
--- src/share/examples/rump/dmtest/dmt.c:1.1	Fri Dec  4 22:18:30 2009
+++ src/share/examples/rump/dmtest/dmt.c	Sat Dec  5 10:38:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmt.c,v 1.1 2009/12/04 22:18:30 haad Exp $
+/*	$NetBSD: dmt.c,v 1.2 2009/12/05 10:38:27 haad Exp $
 
 /*
  * Copyright (c) 2009 Adam Hamsik.  All Rights Reserved.
@@ -43,14 +43,20 @@
 #include <unistd.h>
 #include <util.h>
 
-#include <netbsd-dm.h>
-
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
-#include <rump/rumpuser.h>
+
+/* NetBSD-dm.h part */
+#include <prop/proplib.h>
+
+#define DM_CMD_LEN 16
+#define DM_IOCTL 0xfd
+#define DM_IOCTL_CMD 0
+#define NETBSD_DM_IOCTL       _IOWR(DM_IOCTL, DM_IOCTL_CMD, struct plistref)
+
 
 int
-main(int argc,char *argv[])
+main(int argc, char *argv[])
 {
 	int fd;
 	int err;
@@ -60,7 +66,6 @@
 	char *xml;
 	
 	err = rump_init();
-
 	if (err != 0)
 		printf("rump_init failed with %s\n", strerror(err));
 	
@@ -74,7 +79,7 @@
 	prop_dictionary_externalize_to_pref(dict_in, &prefp);
 	
 	err = rump_sys_ioctl(fd, NETBSD_DM_IOCTL, &prefp);
-	if ( err != 0)
+	if ( err < 0)
 		printf("ioctl failed %d\n", err);
 
 	dict_out = prop_dictionary_internalize(prefp.pref_plist);
@@ -82,5 +87,5 @@
 	xml = prop_dictionary_externalize(dict_out);
 	printf("%s\n",xml);
 	
-	close(fd);
+	rump_sys_close(fd);
 }

Reply via email to