Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/examples/rump/dmtest Fix some small bugs pointed out b...
details: https://anonhg.NetBSD.org/src/rev/3a3b3c870afa
branches: trunk
changeset: 749654:3a3b3c870afa
user: haad <haad%NetBSD.org@localhost>
date: Sat Dec 05 10:38:27 2009 +0000
description:
Fix some small bugs pointed out byt pooka@. Remove not needed -D defines and
do not include private kernel header files. Instead copy part of it to test
program.
diffstat:
share/examples/rump/dmtest/Makefile | 3 +--
share/examples/rump/dmtest/dmt.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 10 deletions(-)
diffs (75 lines):
diff -r 6b9304a28e28 -r 3a3b3c870afa share/examples/rump/dmtest/Makefile
--- a/share/examples/rump/dmtest/Makefile Sat Dec 05 10:17:17 2009 +0000
+++ b/share/examples/rump/dmtest/Makefile Sat Dec 05 10:38:27 2009 +0000
@@ -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
diff -r 6b9304a28e28 -r 3a3b3c870afa share/examples/rump/dmtest/dmt.c
--- a/share/examples/rump/dmtest/dmt.c Sat Dec 05 10:17:17 2009 +0000
+++ b/share/examples/rump/dmtest/dmt.c Sat Dec 05 10:38:27 2009 +0000
@@ -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);
}
Home |
Main Index |
Thread Index |
Old Index