[Xfce4-commits] [panel-plugins/xfce4-diskperf-plugin] 01/01: Fix stats reporting on linux for devices with a major > 255 (#13281)

noreply at xfce.org noreply at xfce.org
Mon Feb 20 20:58:02 CET 2017


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository panel-plugins/xfce4-diskperf-plugin.

commit a18919e4063f4f9c2947971d1c26fbf942a7a3c9
Author: Landry Breuil <landry at xfce.org>
Date:   Mon Feb 20 20:57:05 2017 +0100

    Fix stats reporting on linux for devices with a major > 255 (#13281)
    
    Use major() and minor() macros instead of wrongly doing it our own way..
---
 panel-plugin/devperf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/devperf.c b/panel-plugin/devperf.c
index 26e5ee8..175fd44 100644
--- a/panel-plugin/devperf.c
+++ b/panel-plugin/devperf.c
@@ -33,6 +33,9 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/time.h>
+/* for major() and minor() */
+#define _BSD_SOURCE
+#include <sys/types.h>
 
 
 #if defined(__linux__)
@@ -59,8 +62,8 @@ static GetPerfData_t m_mGetPerfData = 0;
 static int DevGetPerfData1 (dev_t p_iDevice, struct devperf_t *p_poPerf)
 	/* Get disk performance statistics from STATISTICS_FILE_1 */
 {
-    const int       iMajorNo = (p_iDevice >> 8) & 0xFF, /**/
-	iMinorNo = p_iDevice & 0xFF;
+    const int       iMajorNo = major(p_iDevice),
+	iMinorNo = minor(p_iDevice);
     struct timeval  oTimeStamp;
     FILE           *pF;
     unsigned int    major, minor, rsect, wsect, ruse, wuse, use;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list