summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-04-25 00:02:14 +0000
committerEric Anholt <anholt@freebsd.org>2003-04-25 00:02:14 +0000
commit58650c3a9d53044a0ab463df41864ddb39238bab (patch)
tree2f2b239142ad5762e7c810082e4a94f2e6259df2
parent781828b26e35e8347e461d2097563823e8f76c88 (diff)
Clean up the DRM_COPY_TO_USER()ing of DRM(infobufs), making it more
legible.
-rw-r--r--bsd-core/drm_bufs.c24
-rw-r--r--bsd/drm_bufs.h24
2 files changed, 18 insertions, 30 deletions
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index af9e76f1..9a815f00 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -799,21 +799,15 @@ int DRM(infobufs)( DRM_IOCTL_ARGS )
if ( request.count >= count ) {
for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
if ( dma->bufs[i].buf_count ) {
- drm_buf_desc_t *to = &request.list[count];
- drm_buf_entry_t *from = &dma->bufs[i];
- drm_freelist_t *list = &dma->bufs[i].freelist;
- if ( DRM_COPY_TO_USER( &to->count,
- &from->buf_count,
- sizeof(from->buf_count) ) ||
- DRM_COPY_TO_USER( &to->size,
- &from->buf_size,
- sizeof(from->buf_size) ) ||
- DRM_COPY_TO_USER( &to->low_mark,
- &list->low_mark,
- sizeof(list->low_mark) ) ||
- DRM_COPY_TO_USER( &to->high_mark,
- &list->high_mark,
- sizeof(list->high_mark) ) )
+ drm_buf_desc_t from;
+
+ from.count = dma->bufs[i].buf_count;
+ from.size = dma->bufs[i].buf_size;
+ from.low_mark = dma->bufs[i].freelist.low_mark;
+ from.high_mark = dma->bufs[i].freelist.high_mark;
+
+ if (DRM_COPY_TO_USER(&request.list[count], &from,
+ sizeof(drm_buf_desc_t)) != 0)
return DRM_ERR(EFAULT);
DRM_DEBUG( "%d %d %d %d %d\n",
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h
index af9e76f1..9a815f00 100644
--- a/bsd/drm_bufs.h
+++ b/bsd/drm_bufs.h
@@ -799,21 +799,15 @@ int DRM(infobufs)( DRM_IOCTL_ARGS )
if ( request.count >= count ) {
for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
if ( dma->bufs[i].buf_count ) {
- drm_buf_desc_t *to = &request.list[count];
- drm_buf_entry_t *from = &dma->bufs[i];
- drm_freelist_t *list = &dma->bufs[i].freelist;
- if ( DRM_COPY_TO_USER( &to->count,
- &from->buf_count,
- sizeof(from->buf_count) ) ||
- DRM_COPY_TO_USER( &to->size,
- &from->buf_size,
- sizeof(from->buf_size) ) ||
- DRM_COPY_TO_USER( &to->low_mark,
- &list->low_mark,
- sizeof(list->low_mark) ) ||
- DRM_COPY_TO_USER( &to->high_mark,
- &list->high_mark,
- sizeof(list->high_mark) ) )
+ drm_buf_desc_t from;
+
+ from.count = dma->bufs[i].buf_count;
+ from.size = dma->bufs[i].buf_size;
+ from.low_mark = dma->bufs[i].freelist.low_mark;
+ from.high_mark = dma->bufs[i].freelist.high_mark;
+
+ if (DRM_COPY_TO_USER(&request.list[count], &from,
+ sizeof(drm_buf_desc_t)) != 0)
return DRM_ERR(EFAULT);
DRM_DEBUG( "%d %d %d %d %d\n",