home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / swap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.4 KB  |  170 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. #ifndef _SYS_SWAP_H
  11. #define _SYS_SWAP_H
  12.  
  13. #ident    "@(#)/usr/include/sys/swap.h.sl 1.1 4.0 12/08/90 3342 AT&T-USL"
  14.  
  15. /*
  16.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17.  *         PROPRIETARY NOTICE (Combined)
  18.  * 
  19.  * This source code is unpublished proprietary information
  20.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  21.  * In addition, portions of such source code were derived from Berkeley
  22.  * 4.3 BSD under license from the Regents of the University of
  23.  * California.
  24.  * 
  25.  * 
  26.  * 
  27.  *         Copyright Notice 
  28.  * 
  29.  * Notice of copyright on this source code product does not indicate 
  30.  * publication.
  31.  * 
  32.  *     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  33.  *     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  34.  *               All rights reserved.
  35.  *  
  36.  */
  37.  
  38. /* The following are for the swapctl system call */
  39.  
  40. #define    SC_ADD        1    /* add a specified resource for swapping */
  41. #define    SC_LIST        2    /* list all the swapping resources */
  42. #define    SC_REMOVE    3    /* remove the specified swapping resource */
  43. #define SC_GETNSWP    4    /* get number of swapping resources configued */
  44.  
  45. typedef struct swapres {
  46.     char    *sr_name;    /* pathname of the resource specified */
  47.     off_t    sr_start;    /* starting offset of the swapping resource */
  48.     off_t     sr_length;    /* length of the swap area */
  49. } swapres_t;
  50.  
  51. typedef struct swapent {
  52.     char     *ste_path;    /* get the name of the swap file */
  53.     off_t    ste_start;    /* starting block for swapping */
  54.     off_t    ste_length;    /* length of swap area */
  55.     long    ste_pages;    /* numbers of pages for swapping */
  56.     long    ste_free;    /* numbers of ste_pages free */
  57.     long    ste_flags;    /* see below */
  58. } swapent_t;
  59.  
  60. /* ste_flags values */
  61.  
  62. #define    ST_INDEL    0x01        /* this file is in the process */
  63.                     /* of being deleted. Don't     */
  64.                     /* allocate from it. This can  */
  65.                     /* be turned of by swapadd'ing */
  66.                     /* this device again.          */
  67. #define    ST_DOINGDEL    0x02        /* this file is in the process */
  68.                     /* of being deleted. Fail      */
  69.                     /* another deletion attempt    */
  70.                     /* if this flag is on.         */
  71. #define    ST_DELETED    0x04        /* this file has been deleted  */
  72.                     /* but the data structures have*/
  73.                     /* not been freed up yet.      */
  74.  
  75. typedef struct    swaptable {
  76.     int    swt_n;            /*number of swapents following */
  77.     struct    swapent    swt_ent[1];    /* array of swt_n swapents */
  78. } swaptbl_t;
  79.  
  80.  
  81. /* obsolete sys3b system call structures */
  82.  
  83. typedef struct swapint {
  84.     char    si_cmd;        /* One of the command codes    */
  85.                 /* listed below.        */
  86.     char    *si_buf;    /* For an SI_LIST function, this*/
  87.                 /* is a pointer to a buffer of    */
  88.                 /* sizeof(swpt_t)*MSFILES bytes.*/
  89.                 /* For the other cases, it is a    */
  90.                 /* pointer to a pathname of a    */
  91.                 /* swap file.            */
  92.     int    si_swplo;    /* The first block number of the*/
  93.                 /* swap file.  Used only for    */
  94.                 /* SI_ADD and SI_DEL.        */
  95.     int    si_nblks;    /* The size of the swap file in    */
  96.                 /* blocks.  Used only for an    */
  97.                 /* SI_ADD request.        */
  98. } swpi_t;
  99.  
  100. /*    The following are the possible values for si_cmd. */
  101.  
  102. #define    SI_LIST        0    /* List the currently active    */
  103.                 /* swap files.            */
  104. #define    SI_ADD        1    /* Add a new swap file.        */
  105. #define    SI_DEL        2    /* Delete one of the currently    */
  106.                 /* active swap files.        */
  107.  
  108.  
  109. /*
  110.  * The following structure contains the data describing a swap file
  111.  * that is returned by the SI_LIST command.  
  112.  */
  113.  
  114. typedef struct swaptab {
  115.     o_dev_t        st_dev;        /* The swap device.        */
  116.     short        st_flags;    /* Flags defined below.        */
  117.     use_t        st_ucnt;    /* in use flag for compatibility*/
  118.     int        pad1;        /* use_t    *st_next;    */
  119.     int        st_swplo;    /* First block number on device    */
  120.                     /* to be used for swapping.    */
  121.     int        st_npgs;    /* Number of pages of swap    */
  122.                     /* space on device.        */
  123.     int        st_nfpgs;    /* Nbr of free pages on device.    */
  124.     int        pad2;        /* struct vnode    *st_vp;        */
  125.     int        pad3;        /* Round size to 2^n.        */
  126. } swpt_t;
  127.  
  128. #ifdef _KERNEL
  129. /*
  130.  * VM - virtual swap device.
  131.  */
  132.  
  133. struct    swapinfo {
  134.     struct    vnode *si_vp;        /* vnode for this swap device */
  135.     struct    vnode *si_svp;        /* svnode for this swap device */
  136.     uint    si_soff;        /* starting offset (bytes) of file */
  137.     uint    si_eoff;        /* ending offset (bytes) of file */
  138.     struct    anon *si_anon;        /* pointer to anon array */
  139.     struct    anon *si_eanon;        /* pointer to end of anon array */
  140.     struct    anon *si_free;        /* anon free list for this vp */
  141.     int    si_allocs;        /* # of conseq. allocs from this area */
  142.     struct    swapinfo *si_next;    /* next swap area */
  143.     short    si_flags;        /* flags defined below */
  144.     ulong    si_npgs;        /* number of pages of swap space */
  145.     ulong    si_nfpgs;        /* number of free pages of swap space */
  146.     char     *si_pname;        /* swap file name */
  147. };
  148.  
  149. #define    IS_SWAPVP(vp)    (((vp)->v_flag & VISSWAP) != 0)
  150.  
  151. #if defined(__STDC__)
  152. extern int swapfunc(swpi_t *);
  153. extern int swap_init(struct vnode *);
  154. extern void swap_free(struct anon *);
  155. extern void swap_xlate(struct anon *, struct vnode **, uint *);
  156. extern struct anon *swap_alloc(void);
  157. extern struct anon *swap_anon(struct vnode *, uint);
  158. #else
  159. extern int swapfunc();
  160. extern int swap_init();
  161. extern void swap_free();
  162. extern void swap_xlate();
  163. extern struct anon *swap_alloc();
  164. extern struct anon *swap_anon();
  165. #endif    /* __STDC__ */
  166.  
  167. #endif    /* _KERNEL */
  168.  
  169. #endif    /* _SYS_SWAP_H */
  170.