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 ......
ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ»®
ARM+LINUX·Ïߣ¬Ö÷¹¥Ç¶ÈëʽLinux²Ù×÷ϵͳ¼°ÆäÉÏÓ¦ÓÃÈí¼þ¿ª·¢Ä¿±ê£º
£¨1£© ÕÆÎÕÖ÷Á÷ǶÈëʽ΢´¦ÀíÆ÷µÄ½á¹¹ÓëÔÀí£¨³õ²½¶¨Îªarm9£©
£¨2£© ±ØÐëÕÆÎÕÒ»¸öǶÈëʽ²Ù×÷ϵͳ £¨³õ²½¶¨Îªuclinux»òlinux,°æ±¾´ý¶¨£©
£¨3£© ±ØÐëÊìϤǶÈëʽÈí¼þ¿ª·¢Á÷³Ì²¢ÖÁÉÙ×öÒ ......
#include
#include
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
void *thread1(void *);
void *thread2(void *);
int i=1;
main(void)
{
pthread_t t_a;
pthread_t t_b;
pthread_create(&t_a,NULL,thread1,(void *)NULL) ......
×ܽáÕ½ڣºµÚÒ»Õ É豸Çý¶¯³ÌÐò¼ò½é
µÚ¶þÕ ¹¹ÔìºÍÔËÐÐÄ£¿é
Ìáµ½Çý¶¯³ÌÐò¾Í²»µÃ²»ÏÈ˵ÏÂÁ½¸öÃû´Ê£ºÄں˿ռäºÍÓû§¿Õ¼ä¡£Óû§¿Õ¼ä¼´Óû§Ó¦ÓÃËùÔËÐеĿռ䣬Äں˿ռäÖµµÃÊDzÙ×÷ϵͳÄÚºËÔËÐеĿռ䡣Óû§¿Õ¼ä²»ÄÜÖ±½ÓÒýÓûòÕß²Ù×÷Äں˿ռäµÄÊý¾Ý£¬Äں˿ռäÒ²²»ÄÜÖ±½ ......
LinuxÄÚºËÅäÖð취£º
1. make config
ÕâÖÖ°ì·¨»á±éÀúËùÓÐÅäÖÃÏҪÇóÓû§Öð¸öÑ¡ÔñY/N/M
2. make menuconfig
Õâ¸ö°ì·¨ÊÇ»ùÓÚncurse¿â±àÖƵÄͼÐνçÃ湤¾ß¡£³£ÓÃ
3. make xconfig
ÓÃÓÚ»ùÓÚX11µÄͼÐι¤¾ß
4. make gconfig
ÓÃÓÚ»ùÓÚgtk+ͼÐι¤¾ß
5. make defconfig
´´½¨Ò»¸öĬÈϵÄÅäÖã¬Éú³Éµ±Ç°µÄ.config
6. make x ......