Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm Enable state...
details: https://anonhg.NetBSD.org/src/rev/75d793bac5d4
branches: trunk
changeset: 335008:75d793bac5d4
user: nat <nat%NetBSD.org@localhost>
date: Sat Dec 20 19:40:49 2014 +0000
description:
Enable state/stats information on vchiq device read.
This commit was approved by skrll@
diffstat:
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c | 31 +++++++-----
1 files changed, 18 insertions(+), 13 deletions(-)
diffs (89 lines):
diff -r ae93ba6ab2bd -r 75d793bac5d4 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sat Dec 20 18:03:17 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Sat Dec 20 19:40:49 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)
Home |
Main Index |
Thread Index |
Old Index