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
Defined struct's
dlink
defined in line
29; used 6 times
vseg
defined in line
34; used 2 times
Defined typedef's
VADDR
defined in line
61;
never used
Defined macros
VOFF
defined in line
64;
never used
VSEG
defined in line
63;
never used