summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-04-26 23:55:30 +0000
committerEric Anholt <anholt@freebsd.org>2003-04-26 23:55:30 +0000
commit9828bd24c8f7b9d115acf94e422fa34ec8627b92 (patch)
treecafaddcf42301d5ae9f853c205224c6d5c76ca2f
parent766a1da2e5841959246abab9cf27c79d75636129 (diff)
Fix formatting of hw.dri sysctl.
-rw-r--r--bsd-core/drm_os_freebsd.h9
-rw-r--r--bsd-core/drm_os_netbsd.h5
-rw-r--r--bsd-core/drm_sysctl.c26
-rw-r--r--bsd/drm_os_freebsd.h9
-rw-r--r--bsd/drm_os_netbsd.h5
-rw-r--r--bsd/drm_sysctl.h26
6 files changed, 32 insertions, 48 deletions
diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h
index 7b19acc2..b9869c9f 100644
--- a/bsd-core/drm_os_freebsd.h
+++ b/bsd-core/drm_os_freebsd.h
@@ -368,14 +368,11 @@ find_first_zero_bit(volatile void *p, int max)
#endif
#define DRM_SYSCTL_PRINT(fmt, arg...) \
+do { \
snprintf(buf, sizeof(buf), fmt, ##arg); \
error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) return error;
-
-#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \
- snprintf(buf, sizeof(buf), fmt, ##arg); \
- error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) { ret; return error; }
+ if (error) return error; \
+} while (0)
#define DRM_FIND_MAP(dest, o) \
diff --git a/bsd-core/drm_os_netbsd.h b/bsd-core/drm_os_netbsd.h
index 246ebdc6..a0c4f78f 100644
--- a/bsd-core/drm_os_netbsd.h
+++ b/bsd-core/drm_os_netbsd.h
@@ -321,11 +321,6 @@ do { \
error = SYSCTL_OUT(req, buf, strlen(buf)); \
if (error) return error;
-#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \
- snprintf(buf, sizeof(buf), fmt, ##arg); \
- error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) { ret; return error; }
-
#define DRM_FIND_MAP(dest, o) \
do { \
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
index 8c038bdd..9a89a76e 100644
--- a/bsd-core/drm_sysctl.c
+++ b/bsd-core/drm_sysctl.c
@@ -99,10 +99,10 @@ static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS
int error;
if (dev->unique) {
- DRM_SYSCTL_PRINT("%s 0x%x %s\n",
+ DRM_SYSCTL_PRINT("%s 0x%x %s",
dev->name, dev2udev(dev->devnode), dev->unique);
} else {
- DRM_SYSCTL_PRINT("%s 0x%x\n", dev->name, dev2udev(dev->devnode));
+ DRM_SYSCTL_PRINT("%s 0x%x", dev->name, dev2udev(dev->devnode));
}
SYSCTL_OUT(req, "", 1);
@@ -115,22 +115,22 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS
drm_device_t *dev = arg1;
drm_local_map_t *map;
drm_map_list_entry_t *listentry;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
const char *type;
int i=0;
char buf[128];
int error;
- DRM_SYSCTL_PRINT("slot offset size type flags "
- "address mtrr\n\n");
- error = SYSCTL_OUT(req, buf, strlen(buf));
- if (error) return error;
+ DRM_SYSCTL_PRINT("\nslot offset size type flags "
+ "address mtrr\n");
if (dev->maplist != NULL) {
TAILQ_FOREACH(listentry, dev->maplist, link) {
map = listentry->map;
- if (map->type < 0 || map->type > 2) type = "??";
- else type = types[map->type];
+ if (map->type < 0 || map->type > 4)
+ type = "??";
+ else
+ type = types[map->type];
DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
map->offset,
@@ -139,9 +139,9 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS
map->flags,
(unsigned long)map->handle);
if (map->mtrr < 0) {
- DRM_SYSCTL_PRINT("none\n");
+ DRM_SYSCTL_PRINT("no\n");
} else {
- DRM_SYSCTL_PRINT("%4d\n", map->mtrr);
+ DRM_SYSCTL_PRINT("yes\n");
}
i++;
}
@@ -176,7 +176,7 @@ static int DRM(_bufs_info) DRM_SYSCTL_HANDLER_ARGS
int error;
if (!dma) return 0;
- DRM_SYSCTL_PRINT(" o size count free segs pages kB\n\n");
+ DRM_SYSCTL_PRINT("\n o size count free segs pages kB\n");
for (i = 0; i <= DRM_MAX_ORDER; i++) {
if (dma->bufs[i].buf_count)
DRM_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\n",
@@ -222,7 +222,7 @@ static int DRM(_clients_info) DRM_SYSCTL_HANDLER_ARGS
char buf[128];
int error;
- DRM_SYSCTL_PRINT("a dev pid uid magic ioctls\n\n");
+ DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n");
TAILQ_FOREACH(priv, &dev->files, link) {
DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n",
priv->authenticated ? 'y' : 'n',
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 7b19acc2..b9869c9f 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -368,14 +368,11 @@ find_first_zero_bit(volatile void *p, int max)
#endif
#define DRM_SYSCTL_PRINT(fmt, arg...) \
+do { \
snprintf(buf, sizeof(buf), fmt, ##arg); \
error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) return error;
-
-#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \
- snprintf(buf, sizeof(buf), fmt, ##arg); \
- error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) { ret; return error; }
+ if (error) return error; \
+} while (0)
#define DRM_FIND_MAP(dest, o) \
diff --git a/bsd/drm_os_netbsd.h b/bsd/drm_os_netbsd.h
index 246ebdc6..a0c4f78f 100644
--- a/bsd/drm_os_netbsd.h
+++ b/bsd/drm_os_netbsd.h
@@ -321,11 +321,6 @@ do { \
error = SYSCTL_OUT(req, buf, strlen(buf)); \
if (error) return error;
-#define DRM_SYSCTL_PRINT_RET(ret, fmt, arg...) \
- snprintf(buf, sizeof(buf), fmt, ##arg); \
- error = SYSCTL_OUT(req, buf, strlen(buf)); \
- if (error) { ret; return error; }
-
#define DRM_FIND_MAP(dest, o) \
do { \
diff --git a/bsd/drm_sysctl.h b/bsd/drm_sysctl.h
index 8c038bdd..9a89a76e 100644
--- a/bsd/drm_sysctl.h
+++ b/bsd/drm_sysctl.h
@@ -99,10 +99,10 @@ static int DRM(name_info)DRM_SYSCTL_HANDLER_ARGS
int error;
if (dev->unique) {
- DRM_SYSCTL_PRINT("%s 0x%x %s\n",
+ DRM_SYSCTL_PRINT("%s 0x%x %s",
dev->name, dev2udev(dev->devnode), dev->unique);
} else {
- DRM_SYSCTL_PRINT("%s 0x%x\n", dev->name, dev2udev(dev->devnode));
+ DRM_SYSCTL_PRINT("%s 0x%x", dev->name, dev2udev(dev->devnode));
}
SYSCTL_OUT(req, "", 1);
@@ -115,22 +115,22 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS
drm_device_t *dev = arg1;
drm_local_map_t *map;
drm_map_list_entry_t *listentry;
- const char *types[] = { "FB", "REG", "SHM" };
+ const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
const char *type;
int i=0;
char buf[128];
int error;
- DRM_SYSCTL_PRINT("slot offset size type flags "
- "address mtrr\n\n");
- error = SYSCTL_OUT(req, buf, strlen(buf));
- if (error) return error;
+ DRM_SYSCTL_PRINT("\nslot offset size type flags "
+ "address mtrr\n");
if (dev->maplist != NULL) {
TAILQ_FOREACH(listentry, dev->maplist, link) {
map = listentry->map;
- if (map->type < 0 || map->type > 2) type = "??";
- else type = types[map->type];
+ if (map->type < 0 || map->type > 4)
+ type = "??";
+ else
+ type = types[map->type];
DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
map->offset,
@@ -139,9 +139,9 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS
map->flags,
(unsigned long)map->handle);
if (map->mtrr < 0) {
- DRM_SYSCTL_PRINT("none\n");
+ DRM_SYSCTL_PRINT("no\n");
} else {
- DRM_SYSCTL_PRINT("%4d\n", map->mtrr);
+ DRM_SYSCTL_PRINT("yes\n");
}
i++;
}
@@ -176,7 +176,7 @@ static int DRM(_bufs_info) DRM_SYSCTL_HANDLER_ARGS
int error;
if (!dma) return 0;
- DRM_SYSCTL_PRINT(" o size count free segs pages kB\n\n");
+ DRM_SYSCTL_PRINT("\n o size count free segs pages kB\n");
for (i = 0; i <= DRM_MAX_ORDER; i++) {
if (dma->bufs[i].buf_count)
DRM_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\n",
@@ -222,7 +222,7 @@ static int DRM(_clients_info) DRM_SYSCTL_HANDLER_ARGS
char buf[128];
int error;
- DRM_SYSCTL_PRINT("a dev pid uid magic ioctls\n\n");
+ DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n");
TAILQ_FOREACH(priv, &dev->files, link) {
DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n",
priv->authenticated ? 'y' : 'n',