linux 0.11 ÄÚºËѧϰ buffer.c
/*
* buffer.c ³ÌÐòÓÃÓÚ¶Ô¸ßËÙ»º³åÇø(³Ø)½øÐвÙ×÷ºÍ¹ÜÀí¡£¸ßËÙ»º³å
* ÇøÎ»ÓÚÄں˴úÂëºÍÖ÷ÄÚ´æÇøÖ®¼ä¡£
*
* |---|---|------------------|---------------------|-------------------|
* | | | * * * | buffer | |
* |---|---|------------------|---------------------|-------------------|
* | /|\
* |------------------------------------|
* \|/
* buffer_head (list)
*/
/*
* linux/fs/buffer.c
*
* (C) 1991 Linus Torvalds
*/
/*
* 'buffer.c' implements the buffer-cache functions. Race-conditions have
* been avoided by NEVER letting a interrupt change a buffer (except for the
* data, of course), but instead letting the caller do it. NOTE! As interrupts
* can wake up a caller, some cli-sti sequences are needed to check for
* sleep-on-calls. These should be extremely quick, though (I hope).
*/
/*
* NOTE! There is one discordant note here: checking floppies for
* disk change. This is where it fits best, I think, as it should
* invalidate changed floppy-disk-caches.
*/
#include <stdarg.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/io.h>
extern int end; // ÓÉÁ¬½Ó³ÌÐòld Éú³ÉµÄ±íÃ÷³ÌÐòÄ©¶ËµÄ±äÁ¿£¬´ú±íµÄÊÇÒ»¸öÄÚ´æµØÖ·
struct buffer_head * start_buffer = (struct buffer_head *) &end;
struct buffer_head * hash_table[NR_HASH];
static struct buffer_head * free_list;
static struct task_struct * buffer_wait = NULL;
int NR_BUFFERS = 0;
/*µÈ´ýÖ¸¶
Ïà¹ØÎĵµ£º
×ܽáÕ½ڣºµÚÈý½Ú ×Ö·ûÉ豸Çý¶¯
ÕâÒ»ÕÂÖ÷ÒªÊǽ²Ò»Ð©×Ö·ûÉ豸Çý¶¯³ÌÐòµÄÏà¹ØÖªÊ¶¡£ÔÚ½øÐÐ×Ö·ûÉ豸Çý¶¯³ÌÐòѧϰ֮ǰ£¬ÎÒÃDZØÐëµÃŪÃ÷°×Ò»¸öÎÊÌ⣺Çý¶¯³ÌÐòʱ¸øËÓõġ£
ºÜ¶àÇý¶¯³ÌÐòµÄ³õѧÕߣ¬°´ÕÕÒ»°ã±à³ÌÓïÑÔ£¨C£¬javaµÈµÈ£©±àдӦÓóÌÐòµÄ¾Ñ飬º¯Êý¾ÍÊÇÓÃÀ´µ÷Óõġ£ÕâÖÖµ÷ÓùØÏµ£¬ÔÚÓ¦ÓÿռäÀ´¿´£¬ÏÞÖÆ²»ÊǺÜÃ÷ÏÔ¡£ºÜ¶à ......
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH&nbs ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
ÔÚÏÖʵÉú»îÖб»ÈËÃdzÆÎª´óʦ¼¶µÄÈËÎïȷʵºÜÉÙ¼û¡£
Brian
Proffitt
ÏÈÉú¾ÍÊÇһλȫÇòÖªÃû¡¢ÊÜÈË×ð¾´µÄ
Linux
´óʦ¡£´ËÑÔÓкθù¾Ý£¿½üÈÕ£¬ËûÏòÎÒÃÇÍÆ¼öÁËʲô£¿
......
×ªÔØÊ±Çë×¢Ã÷³ö´¦ºÍ×÷ÕßÁªÏµ·½Ê½
ÎÄÕ³ö´¦£ºhttp://www.limodev.cn/blog
×÷ÕßÁªÏµ·½Ê½£ºÀîÏȾ² <xianjimli at hotmail dot com>
Ëæ×ÅXPµÄÁ÷ÐУ¬ÈËÃÇÔ½À´Ô½×¢ÖØÈí¼þµÄǰÆÚÉè¼Æ¡¢ºóÆÚµÄʵÏÖ£¬ÒÔ¼°¹á´©ÓÚÆäÖеIJâÊÔ¹¤×÷£¬¾¹ýÕâ¸ö¹ý³Ì³öÀ´µÄ×ÔÈ»ÊǸßÖÊÁ¿µÄÈí¼þ¡£ÉõÖÁÓÐÈËÉù³ÆXP»áÌÔ̵÷ÊÔÆ÷£¡Õ⵱ȻÊÇÓÐÒ»¶¨µÀÀíµÄ£¬È ......