Permalink
Browse files

Review comments

  • Loading branch information...
1 parent 3080464 commit 550d53cad9f7ba037400268374857d8a69192b1d @xl0 xl0 committed Oct 19, 2011
Showing with 114 additions and 283 deletions.
  1. +3 −5 virtio/Makefile
  2. +0 −70 virtio/util.c
  3. +8 −7 virtio/util.h
  4. +47 −47 virtio/virtio.c
  5. +4 −4 virtio/virtiovar.h
  6. +52 −150 virtio_blk/vioblk.c
View
@@ -18,10 +18,8 @@ all: virtio
virtio: virtio.c virtiovar.h virtioreg.h
$(CC) $(CFLAGS) -c virtio.c -o virtio.o
$(CTFCONVERT) -i -L VERSION virtio.o
- $(CC) $(CFLAGS) -c util.c -o util.o
- $(CTFCONVERT) -i -L VERSION util.o
- $(LD) $(LDFLAGS) virtio.o util.o -o virtio
- $(CTFMERGE) -L VERSION -o virtio virtio.o util.o
+ $(LD) $(LDFLAGS) virtio.o -o virtio
+ $(CTFMERGE) -L VERSION -o virtio virtio.o
clean:
- rm -f virtio virtio.o util.o
+ rm -f virtio virtio.o
View
@@ -1,70 +0,0 @@
-
-#include <sys/ddi.h>
-#include <sys/types.h>
-#include <sys/cmn_err.h>
-#include <sys/sunddi.h>
-#include <sys/sunndi.h>
-#include "util.h"
-
-/*
- * Add to ddi?
- */
-void
-dev_err(dev_info_t *dip, int ce, char *fmt, ...)
-{
- va_list ap;
- char buf[512];
-
- ASSERT(dip != NULL);
-
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
-
- cmn_err(ce, "%s%d: %s", ddi_driver_name(dip),
- ddi_get_instance(dip), buf);
-}
-
-void
-dev_panic(dev_info_t *dip, char *fmt, ...)
-{
- va_list ap;
- char buf[256];
-
- ASSERT(dip != NULL);
-
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
-
- panic("%s%d: %s", ddi_driver_name(dip),
- ddi_get_instance(dip), buf);
-}
-
-void
-hex_dump(char *prefix, void *addr, int len)
-{
- unsigned char *base = addr;
- char buff[256], *bptr;
- int i = 0;
- bptr = buff;
-
- cmn_err(CE_NOTE, "Dumping %d bytes starting from 0x%p",
- len, addr);
-
- while (i < len) {
- (void) sprintf(bptr, "%02x ", base[i]);
- bptr += 3;
- i++;
-
- if (!(i % 16)) {
- cmn_err(CE_NOTE, "%s: 0x%p: %s",
- prefix, (void *) (base + i - 16), buff);
- bptr = buff;
- }
- }
-
- if (i % 16)
- cmn_err(CE_NOTE, "%s: 0x%p: %s",
- prefix, (void *) (base + i - (i % 16)), buff);
-}
View
@@ -2,17 +2,18 @@
#include <sys/dditypes.h>
#include <sys/sysmacros.h>
+#define dev_err(dip, ce, fmt, arg...) \
+ cmn_err(ce, "%s%d: " fmt, ddi_driver_name(dip), \
+ ddi_get_instance(dip), ##arg)
+
#ifdef DEBUG
-#define dev_debug(dip, fmt, arg...) \
- dev_err(dip, fmt, ##arg)
+#define dev_debug(dip, ce, fmt, arg...) \
+ cmn_err(ce, "%s%d: " fmt, ddi_driver_name(dip), \
+ ddi_get_instance(dip), ##arg)
#else
-#define dev_debug(dip, fmt, arg...)
+#define dev_debug(dip, ce, fmt, arg...)
#endif
-void dev_err(dev_info_t *dip, int ce, char *fmt, ...);
-void dev_panic(dev_info_t *dip, char *fmt, ...);
-
-void hex_dump(char *prefix, void *addr, int len);
/*
* container_of taken from FreeBSD.
Oops, something went wrong.

0 comments on commit 550d53c

Please sign in to comment.