First bunch of fixes to SysInfo-Unix, now it works - barely
This commit is contained in:
parent
62c9375bc9
commit
3d01c78248
|
@ -24,8 +24,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "xsys.h"
|
#include "xsys.h"
|
||||||
|
|
||||||
extern int percentages;
|
|
||||||
|
|
||||||
float percentage(unsigned long long *free, unsigned long long *total)
|
float percentage(unsigned long long *free, unsigned long long *total)
|
||||||
{
|
{
|
||||||
unsigned long long result = (*free) * (unsigned long long)1000 / (*total);
|
unsigned long long result = (*free) * (unsigned long long)1000 / (*total);
|
||||||
|
@ -56,7 +54,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
|
||||||
free_space = free_space / 1024;
|
free_space = free_space / 1024;
|
||||||
total_space = total_space / 1024;
|
total_space = total_space / 1024;
|
||||||
}
|
}
|
||||||
if (percentages != 0)
|
if (sysinfo_get_percentages () != 0)
|
||||||
snprintf(result, bsize, "%s: %.1f%s, %.1f%% free",
|
snprintf(result, bsize, "%s: %.1f%s, %.1f%% free",
|
||||||
desc, total_space, bytesize,
|
desc, total_space, bytesize,
|
||||||
percentage(free_k, total_k));
|
percentage(free_k, total_k));
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
#include <pci/pci.h>
|
#include <pci/pci.h>
|
||||||
#include "xsys.h"
|
#include "xsys.h"
|
||||||
|
|
||||||
#define PCIIDS "/usr/share/misc/pci.ids"
|
|
||||||
|
|
||||||
static struct pci_filter filter; /* Device filter */
|
static struct pci_filter filter; /* Device filter */
|
||||||
static struct pci_access *pacc;
|
static struct pci_access *pacc;
|
||||||
int bus, dev, func; /* Location of the card */
|
int bus, dev, func; /* Location of the card */
|
||||||
|
@ -112,9 +110,15 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
|
||||||
|
|
||||||
void pci_find_fullname(char *fullname, char *vendor, char *device)
|
void pci_find_fullname(char *fullname, char *vendor, char *device)
|
||||||
{
|
{
|
||||||
char buffer[bsize], vendorname[bsize/2] = "", devicename[bsize/2] = "", *position;
|
char buffer[bsize];
|
||||||
|
char vendorname[bsize/2] = "";
|
||||||
|
char devicename[bsize/2] = "";
|
||||||
|
char *position;
|
||||||
int cardfound = 0;
|
int cardfound = 0;
|
||||||
FILE *fp = fopen(PCIIDS, "r");
|
|
||||||
|
sysinfo_get_pciids (buffer);
|
||||||
|
FILE *fp = fopen (buffer, "r");
|
||||||
|
|
||||||
if(fp == NULL) {
|
if(fp == NULL) {
|
||||||
snprintf(fullname, bsize, "%s:%s", vendor, device);
|
snprintf(fullname, bsize, "%s:%s", vendor, device);
|
||||||
return;
|
return;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,4 +25,7 @@
|
||||||
#define bsize 1024
|
#define bsize 1024
|
||||||
#define delims ":="
|
#define delims ":="
|
||||||
|
|
||||||
|
int sysinfo_get_percentages ();
|
||||||
|
void sysinfo_get_pciids (char *dest);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue