1: /*      Program Name:   vmf.h
   2:  *      Author:  S.M. Schultz
   3:  *
   4:  *      -----------   Modification History   ------------
   5:  *      Version Date            Reason For Modification
   6:  *      1.0     01Jan80         1. Initial release.
   7:  *      2.0     31Mar83         2. Cleanup.
   8:  *	3.0	08Sep93		3. Change v_foffset to off_t instead of int.
   9:  *	3.1	21Oct93		4. Create union member of structure to
  10:  *				   make 'int' or 'char' access to data easy.
  11:  *				   Define segment+offset and modified macros.
  12:  *				   Place into the public domain.
  13:  *      --------------------------------------------------
  14: */
  15: 
  16: #include <sys/types.h>
  17: 
  18: #define MAXSEGNO    512 /* max number of segments in a space */
  19: #define BYTESPERSEG     1024    /* must be power of two! */
  20: #define LOG2BPS     10  /* log2(BYTESPERSEG) */
  21: #define WORDSPERSEG     (BYTESPERSEG/sizeof (int))
  22: 
  23: struct vspace {
  24:     int     v_fd;           /* file for swapping */
  25:     off_t   v_foffset;      /* offset for computing file addresses */
  26:     int     v_maxsegno;     /* number of segments in this space */
  27:     };
  28: 
  29: struct dlink {                  /* general double link structure */
  30:     struct dlink *fwd;      /* forward link */
  31:     struct dlink *back;     /* back link */
  32:     };
  33: 
  34: struct  vseg {                    /* structure of a segment in memory */
  35:     struct  dlink   s_link;     /* for linking into lru list */
  36:     int s_segno;            /* segment number */
  37:     struct  vspace  *s_vspace;      /* which virtual space */
  38:     int s_lock_count;
  39:     int     s_flags;
  40:     union
  41:         {
  42:         int _winfo[WORDSPERSEG];    /* the actual segment */
  43:         char    _cinfo[BYTESPERSEG];
  44:         } v_un;
  45:     };
  46: 
  47: #define s_winfo v_un._winfo
  48: #define s_cinfo v_un._cinfo
  49: 
  50: /* masks for s_flags */
  51: #define S_DIRTY 01                  /* segment has been modified */
  52: 
  53:     long    nswaps;             /* number of swaps */
  54:     long    nmapsegs;           /* number of mapseg calls */
  55: 
  56:     int vminit(), vmopen();
  57:     struct  vseg    *vmmapseg();
  58:     void    vmlock(), vmunlock(), vmclrseg(), vmmodify();
  59:     void    vmflush(), vmclose();
  60: 
  61: typedef long    VADDR;
  62: #define VMMODIFY(seg) (seg->s_flags |= S_DIRTY)
  63: #define VSEG(va) ((short)(va >> LOG2BPS))
  64: #define VOFF(va) ((u_short)va % BYTESPERSEG)

Defined variables

nmapsegs defined in line 54; never used
nswaps defined in line 53; never used

Defined struct's

dlink defined in line 29; used 6 times
vseg defined in line 34; used 2 times
  • in line 57(2)
vspace defined in line 23; used 2 times
  • in line 37(2)

Defined typedef's

VADDR defined in line 61; never used

Defined macros

BYTESPERSEG defined in line 19; used 3 times
LOG2BPS defined in line 20; used 1 times
  • in line 63
MAXSEGNO defined in line 18; never used
S_DIRTY defined in line 51; used 1 times
  • in line 62
VMMODIFY defined in line 62; never used
VOFF defined in line 64; never used
VSEG defined in line 63; never used
WORDSPERSEG defined in line 21; used 1 times
  • in line 42
s_cinfo defined in line 48; never used
s_winfo defined in line 47; never used
Last modified: 1993-10-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2428
Valid CSS Valid XHTML 1.0 Strict