Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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¹âÅÌ×öyumÔ´

Yum£¨È«³ÆΪ Yellow dog Updater, Modified£©ÊÇÒ»¸öÔÚFedoraÖеÄshellÇ°¶ËÈí¼þ°ü¹ÜÀíÆ÷¡£»ùÓÚrpm°ü¹ÜÀí£¬Äܹ»´ÓÖ¸¶¨µÄ·þÎñÆ÷×Ô¶¯ÏÂÔØRPM°ü²¢ÇÒ°²×°£¬¿ÉÒÔ×Ô¶¯´¦ÀíÒÀÀµÐÔ¹Øϵ£¬²¢ÇÒÒ»´Î°²×°ËùÓÐÒÀÀµµÄÈíÌå°ü£¬ÎÞÐë·±ËöµØÒ»´Î´ÎÏÂÔØ¡¢°²×°¡£
ÏÂÃæ½éÉÜÒ»¸ö´Ó¹âÅÌ×öyumÔ´µÄСʵÑé
±¾ÊÔÑéʹÓÃCentOS-5.4-i386-bin,DVD.isoÈí¼þ° ......

LinuxÉϹ¹ÖþiPhone OS3.1.2¿ª·¢»·¾³Ö®½âѹfirmware


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ϳ£ÓÃCÓïÑÔ×Ö·û´®²Ù×÷º¯Êý

stroul£¬
strdup
snprintf()
atio
 
CÖг£ÓÃ×Ö·û´®²Ù×÷º¯Êý
#include <string.h>
 
size_t strlen(const char *s)   ²âÁ¿×Ö·û´®³¤¶ÈsµÄʵ¼Ê³¤¶È¡£
ÀýÈçs[20]="abc",ÄÇôstrlen(s)µÄ½á¹ûÊÇ3£¬¶ø²»ÊÇ20.Õâ¾ÍÊÇʵ¼Ê³¤¶È
 
char *strcat(const char *s1, const *s2)  ......

Linux ÄÚºËÅäÖÃ

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 ......

linux 0.11 ÄÚºËѧϰ read_write.c


/*
 * ¸ÃÎļþʵÏÖϵͳµ÷ÓÃread£¬writeºÍlseek¡£
 */
/*
 *  linux/fs/read_write.c
 *
 *  (C) 1991  Linus Torvalds
 */
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <linux/kernel.h>
#include < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ