]> granicus.if.org Git - procps-ng/commitdiff
library: remove getpartitions_num from library
authorCraig Small <csmall@enc.com.au>
Wed, 1 Jul 2015 12:14:30 +0000 (22:14 +1000)
committerCraig Small <csmall@enc.com.au>
Wed, 1 Jul 2015 12:14:30 +0000 (22:14 +1000)
getpartitions_num was only used in vmstat and basically counted
partitions in disks, this is now moved to vmstat.

proc/libprocps.sym
proc/sysinfo.c
proc/sysinfo.h
vmstat.c

index 7d2c881a810aa3df7117d27e7f67207e1d145918..c3d4c87b7f6baaf4ad9fdeb38035932c4de052b2 100644 (file)
@@ -12,9 +12,7 @@ global:
        get_ns_name;
        get_pid_digits;
        get_slabinfo;
-       getbtime;
        getdiskstat;
-       getpartitions_num;
        getslabinfo;
        look_up_our_self;
        lookup_wchan;
index b67f7c7634227f8c0bae3f1e499a56c2eebfd465..01d920581c07f09ad70edd491cb3365ed8cda74f 100644 (file)
@@ -171,21 +171,6 @@ static void crash(const char *filename) {
 }
 
 
-///////////////////////////////////////////////////////////////////////
-// based on Fabian Frederick's /proc/diskstats parser
-
-
-unsigned int getpartitions_num(struct disk_stat *disks, int ndisks){
-  int i=0;
-  int partitions=0;
-
-  for (i=0;i<ndisks;i++){
-       partitions+=disks[i].partitions;
-  }
-  return partitions;
-
-}
-
 /////////////////////////////////////////////////////////////////////////////
 static int is_disk(char *dev)
 {
index 2b68061e5eb1f9397986d24cabda45cf7920048d..a0d020ff4df5038c6ce8e89ffc2351f345f0e5ac 100644 (file)
@@ -41,7 +41,6 @@ typedef struct partition_stat{
        unsigned long long requested_writes;
 }partition_stat;
 
-extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks);
 extern unsigned int getdiskstat (struct disk_stat**,struct partition_stat**);
 
 typedef struct slab_cache{
index a469e7d277e613ad935a1f31e15a52f447739138..559582dbbb82c55a107c3bab54da603be9f45e86 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -115,76 +115,6 @@ static void __attribute__ ((__noreturn__))
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
-#if 0
-/* produce: "  6  ", "123  ", "123k ", etc. */
-static int format_1024(unsigned long long val64, char *restrict dst)
-{
-       unsigned oldval;
-       const char suffix[] = " kmgtpe";
-       unsigned level = 0;
-       unsigned val32;
-
-       if (val64 < 1000) {
-               /* special case to avoid "6.0  " when plain "  6  " would do */
-               val32 = val64;
-               return sprintf(dst, "%3u  ", val32);
-       }
-
-       while (val64 > 0xffffffffull) {
-               level++;
-               val64 /= 1024;
-       }
-
-       val32 = val64;
-
-       while (val32 > 999) {
-               level++;
-               oldval = val32;
-               val32 /= 1024;
-       }
-
-       if (val32 < 10) {
-               unsigned fract = (oldval % 1024) * 10 / 1024;
-               return sprintf(dst, "%u.%u%c ", val32, fract, suffix[level]);
-       }
-       return sprintf(dst, "%3u%c ", val32, suffix[level]);
-}
-
-/* produce: "  6  ", "123  ", "123k ", etc. */
-static int format_1000(unsigned long long val64, char *restrict dst)
-{
-       unsigned oldval;
-       const char suffix[] = " kmgtpe";
-       unsigned level = 0;
-       unsigned val32;
-
-       if (val64 < 1000) {
-               /* special case to avoid "6.0  " when plain "  6  " would do */
-               val32 = val64;
-               return sprintf(dst, "%3u  ", val32);
-       }
-
-       while (val64 > 0xffffffffull) {
-               level++;
-               val64 /= 1000;
-       }
-
-       val32 = val64;
-
-       while (val32 > 999) {
-               level++;
-               oldval = val32;
-               val32 /= 1000;
-       }
-
-       if (val32 < 10) {
-               unsigned fract = (oldval % 1000) / 100;
-               return sprintf(dst, "%u.%u%c ", val32, fract, suffix[level]);
-       }
-       return sprintf(dst, "%3u%c ", val32, suffix[level]);
-}
-#endif
-
 static void new_header(void)
 {
        struct tm *tm_ptr;
@@ -269,6 +199,20 @@ static void new_header(void)
        printf("\n");
 }
 
+///////////////////////////////////////////////////////////////////////
+// based on Fabian Frederick's /proc/diskstats parser
+
+static unsigned int getpartitions_num(struct disk_stat *disks, int ndisks)
+{
+    unsigned int i;
+    int partitions=0;
+
+    for (i=0; i<ndisks; i++) {
+        partitions+=disks[i].partitions;
+    }
+    return partitions;
+}
+
 static unsigned long unitConvert(unsigned long size)
 {
        float cvSize;