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;
/*µÈ´ýÖ¸¶
Ïà¹ØÎĵµ£º
LinuxÉϹ¹ÖþiPhone OS3.1.2¿ª·¢»·¾³´î½¨
½Ì³ÌµØÖ·£º http://www.yifeiyang.net/iphone-development-introduction-3-linux-development-environment-on-the-build-iphone-os3-1-2/
#µÚÒ»²½Ã»ÓÐʲôÎÊÌâ
$ ./toolchain.sh headers
#µÚ¶þ²½Ò²Ë³Àûͨ¹ý
$ ./toolchain.sh firmware
#µÚÈý²½Ò²Í¦Ë³Àû
$ ./toolchain ......
ѹËõºÍ´ò°üÎļþ
¡¡¡¡* .bz2 — ʹÓÃbzip2ÃüÁîѹËõµÄÎļþ£¬¿ÉÒÔʹÓÃbzip2 -d filename ½â°ü
¡¡¡¡* .gz — ʹÓÃgzipÃüÁîѹËõµÄÎļþ£¬¿ÉÒÔʹÓÃgunzip -d filename ½â°ü
¡¡¡¡* .tar — ʹÓÃtar´ò°üµÄÎļþ£¬¼´tarballÎļþ£¬¿ÉÒÔʹÓÃtar xf filename ½â°ü
¡¡¡¡* .tbz — ʹÓÃtar´òÍê°üºóÔÙÒÔbzip2ÃüÁ ......
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH&nbs ......
/*
* ¸ÃÎļþÖ÷ҪʵÏÖµÄÊÇtruncateº¯Êý£¬¸Ãº¯ÊýÊÇÊÍ·ÅÖ¸¶¨i
* ½ÚµãÔÚÉ豸ÉÏÕ¼ÓõÄËùÓÐÂß¼¿é£¬°üÀ¨Ö±½Ó¿é¡¢Ò»´Î¼ä
* ½Ó¿éºÍ¶þ´Î¼ä½Ó¿é
*/
/*
* linux/fs/truncate.c
*
* (C) 1991 Linus Torvalds
*/
#include <linux/sched.h>
......