home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / vm / seg_vn.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.7 KB  |  112 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. /*
  11.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12.  *         PROPRIETARY NOTICE (Combined)
  13.  * 
  14.  * This source code is unpublished proprietary information
  15.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  16.  * In addition, portions of such source code were derived from Berkeley
  17.  * 4.3 BSD under license from the Regents of the University of
  18.  * California.
  19.  * 
  20.  * 
  21.  * 
  22.  *         Copyright Notice 
  23.  * 
  24.  * Notice of copyright on this source code product does not indicate 
  25.  * publication.
  26.  * 
  27.  *     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  28.  *     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  29.  *               All rights reserved.
  30.  *  
  31.  */
  32.  
  33. #ifndef _VM_SEG_VN_H
  34. #define _VM_SEG_VN_H
  35.  
  36. #ident    "@(#)/usr/include/vm/seg_vn.h.sl 1.1 4.0 12/08/90 63152 AT&T-USL"
  37.  
  38. #include "vm/mp.h"
  39.  
  40. /*
  41.  * A pointer to this structure is passed to segvn_create().
  42.  */
  43. struct segvn_crargs {
  44.     struct    vnode *vp;    /* vnode mapped from */
  45.     u_int    offset;        /* starting offset of vnode for mapping */
  46.     struct    cred *cred;    /* credentials */
  47.     u_char    type;        /* type of sharing done */
  48.     u_char    prot;        /* protections */
  49.     u_char    maxprot;    /* maximum protections */
  50.     struct    anon_map *amp;    /* anon mapping to map to */
  51. };
  52.  
  53. /*
  54.  * The anon_map structure is used by the seg_vn driver to manage
  55.  * unnamed (anonymous) memory.   When anonymous memory is shared,
  56.  * then the different segvn_data structures will point to the
  57.  * same anon_map structure.  Also, if a segment is unmapped
  58.  * in the middle where an anon_map structure exists, the
  59.  * newly created segment will also share the anon_map structure,
  60.  * although the two segments will use different ranges of the
  61.  * anon array.  When mappings are private (or shared with
  62.  * a reference count of 1), an unmap operation will free up
  63.  * a range of anon slots in the array given by the anon_map
  64.  * structure.  Because of fragmentation due to this unmapping,
  65.  * we have to store the size of the anon array in the anon_map
  66.  * structure so that we can free everything when the referernce
  67.  * count goes to zero.
  68.  */
  69. struct anon_map {
  70.     u_int    refcnt;        /* reference count on this structure */
  71.     u_int    size;        /* size in bytes mapped by the anon array */
  72.     struct    anon **anon;    /* pointer to an array of anon * pointers */
  73.     u_int    swresv;        /* swap space reserved for this anon_map */
  74. };
  75.  
  76. /*
  77.  * (Semi) private data maintained by the seg_vn driver per segment mapping.
  78.  */
  79. struct    segvn_data {
  80.     mon_t    lock;
  81.     u_char    pageprot;    /* true if per page protections present */
  82.     u_char    prot;        /* current segment prot if pageprot == 0 */
  83.     u_char    maxprot;    /* maximum segment protections */
  84.     u_char    type;        /* type of sharing done */
  85.     struct    vnode *vp;    /* vnode that segment mapping is to */
  86.     u_int    offset;        /* starting offset of vnode for mapping */
  87.     u_int    anon_index;    /* starting index into anon_map anon array */
  88.     struct    anon_map *amp;    /* pointer to anon share structure, if needed */
  89.     struct    vpage *vpage;    /* per-page information, if needed */
  90.     struct    cred *cred;    /* mapping credentials */
  91.     u_int    swresv;        /* swap space reserved for this segment */
  92. };
  93.  
  94. #ifdef _KERNEL
  95.  
  96. #if defined(__STDC__)
  97. extern int segvn_create(struct seg *, void *);
  98. #else
  99. extern int segvn_create();
  100. #endif
  101.  
  102. extern    struct seg_ops segvn_ops;
  103.  
  104. /*
  105.  * Provided as shorthand for creating user zfod segments.
  106.  */
  107. extern    caddr_t zfod_argsp;
  108. extern    caddr_t kzfod_argsp;
  109. #endif /* _KERNEL */
  110.  
  111. #endif    /* _VM_SEG_VN_H */
  112.