//////////////////////////////////////////////////
//Title    : pub_sys.c
//Auhtor   : Liu Wei
//Desc     : Public Linux system infomation 
//Created  : 2007-06-02
//Revision :
//
//Revision :
//
//////////////////////////////////////////////////

#ifndef _PUB_SYS_H_
#define _PUB_SYS_H_

#include "public.h"
#include "includes.h"
#include "pub_base.h"
#include "pub_time.h"
#include <sys/mount.h>
#include <mntent.h>
#include <sys/sysinfo.h> 
#include <sys/utsname.h>
#include <fstab.h>
#include <sys/stat.h>
#include <linux/kernel.h>
//#include <linux/sys.h>
  
#define SIM_NONL	0x1000		// Don't add newline to output  
#define SIM_NOLBL	0x2000		// Don't print "Public: Error:"  


#define MHERTZ			    1000000				    // MegaHertz
#define BYTES			    ((u32)1)			    // Bytes 
#define KBYTES			    ((u32)1024)			    // Kilo bytes 
#define MBYTES			    ((u32)(1024*1024))		// Mega bytes 
#define GBYTES			    ((u32)(1024*1024*1024))	// Giga bytes 

#define BytesToGBytes(N)	( (float) N / (float) GBYTES )
#define BytesToMBytes(N)	( (float) N / (float) MBYTES )
#define BytesToKBytes(N)	( (float) (N / (float) KBYTES) )
#define MBytesToBytes(N)	( (float) ( (float) N * (float) MBYTES ) )
#define KBytesToMbytes(N)	( (float) ( (float) N / (float) KBYTES ) )
#define KBytesToGbytes(N)	( (float) ( (float) N / (float) MBYTES ) )
#define MbytesToGbytes(N) 	( (float) ( (float) N / (float) KBYTES ) )

#define EQ(a,b)			    (a && b && strcasecmp(a,b)==0)
#define EQN(a,b,n)		    (a && b && strncasecmp(a,b,n)==0)
#define eq(a,b)			    (a && b && strcmp(a,b)==0)
#define eqn(a,b,n)		    (a && b && strncmp(a,b,n)==0)
#define ARG(s)			    ((s) ? s : "<null>")
#define PRTS(s)			    ( ( s && *s ) ? s : "" )

#endif
