proclist.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 91 行

H
91
字号
/* * linux/arch/arm/mach-omap/dsp/proclist.h * * Linux task list handler * * Copyright (C) 2004 Nokia Corporation * * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: proclist.h * $Revision: 3.0.1 * $Date: 2004/06/29 * */struct proc_list {	struct list_head list_head;	struct task_struct *tsk;	unsigned int cnt;};static __inline__ void proc_list_add(struct list_head *list,				     struct task_struct *tsk){	struct list_head *ptr;	struct proc_list *new;	preempt_disable();	list_for_each(ptr, list) {		struct proc_list *pl = (struct proc_list *)ptr;		if (pl->tsk == tsk) {			/*			 * this process has opened DSP devices multi time			 */			pl->cnt++;			goto done;		}	}	new = kmalloc(sizeof(struct proc_list), GFP_KERNEL);	new->tsk = tsk;	new->cnt = 1;	list_add_tail((struct list_head *)new, list);done:	preempt_enable();}static __inline__ void proc_list_del(struct list_head *list,				     struct task_struct *tsk){	struct list_head *ptr;	preempt_disable();	list_for_each(ptr, list) {		struct proc_list *pl = (struct proc_list *)ptr;		if (pl->tsk == tsk) {			if (--pl->cnt == 0) {				list_del(ptr);				kfree(ptr);			}			break;		}	}	preempt_enable();}static __inline__ void proc_list_flush(struct list_head *list){	preempt_disable();	while (!list_empty(list)) {		struct list_head *ptr = list->next;		list_del(ptr);		kfree(ptr);	}	preempt_enable();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?