亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lismem.c

?? 7號信令功能代碼,為開源代碼
?? C
字號:
/*************************************************************************                        LiS Memory Interface                           ***************************************************************************									** This interface was created to insulate the Linux STREAMS programmer	** from the constantly changing memory allocation interface provided by	** the Linux kernel.							**									**    Copyright (C) 2000  David Grothe, Gcom, Inc <dave@gcom.com>	**									** This library is free software; you can redistribute it and/or		** modify it under the terms of the GNU Library General Public		** License as published by the Free Software Foundation; either		** version 2 of the License, or (at your option) any later version.	** 									** This library is distributed in the hope that it will be useful,	** but WITHOUT ANY WARRANTY; without even the implied warranty of	** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU	** Library General Public License for more details.			** 									** You should have received a copy of the GNU Library General Public	** License along with this library; if not, write to the			** Free Software Foundation, Inc., 59 Temple Place - Suite 330,		** Cambridge, MA 02139, USA.						**									*************************************************************************/#ident "@(#) LiS lismem.c 1.14 11/14/02"#include <sys/stream.h>		/* gets all the right LiS stuff included */#include <sys/lismem.h>		/* LiS mem header file */#include <sys/osif.h>		/* LiS kernel interface */#include <sys/lislocks.h>	/* for spin locks */#ifdef POISON_MEM#define CACHE_OPTS	(SLAB_POISON | SLAB_RED_ZONE)#else#define CACHE_OPTS	0#endif/*************************************************************************                         Cache Allocation                              ***************************************************************************									** These sizes are chosen to accomodate stream head structures, mblks	** and queue structures.							**									*************************************************************************/#if defined(KERNEL_2_3)typedef struct{    const char		 *name ;    kmem_cache_t	 *cache_struct ;    int			  size ;    int			  kflags ;} lis_slab_table_t ;#define	SIZE1		200		/* numeric form */#define	SIZE2		512#define SIZE3		1500#define SIZE_MAX	SIZE3#define	SIZE1S		"200"		/* string form */#define	SIZE2S		"512"#define SIZE3S		"1500"lis_slab_table_t lis_slab_table[] ={    {"LiS-Atomic-"SIZE1S, NULL, SIZE1, GFP_ATOMIC},    {"LiS-Atomic-"SIZE2S, NULL, SIZE2, GFP_ATOMIC},    {"LiS-Atomic-"SIZE3S, NULL, SIZE3, GFP_ATOMIC},    {"LiS-Kernel-"SIZE1S, NULL, SIZE1, GFP_KERNEL},    {"LiS-Kernel-"SIZE2S, NULL, SIZE2, GFP_KERNEL},    {"LiS-Kernel-"SIZE3S, NULL, SIZE3, GFP_KERNEL},    {"LiS-DMA-"SIZE1S,    NULL, SIZE1, GFP_DMA},    {"LiS-DMA-"SIZE2S,    NULL, SIZE2, GFP_DMA},    {"LiS-DMA-"SIZE3S,    NULL, SIZE3, GFP_DMA},    {NULL,                NULL, 0,     0}} ;#endif/*************************************************************************                         lismem_init                                   ***************************************************************************									** Self-initialization for memory functions.				**									*************************************************************************/#define chk_init	if (!lismem_init_flag) lis_mem_init()static int  		lismem_init_flag ;static lis_spin_lock_t	contig_lock ;		/* protect the table */void lis_mem_init(void){    lis_spin_lock_init(&contig_lock, "LiS-Page-Alloc");#if defined(KERNEL_2_3)    {	lis_slab_table_t	*p ;	for (p = lis_slab_table; p->name != NULL; p++)	{	    p->cache_struct = kmem_cache_create(p->name, p->size, 0,				SLAB_HWCACHE_ALIGN | CACHE_OPTS, NULL,NULL);	}    }#endif    lismem_init_flag = 1 ;}void lis_mem_terminate(void){#if defined(KERNEL_2_3)    lis_slab_table_t	*p ;    for (p = lis_slab_table; p->name != NULL; p++)    {	if (p->cache_struct == NULL) continue ;	kmem_cache_destroy(p->cache_struct) ;	p->cache_struct = NULL ;    }#endif}/*************************************************************************                          Page Allocation                              ***************************************************************************									** Page allocation is the way to ensure that you get memory that		** occupies physically contiguous locations.  We offer a simplified	** interface to the kernel's page allocator here.  The kernel's page	** allocation routines are awkward to use in that you have to pass	** the number of pages to de-allocate to their "free pages" routine.	**									** We keep a separate table of allocated pages.  This allows us to return** the entire page to the caller.					**									*************************************************************************/typedef struct contig_memlink{				/* 32 bytes long */    struct contig_memlink *link;/* to next entry */    void	*page_addr ;	/* addr of allocated page */    int		 size ;		/* original size in bytes */    int		 order ;	/* "order" param for freeing */    char	*file ;		/* who allocated */    int		 line ;    int		 boundary ;	/* page boundary */} contig_memlink_t ;static contig_memlink_t	*contig_mem_head ;static unsigned long	contig_bytes ;		/* total allocated */static int	alloc_page_tbl(void){    contig_memlink_t	*pg ;    contig_memlink_t	*p ;    int			 nentries ;    pg = (contig_memlink_t *) __get_free_page(GFP_KERNEL) ;    if (pg == NULL) 	return(-1) ;    memset(pg, 0, PAGE_SIZE) ;    for (p = pg, nentries = PAGE_SIZE/sizeof(*p); nentries > 0; nentries--, p++)    {	p->link = p + 1 ;    }    /*     * Link the last entry in this page to the head entry of the previous page.     * Then make this page the new head of the list.     */    pg->boundary = 1 ;			/* 1st entry is on page boundary */    lis_spin_lock(&contig_lock) ;    (p-1)->link = contig_mem_head ;	/* last entry in page */    contig_mem_head = pg ;    lis_spin_unlock(&contig_lock) ;    return(0) ;}static contig_memlink_t *find_entry(void *addr){    contig_memlink_t	*mp ;    for (mp = contig_mem_head; mp != NULL; mp = mp->link)    {	if (mp->page_addr == addr) return(mp) ;    }    return(NULL) ;			/* could not find it */}void    *lis_get_free_pages_fcn(int nbytes, int class, char *file, int line){    void		*a ;    int			 order ;    int			 bytes ;    contig_memlink_t	*mp ;    chk_init ;    for (order = 0; (bytes = (1 << order) * PAGE_SIZE) < nbytes; order++) ;    lis_spin_lock(&contig_lock) ;    mp = find_entry(NULL) ;		/* find available entry */    if (mp == NULL)    {	lis_spin_unlock(&contig_lock) ;	if (alloc_page_tbl() < 0)	    return(NULL) ;		/* can't track allocated page */	lis_spin_lock(&contig_lock) ;	mp = find_entry(NULL) ;		/* should be one now */	if (mp == NULL)			/* busted code */	{	    lis_spin_unlock(&contig_lock) ;	    printk("lis_get_free_pages: called from %s #%d: "		    "bug in allocation table code\n",		    file, line) ;	    return(NULL) ;	}    }    mp->page_addr = (void *) 0xffffffff ;/* guard from find_entry */    lis_spin_unlock(&contig_lock) ;    a =  (void *) __get_free_pages(class, order) ;	/* kernel routine */    if (a == NULL)    {	printk("lis_get_free_pages: called from %s #%d: "		"nbytes=%d order=%d total=%lu allocation failed\n",		file, line,		nbytes, order, contig_bytes) ;	return(NULL) ;    }    contig_bytes += bytes ;		/* # bytes allocated */    mp->size         = nbytes ;    mp->order        = order ;    mp->file         = file ;    mp->line         = line ;    mp->page_addr    = a ;    return(a) ;} /* lis_get_free_pages_fcn */void    *lis_get_free_pages_atomic_fcn(int nbytes, char *file, int line){    return(lis_get_free_pages_fcn(nbytes, GFP_ATOMIC, file, line)) ;}void    *lis_get_free_pages_kernel_fcn(int nbytes, char *file, int line){    return(lis_get_free_pages_fcn(nbytes, GFP_KERNEL, file, line)) ;}void     *lis_free_pages_fcn(void *ptr, char *file, int line){    contig_memlink_t	*mp ;    void		*addr ;    int			 order ;    chk_init ;    if (ptr == NULL)	return(NULL) ;    lis_spin_lock(&contig_lock) ;    mp = find_entry(ptr) ;    if (mp == NULL)			/* have no record of this page */    {	printk("lis_free_pages: called from %s #%d: "	       "cannot find page info for address 0x%lx\n",	       file, line, (long) ptr) ;	lis_spin_unlock(&contig_lock) ;	return(NULL) ;    }    addr = mp->page_addr ;    order = mp->order ;    contig_bytes -= (1 << mp->order) * PAGE_SIZE ;    mp->page_addr = NULL ;    lis_spin_unlock(&contig_lock) ;    free_pages((unsigned long) addr, order) ; /* kernel routine */    return(NULL) ;} /* lis_free_pages_fcn */void	lis_free_all_pages(void){    contig_memlink_t	*mp ;    contig_memlink_t	*boundary_ptr = NULL ;    volatile static int  freeing ;    chk_init ;    lis_spin_lock(&contig_lock) ;    if (!freeing && contig_bytes != 0)    {	freeing = 1 ;			/* only one gets to do this */	lis_spin_unlock(&contig_lock) ;	/*	 * Free the data pages allocated to callers.	 */	for (mp = contig_mem_head; mp != NULL; mp = mp->link)	{	    if (mp->page_addr == NULL || mp->page_addr == (void *)0xffffffff)		continue ;	    if (LIS_DEBUG_MEM_LEAK)		printk("lis_free_all_pages: "			  "Memory at %lx allocated from %s #%d, "			  "%d bytes leaked (recovered)\n",			  (long) mp->page_addr, mp->file, mp->line, mp->size) ;	    lis_free_pages(mp->page_addr) ;	}	/*	 * Free the pages allocated for keeping track of other pages.	 */	for (mp = contig_mem_head; mp != NULL; mp = mp->link)	{	    if (!mp->boundary) continue ;	    /* At a page boundary, remember it for freeing */	    if (boundary_ptr != NULL)		free_page((unsigned long) boundary_ptr) ;	    boundary_ptr = mp ;		/* remember for next time */	}	if (boundary_ptr != NULL)	/* catch last page */	    free_page((unsigned long) boundary_ptr) ;	contig_mem_head = NULL ;	freeing = 0 ;    }    else	lis_spin_unlock(&contig_lock) ;} /* lis_free_all_pages *//*************************************************************************                         Kernel Allocators                             ***************************************************************************									** lis_kmalloc/lis_kfree are called from lis_malloc in order to actually	** obtain the memory from the kernel.  We do this in either of two ways,	** either from an lis memory cache or from the general kmalloc.		**									*************************************************************************/#if defined(KERNEL_2_3)typedef struct{    kmem_cache_t	*slab_ptr ;    unsigned char	__pad[SMP_CACHE_BYTES			      - (sizeof(kmem_cache_t *) % SMP_CACHE_BYTES)];} mem_hdr_t ;void *lis__kmalloc(int nbytes, int class, int use_cache){    mem_hdr_t	  	*p ;    lis_slab_table_t	*tp ;    kmem_cache_t	*cp = NULL ;    nbytes += sizeof(mem_hdr_t) ;    if (!use_cache || nbytes > SIZE_MAX)	p = kmalloc(nbytes, class) ;    else    {				/* find appropriate slab */	for (tp = lis_slab_table; tp->name != NULL; tp++)	{	    if (   tp->kflags == class		&& tp->cache_struct != NULL		&& nbytes <= tp->size	       )		break ;	}	if (tp->cache_struct == NULL) return(NULL) ;	p = kmem_cache_alloc(cp = tp->cache_struct, class) ;    }    if (p == NULL) return(NULL) ;    p->slab_ptr = cp ;    return((void *)(p+1)) ;}void *lis__kfree(void *ptr){    mem_hdr_t	 *p ;    if (ptr == NULL) return(NULL) ;    p = (mem_hdr_t *) ptr ;    p-- ;    if (p->slab_ptr == NULL)	kfree(p) ;    else	kmem_cache_free(p->slab_ptr, p) ;    return(NULL) ;}#else					/* 2.2 kernel *//* * In the 2.2 kernel you can't actually free the slab allocator * cache structures.  You can only "shrink" them.  This leads to * leaving those structures allocated (somewhere) when LiS is * unloaded from memory.  Sometimes they seem to have been allocated * in memory that does not die with LiS, so that when LiS is loaded * again we get "dup entry" messages when registering the caches. * * The technique here is to just not use the dedicated caches. */void *lis__kmalloc(int nbytes, int class, int use_cache){    return(kmalloc(nbytes, class)) ;}void *lis__kfree(void *ptr){    kfree(ptr) ;    return(NULL) ;}#endif/*************************************************************************                       Calls to Kernel Routines                        ***************************************************************************									** We are really using the LiS memory allocator here so that we can	** track file and line number information.				**									*************************************************************************/void	*lis_alloc_atomic_fcn(int nbytes, char *file, int line){    return(lis_malloc(nbytes, GFP_ATOMIC, 0, file, line)) ;}void	*lis_alloc_kernel_fcn(int nbytes, char *file, int line){    return(lis_malloc(nbytes, GFP_KERNEL, 0, file, line)) ;}void	*lis_alloc_dma_fcn(int nbytes, char *file, int line){    return(lis_malloc(nbytes, GFP_DMA, 0, file, line)) ;}void	*lis_free_mem_fcn(void *mem_area, char *file, int line){    lis_free(mem_area, file, line) ;    return(NULL) ;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩久久一区| 成人毛片在线观看| 欧美日韩亚洲综合在线| 一区二区在线观看不卡| 色综合中文字幕国产| 亚洲在线免费播放| 678五月天丁香亚洲综合网| 日本欧美一区二区在线观看| 日韩一级黄色大片| 国产精品中文字幕日韩精品| 国产精品天美传媒| 91蜜桃视频在线| 亚洲成人黄色小说| 日韩小视频在线观看专区| 精品亚洲成a人| 国产精品久久777777| 91色视频在线| 日韩专区在线视频| 欧美精品一区二区三区很污很色的| 久久av中文字幕片| 亚洲欧洲av另类| 欧美日韩www| 丁香天五香天堂综合| 亚洲女厕所小便bbb| 欧美一区午夜精品| 国产成人久久精品77777最新版本| 午夜精品久久久久久久久久久| 日韩一二三四区| bt欧美亚洲午夜电影天堂| 亚洲一区二区三区在线| 日韩欧美在线网站| 9色porny自拍视频一区二区| 午夜精品福利久久久| 国产日本欧洲亚洲| 欧美日韩二区三区| 成人激情黄色小说| 男女激情视频一区| 夜夜夜精品看看| 国产亚洲欧美日韩日本| 欧美日韩午夜在线视频| 国产成人精品三级麻豆| 午夜精品一区二区三区免费视频 | 免费高清不卡av| 日本一区二区视频在线| 欧美高清www午色夜在线视频| 成人久久18免费网站麻豆| 日日夜夜免费精品| 亚洲视频图片小说| 国产午夜亚洲精品理论片色戒 | 成人综合婷婷国产精品久久 | 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品伦一区| 欧美zozo另类异族| 欧美性videosxxxxx| 成人免费高清视频在线观看| 久国产精品韩国三级视频| 亚洲成av人**亚洲成av**| 综合在线观看色| 国产午夜亚洲精品午夜鲁丝片| 欧美一级生活片| 欧美日韩精品电影| 色综合天天综合| 成人丝袜高跟foot| 国产馆精品极品| 激情综合网天天干| 奇米一区二区三区av| 午夜婷婷国产麻豆精品| 亚洲欧美综合色| 亚洲欧洲在线观看av| 国产精品久久久久久亚洲伦| 国产婷婷精品av在线| 久久中文娱乐网| 26uuu亚洲综合色| 精品成a人在线观看| 日韩三级精品电影久久久| 欧美日韩久久久久久| 在线区一区二视频| 91福利视频久久久久| 色悠悠亚洲一区二区| 国产亚洲1区2区3区| 精品国产免费久久| 欧美tk丨vk视频| 精品国产乱码久久久久久牛牛| 欧美一卡2卡三卡4卡5免费| 91精品国产手机| 日韩一区二区免费在线电影| 精品精品欲导航| 久久久精品国产免费观看同学| 久久久国产精品午夜一区ai换脸| 国产日韩欧美麻豆| 国产精品对白交换视频 | 男女性色大片免费观看一区二区| 男女视频一区二区| 国产一区 二区 三区一级| 国产精品99久久久久| 成人av电影在线| 91亚洲资源网| 欧美高清视频www夜色资源网| 日韩三级中文字幕| 国产日产欧美一区二区三区| 中文字幕一区av| 亚洲高清不卡在线| 久久成人18免费观看| 国产v日产∨综合v精品视频| 91丨porny丨在线| 制服丝袜日韩国产| 久久精品在线免费观看| √…a在线天堂一区| 亚洲成人黄色小说| 国产酒店精品激情| 91蜜桃传媒精品久久久一区二区| 欧美日本精品一区二区三区| 亚洲老妇xxxxxx| 日韩主播视频在线| 成人一区二区三区视频| 日本高清不卡在线观看| 欧美成va人片在线观看| 18欧美亚洲精品| 日本午夜精品视频在线观看 | 国产精品国产三级国产普通话蜜臀 | 亚洲成人动漫一区| 国产一区啦啦啦在线观看| 91免费观看在线| 日韩一级二级三级精品视频| 综合久久久久久| 精品一区中文字幕| 色噜噜夜夜夜综合网| 欧美不卡视频一区| 亚洲国产综合91精品麻豆| 国产精品小仙女| 正在播放亚洲一区| 亚洲欧美经典视频| 国产一区二区女| 欧美色图第一页| 亚洲欧美在线视频| 精品一区二区三区的国产在线播放| 色综合久久久久网| 久久久久国产精品免费免费搜索| 亚洲国产精品综合小说图片区| 成人精品视频一区二区三区尤物| 欧美一区二区精美| 亚洲午夜久久久久| av成人免费在线观看| 精品国产伦一区二区三区观看体验 | 色综合视频在线观看| 2017欧美狠狠色| 午夜精品成人在线| 在线观看视频一区二区欧美日韩| 国产日产欧美一区| 国产一区二区三区久久久 | 国产精品伦一区二区三级视频| 久久se精品一区精品二区| 欧美揉bbbbb揉bbbbb| 亚洲另类色综合网站| 99久久精品国产毛片| 国产日韩欧美综合在线| 国产在线精品一区二区不卡了| 欧美成人性战久久| 日韩精品亚洲一区二区三区免费| 在线观看免费一区| 一区二区三区成人| 一本大道久久a久久精二百| 国产精品国产自产拍在线| 国产盗摄一区二区| 久久久99精品免费观看| 国产毛片一区二区| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 捆绑调教一区二区三区| 91精品视频网| 老司机精品视频在线| 日韩免费在线观看| 蜜桃91丨九色丨蝌蚪91桃色| 91精品国产欧美一区二区18| 强制捆绑调教一区二区| 91精品蜜臀在线一区尤物| 日本vs亚洲vs韩国一区三区二区| 欧美蜜桃一区二区三区| 石原莉奈在线亚洲三区| 欧美一级日韩一级| 精品伊人久久久久7777人| 337p粉嫩大胆噜噜噜噜噜91av| 国产大片一区二区| 日韩一区在线播放| 色综合久久综合| 亚洲一区国产视频| 日韩区在线观看| 国产成人午夜精品影院观看视频 | 99久久99久久精品免费观看 | 久久精品一区二区三区不卡| 国产精品88888| 亚洲欧洲成人精品av97| 欧美性一级生活| 日日夜夜免费精品| 久久先锋影音av| 91视频一区二区| 日韩精品免费视频人成| 久久日一线二线三线suv| 成人不卡免费av| 一区二区三区精品视频| 日韩精品一区二区三区视频播放|