The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/blist.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: blist.h,v 1.7 2005/12/11 12:25:20 christos Exp $       */
    2 
    3 /*-
    4  * Copyright (c) 1998 Matthew Dillon.  All Rights Reserved.
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   18  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   23  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28  */
   29 
   30 /*
   31  * Implements bitmap resource lists.
   32  *
   33  *      Usage:
   34  *              blist = blist_create(blocks)
   35  *              (void)  blist_destroy(blist)
   36  *              blkno = blist_alloc(blist, count)
   37  *              (void)  blist_free(blist, blkno, count)
   38  *              nblks = blist_fill(blist, blkno, count)
   39  *              (void)  blist_resize(&blist, count, freeextra)
   40  *              
   41  *
   42  *      Notes:
   43  *              on creation, the entire list is marked reserved.  You should
   44  *              first blist_free() the sections you want to make available
   45  *              for allocation before doing general blist_alloc()/free()
   46  *              ops.
   47  *
   48  *              BLIST_NONE is returned on failure.  This module is typically
   49  *              capable of managing up to (2^31) blocks per blist, though
   50  *              the memory utilization would be insane if you actually did
   51  *              that.  Managing something like 512MB worth of 4K blocks 
   52  *              eats around 32 KBytes of memory. 
   53  *
   54  * $FreeBSD: src/sys/sys/blist.h,v 1.9 2005/01/07 02:29:23 imp Exp $
   55  */
   56 
   57 #ifndef _SYS_BLIST_H_
   58 #define _SYS_BLIST_H_
   59 
   60 /*
   61  * for space efficiency, sizeof(blist_bitmap_t) should be
   62  * greater than or equal to sizeof(blist_blkno_t).
   63  */
   64 
   65 typedef uint32_t blist_bitmap_t;
   66 typedef uint32_t blist_blkno_t;
   67 
   68 /*
   69  * note: currently use BLIST_NONE as an absolute value rather then 
   70  * a flag bit.
   71  */
   72 
   73 #define BLIST_NONE      ((blist_blkno_t)-1)
   74 
   75 typedef struct blist *blist_t;
   76 
   77 #define BLIST_BMAP_RADIX        (sizeof(blist_bitmap_t)*8)
   78 #define BLIST_MAX_ALLOC         BLIST_BMAP_RADIX
   79 
   80 extern blist_t blist_create(blist_blkno_t blocks);
   81 extern void blist_destroy(blist_t blist);
   82 extern blist_blkno_t blist_alloc(blist_t blist, blist_blkno_t count);
   83 extern void blist_free(blist_t blist, blist_blkno_t blkno, blist_blkno_t count);
   84 extern blist_blkno_t blist_fill(blist_t bl, blist_blkno_t blkno,
   85     blist_blkno_t count);
   86 extern void blist_print(blist_t blist);
   87 extern void blist_resize(blist_t *pblist, blist_blkno_t count, int freenew);
   88 
   89 #endif  /* _SYS_BLIST_H_ */
   90 

Cache object: 77ba360d38b0a26a096f92a9d71c196c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.