[Sysfence-commit] sysfence datastruct.h,NONE,1.1
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-05-23 20:53:12
|
Update of /cvsroot/sysfence/sysfence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14695 Added Files: datastruct.h Log Message: + new data structures, (almost) all in one file --- NEW FILE: datastruct.h --- /* copyright (c) 2004, Michal Salaban <em...@pl...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation (see file COPYING for details). You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: datastruct.h,v 1.1 2004/05/23 20:53:01 emes Exp $ */ #include <sys/types.h> #define STAT_MAX_ARGS 2 #define PROC_RUN 1 #define PROC_SLEEP 2 #define PROC_STOP 4 #define PROC_ZOMBIE 8 /*************************************************************************** All-purpose list ***************************************************************************/ typedef struct _sf_list { int elsize; void *el; struct _sf_list *next; } sf_list; /*************************************************************************** Stats ***************************************************************************/ typedef enum { // Label describing stat type ST_LOAD, ST_MEM, ST_SWAP, ST_FS, ST_PROC, ST_NONE } sf_stat_label; typedef enum { // Label describing data type (used with void* pointers) DOUBLE, INTEGER, PERCENT } sf_type; typedef enum { // Selector of value associated with resource VA_USED, VA_FREE, VA_AVAIL, VA_TOTAL, VA_LAST } sf_res_state; typedef union { // Selector or option describing stat int laminutes; // load sf_res_state resstat; // resources int procstates; // processes sf_list *uids; // processes char *path; // filesystem } sf_stat_arg; typedef struct { // Stat definition sf_stat_label label; sf_stat_arg arg[ STAT_MAX_ARGS ]; } sf_stat_def; typedef struct { // Value with known type sf_type type; void *ptr; } sf_value; typedef struct { // Full stat (definition and value) sf_stat_def stat; sf_value val; } sf_stat_value; /*************************************************************************** Rules ***************************************************************************/ typedef struct { // Node (relation) of an expression enum { RELATION, ATOMIC } type; void *arg1; void *arg2; token op; } sf_expression; typedef struct { // Atomic relation (between stat and threshold) sf_stat_def stat; sf_value thresh; token op; } sf_atomic; typedef struct { // Command to be run int once; char *command; } sf_rundata; typedef struct { // Log action int once; } sf_logdata; typedef struct { // One rule char *name; sf_expression *expr; sf_rundata *run; sf_logdata *log; unsigned int step; // indicate if expression was true after this check and previous one int hit, prevhit; } sf_rule; /*************************************************************************** Stat values database ***************************************************************************/ typedef struct { // Statistics of underlying filesystem in path char *path; long int val[ VA_LAST ]; } sf_fs_stats; typedef struct { // Main statistics database double load[3]; long int mem[ VA_LAST ]; long int swap[ VA_LAST ]; sf_list *fs; void *proc; // NIY } sf_database; /* $Id: datastruct.h,v 1.1 2004/05/23 20:53:01 emes Exp $ */ |