Update to diskperf-plugin 2.2.0, not BROKEN anymore.

I took over upstream maintenance and integrated our patches.

ok ajacoutot@
This commit is contained in:
landry 2008-04-17 13:14:28 +00:00
parent 65fce34741
commit 5ca2ba8ab9
5 changed files with 26 additions and 172 deletions

View File

@ -1,12 +1,10 @@
# $OpenBSD: Makefile,v 1.15 2008/03/03 09:18:55 landry Exp $
# $OpenBSD: Makefile,v 1.16 2008/04/17 13:14:28 landry Exp $
COMMENT= displays instant disk performance in the xfce4 panel
BROKEN= doesn't display accurate values
V= 2.1.0
V= 2.2.0
DISTNAME= xfce4-diskperf-plugin-${V}
PKGNAME= xfce4-diskperf-${V}p1
PKGNAME= xfce4-diskperf-${V}
HOMEPAGE= http://goodies.xfce.org/projects/panel-plugins/xfce4-diskperf-plugin

View File

@ -1,5 +1,5 @@
MD5 (xfce4/xfce4-diskperf-plugin-2.1.0.tar.bz2) = /HSgx9K5SGzbcEoHLNcrgw==
RMD160 (xfce4/xfce4-diskperf-plugin-2.1.0.tar.bz2) = fmZjTUhJncm+d3WArEjmbJ5RA5s=
SHA1 (xfce4/xfce4-diskperf-plugin-2.1.0.tar.bz2) = ZtuTrzL0o8oM6TH+0xKyZ6Oj3s4=
SHA256 (xfce4/xfce4-diskperf-plugin-2.1.0.tar.bz2) = SSpF1lIOtlRDTuLuClGPBgWiGXBuhjJ5r9fpwBZbF9U=
SIZE (xfce4/xfce4-diskperf-plugin-2.1.0.tar.bz2) = 183492
MD5 (xfce4/xfce4-diskperf-plugin-2.2.0.tar.bz2) = 6XAVj8rFtYvcFTm8hNe17A==
RMD160 (xfce4/xfce4-diskperf-plugin-2.2.0.tar.bz2) = l/HKyDLWXE5oMTkBM4sEF2jWjKg=
SHA1 (xfce4/xfce4-diskperf-plugin-2.2.0.tar.bz2) = 0mkXJ4B8VtSatAPYgo2iWtNCWIs=
SHA256 (xfce4/xfce4-diskperf-plugin-2.2.0.tar.bz2) = KJXDTMhbWtx7mPO62pGyK0j30L5gLh5RSveU8aDdRZg=
SIZE (xfce4/xfce4-diskperf-plugin-2.2.0.tar.bz2) = 196268

View File

@ -1,86 +0,0 @@
$OpenBSD: patch-panel-plugin_devperf_c,v 1.2 2007/05/11 14:02:02 steven Exp $
--- panel-plugin/devperf.c.orig Thu Jan 18 18:12:07 2007
+++ panel-plugin/devperf.c Fri May 11 15:48:55 2007
@@ -305,6 +305,82 @@ int DevGetPerfData (const void *p_pvDevice, struct dev
/* *INDENT-ON* */
/************************** NetBSD End ***************/
+#elif defined(__OpenBSD__)
+/*
+ * OpenBSD support.
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/disk.h>
+
+int DevPerfInit ()
+{
+ return (0);
+}
+
+int DevCheckStatAvailability(char const **strptr)
+{
+ return (0);
+}
+
+int DevGetPerfData (const void *p_pvDevice, struct devperf_t *perf)
+{
+ int mib[3], diskn, x;
+ size_t len;
+ char *devname = (char *)p_pvDevice;
+ struct diskstats *ds;
+ struct timeval tv;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKCOUNT;
+ len = sizeof(diskn);
+
+ if (sysctl(mib, 2, &diskn, &len, NULL, 0) < 0)
+ return (-1);
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKSTATS;
+ len = diskn * sizeof(struct diskstats);
+
+ ds = malloc(len);
+ if (ds == NULL)
+ return (-1);
+
+ if (sysctl(mib, 2, ds, &len, NULL, 0) < 0) {
+ free(ds);
+ return (-1);
+ }
+
+ for (x = 0; x < diskn; x++)
+ if (!strcmp(ds[x].ds_name, devname))
+ break;
+
+ if (x == diskn) {
+ free(ds);
+ return (-1);
+ }
+
+ if (gettimeofday(&tv, NULL)) {
+ free(ds);
+ return (-1);
+ }
+
+ perf->timestamp_ns = (uint64_t)1000ull * 1000ull * 1000ull * tv.tv_sec
+ + 1000ull * tv.tv_usec;
+ perf->rbusy_ns = ((uint64_t)1000ull * 1000ull * 1000ull *
+ ds[x].ds_time.tv_sec + 1000ull * ds[x].ds_time.tv_usec) / 2ull;
+
+ perf->wbusy_ns = perf->rbusy_ns / 2ull;
+ perf->rbytes = ds[x].ds_rbytes;
+ perf->wbytes = ds[x].ds_wbytes;
+ perf->qlen = ds[x].ds_rxfer + ds[x].ds_wxfer;
+
+ free(ds);
+
+ return (0);
+}
+
#else
/**************************************************************/
/******************** Unsupported platform ***************/

View File

@ -1,75 +0,0 @@
$OpenBSD: patch-panel-plugin_main_c,v 1.2 2007/05/11 14:02:02 steven Exp $
--- panel-plugin/main.c.orig Thu Jan 18 18:12:07 2007
+++ panel-plugin/main.c Fri May 11 15:52:04 2007
@@ -80,7 +80,7 @@ typedef enum monitor_bar_order_t {
typedef struct param_t {
/* Configurable parameters */
char acDevice[64];
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
dev_t st_rdev;
#endif
int fTitleDisplayed;
@@ -151,7 +151,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
const double K = 1.0 * 1000 * 1000 * 1000 / 1024 / 1024;
/* bytes/ns --> MB/s */
double arPerf[NMONITORS], arBusy[NMONITORS], *prData, *pr;
- char acToolTips[128];
+ char acToolTips[256];
int status, i;
if (!s_poToolTips)
@@ -159,7 +159,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
memset (&oPerf, 0, sizeof (oPerf));
oPerf.qlen = -1;
-#if defined (__NetBSD__)
+#if defined (__NetBSD__) || defined(__OpenBSD__)
status = DevGetPerfData (poConf->acDevice, &oPerf);
#else
status = DevGetPerfData (&(poConf->st_rdev), &oPerf);
@@ -199,7 +199,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
}
}
- sprintf (acToolTips, "%s\n"
+ snprintf (acToolTips, sizeof(acToolTips), "%s\n"
"----------------\n"
"I/O (MB/s)\n"
" Read :%3u\n"
@@ -400,7 +400,7 @@ static diskperf_t *diskperf_create_control (XfcePanelP
struct diskperf_t *poPlugin;
struct param_t *poConf;
struct monitor_t *poMonitor;
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
struct stat oStat;
int status;
#endif
@@ -412,7 +412,7 @@ static diskperf_t *diskperf_create_control (XfcePanelP
poPlugin->plugin = plugin;
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) || defined(__OpenBSD__)
strcpy (poConf->acDevice, "wd0");
strcpy (poConf->acTitle, "wd0");
#else
@@ -500,7 +500,7 @@ static void diskperf_read_config (XfcePanelPlugin *plu
if ((value = xfce_rc_read_entry (rc, (CONF_DEVICE), NULL))) {
memset (poConf->acDevice, 0, sizeof (poConf->acDevice));
strncpy (poConf->acDevice, value, sizeof (poConf->acDevice) - 1);
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
status = stat (poConf->acDevice, &oStat);
poConf->st_rdev = (status == -1 ? 0 : oStat.st_rdev);
#endif
@@ -623,7 +623,7 @@ static void SetDevice (Widget_t p_wTF, void *p_pvPlugi
struct diskperf_t *poPlugin = (diskperf_t *) p_pvPlugin;
struct param_t *poConf = &(poPlugin->oConf.oParam);
const char *pcDevice = gtk_entry_get_text (GTK_ENTRY (p_wTF));
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
struct stat oStat;
int status;

View File

@ -1,15 +1,32 @@
@comment $OpenBSD: PLIST,v 1.4 2007/12/18 21:10:22 landry Exp $
@comment $OpenBSD: PLIST,v 1.5 2008/04/17 13:14:28 landry Exp $
@conflict xfce4-diskperf-plugin-*
libexec/xfce4/
libexec/xfce4/panel-plugins/
libexec/xfce4/panel-plugins/xfce4-diskperf-plugin
share/locale/ca/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/cs/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/de/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/en_GB/
share/locale/en_GB/LC_MESSAGES/
share/locale/en_GB/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/eu/
share/locale/eu/LC_MESSAGES/
share/locale/eu/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/fr/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/lv/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/nb_NO/
share/locale/nb_NO/LC_MESSAGES/
share/locale/nb_NO/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/pl/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/pt_BR/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/pt_PT/
share/locale/pt_PT/LC_MESSAGES/
share/locale/pt_PT/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/uk/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/ur/
share/locale/ur/LC_MESSAGES/
share/locale/ur/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/locale/zh_CN/LC_MESSAGES/xfce4-diskperf-plugin.mo
share/xfce4/
share/xfce4/panel-plugins/
share/xfce4/panel-plugins/diskperf.desktop