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 14 times
vseg
defined in line
34; used 64 times
- in line 57(2)
- in /usr/src/bin/ld/ld.c line
825(2),
992(2),
1161(2),
1866(2)
- in /usr/src/usr.lib/libvmf/vmf.c line
59-62(8),
87-92(4),
105-116(12),
178(2),
209(2),
222(2),
236(2),
250(2),
264-267(8),
279(2),
325-330(8),
349(2)
vspace
defined in line
23; used 12 times
Defined typedef's
VADDR
defined in line
61; used 14 times
- in /usr/src/bin/ld/ld.c line
197,
298,
584,
729,
820,
989,
1160,
1181,
1269,
1406,
1487,
1829,
1865,
1957
Defined macros
VOFF
defined in line
64; used 16 times
- in /usr/src/bin/ld/ld.c line
778,
917,
1011,
1034,
1047,
1078,
1109,
1168,
1213,
1368,
1461,
1503,
1580,
1840,
1880,
1966
VSEG
defined in line
63; used 16 times
- in /usr/src/bin/ld/ld.c line
777,
916,
1010,
1033,
1046,
1077,
1108,
1167,
1212,
1367,
1460,
1502,
1579,
1839,
1879,
1966
s_cinfo
defined in line
48; used 18 times
- in /usr/src/bin/ld/ld.c line
777,
917,
1010,
1034,
1047,
1078,
1109,
1168,
1212,
1367,
1460,
1502,
1579,
1839,
1880,
1966
- in /usr/src/usr.lib/libvmf/vmf.c line
196,
212
Usage of this include