Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm Pull up f...
details: https://anonhg.NetBSD.org/src/rev/535c88d4c09d
branches: netbsd-7
changeset: 798748:535c88d4c09d
user: martin <martin%NetBSD.org@localhost>
date: Mon Dec 29 16:25:28 2014 +0000
description:
Pull up following revision(s) (requested by nat in ticket #345):
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c: revision 1.14
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c: revision 1.10
Enable state/stats information on vchiq device read.
Allow more space for temp string buffer in service stats display.
Fixes corrupted display when rx and tx count become large.
diffstat:
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c | 31 ++++++-----
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c | 2 +-
2 files changed, 19 insertions(+), 14 deletions(-)
diffs (101 lines):
diff -r 87858d279987 -r 535c88d4c09d sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Mon Dec 29 16:18:04 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Mon Dec 29 16:25:28 2014 +0000
@@ -36,6 +36,7 @@
#include <sys/device.h>
#include <sys/file.h>
#include <sys/filedesc.h>
+#include <sys/kmem.h>
#include "vchiq_core.h"
#include "vchiq_ioctl.h"
@@ -196,9 +197,10 @@
static int vchiq_ioctl(struct file *, u_long, void *);
static int vchiq_close(struct file *);
+static int vchiq_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
static const struct fileops vchiq_fileops = {
- .fo_read = fbadop_read,
+ .fo_read = vchiq_read,
.fo_write = fbadop_write,
.fo_ioctl = vchiq_ioctl,
.fo_fcntl = fnullop_fcntl,
@@ -1245,9 +1247,7 @@
copy_bytes = min(len, (int)(context->space - context->actual));
if (copy_bytes == 0)
return;
- if (copy_to_user(context->buf + context->actual, str,
- copy_bytes))
- context->actual = -EFAULT;
+ memcpy(context->buf + context->actual, str, copy_bytes);
context->actual += copy_bytes;
len -= copy_bytes;
@@ -1256,9 +1256,7 @@
** carriage return. */
if ((len == 0) && (str[copy_bytes - 1] == '\0')) {
char cr = '\n';
- if (copy_to_user(context->buf + context->actual - 1,
- &cr, 1))
- context->actual = -EFAULT;
+ memcpy(context->buf + context->actual - 1, &cr, 1);
}
}
}
@@ -1432,6 +1430,7 @@
kfree(pages);
}
+#endif
/****************************************************************************
*
@@ -1439,23 +1438,29 @@
*
***************************************************************************/
-static ssize_t
-vchiq_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static int
+vchiq_read(struct file *file, off_t *ppos, struct uio *uio, kauth_cred_t cred,
+ int flags)
{
+ int result;
+
+ char *buf = kmem_zalloc(PAGE_SIZE, KM_SLEEP);
+
DUMP_CONTEXT_T context;
context.buf = buf;
context.actual = 0;
- context.space = count;
+ context.space = PAGE_SIZE;
context.offset = *ppos;
vchiq_dump_state(&context, &g_state);
*ppos += context.actual;
- return context.actual;
+ result = uiomove(buf, context.actual, uio);
+ kmem_free(buf, PAGE_SIZE);
+
+ return result;
}
-#endif
VCHIQ_STATE_T *
vchiq_get_state(void)
diff -r 87858d279987 -r 535c88d4c09d sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Mon Dec 29 16:18:04 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Mon Dec 29 16:25:28 2014 +0000
@@ -3648,7 +3648,7 @@
void
vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
{
- char buf[80];
+ char buf[120];
int len;
len = snprintf(buf, sizeof(buf), "Service %d: %s (ref %u)",
Home |
Main Index |
Thread Index |
Old Index