Linux¿éÉ豸Çý¶¯(1) ¿éÇý¶¯ÖÐÏà¹ØµÄ½á¹¹Ìå¼°Æä²Ù×÷
1.×Ö·ûÉ豸Óë¿éÉ豸IO²Ù×öµÄÇø±ð
1)¿éÉ豸ֻÄÜÒÔ¿éΪµ¥Î»½ÓÊÕÊäÈë·µ»ØÊä³ö,¶ø×Ö·ûÉ豸ÔòÒÔbyteΪµ¥Î».´ó¶àÊýÉ豸ÊÇ×Ö·ûÉ豸,ËûÃDz»ÐèÒª»º³å²¢ÇÒ²»ÒԹ̶¨¿é´óС½øÐвÙ×÷.
2)¿éÉ豸¶ÔÓÚIOÇëÇóÓжÔÓ¦µÄ»º³åÇø,ËùÒÔËûÃÇ¿ÉÒÔÑ¡ÔñÒÔʲô˳Ðò½øÐÐÏìÓ¦.×Ö·ûÉ豸ÎÞÐ뻺³åÇÒ±»Ö±½Ó¶Áд.
3)×Ö·ûÉ豸ֻÄܱ»Ë³Ðò¶Áд,¿éÉ豸¿ÉÒÔËæ»ú·ÃÎÊ.
2.block_device_operations½á¹¹Ìå
block_device_operationsÃèÊöÁ˶ԿéÉ豸µÄ²Ù×÷µÄ¼¯ºÏ
struct block_device_operations {
int (*open) (struct inode *, struct file *);/*´ò¿ª*/
int (*release) (struct inode *, struct file *);/*ÊÍ·Å*/
int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
long (*compat_ioctl) (struct file *, unsigned, unsigned long);
int (*direct_access) (struct block_device *, sector_t, unsigned long *);
int (*media_changed) (struct gendisk *);/*½éÖʱ»¸Ä±ä?*/
int (*revalidate_disk) (struct gendisk *);/*ʹ½éÖʸıä*/
int (*getgeo)(struct block_device *, struct hd_geometry *);/*Ìî³äÇý¶¯Æ÷ÐÅÏ¢*/
struct module *owner;/*Ä£¿éÓµÓÐÕß,Ò»°ã³õʼ»¯ÎªTHIS_MODULE*/
};
¹ØÓÚblock_device_operationsµÄ²Ù×÷:
&nb
Ïà¹ØÎĵµ£º
ÂÜÀòÊÀ½ç ¸úÄúÒ»Æð¿´ÊÀ½ç http://lolier.info/ FTP>ascii: É趨ÒÔASCII·½Ê½´«ËÍÎļþ(ȱʡֵ) FTP>bell: ÿÍê³ÉÒ»´ÎÎļþ´«ËÍ,±¨¾¯Ìáʾ. FTP>binary: É趨ÒÔ¶þ½øÖÆ·½Ê½´«ËÍÎļþ. FTP>bye: ÖÕÖ¹Ö÷»úFTP½ø³Ì,²¢Í˳öFTP¹ÜÀí·½Ê½. FTP>case: µ±ÎªONʱ,ÓÃMGETÃüÁ±´µÄÎļþÃûµ½±¾µØ»úÆ÷ÖÐ,È«²¿×ª»»ÎªÐ¡Ð´×Öĸ. FTP>cd: ͬUNIXµÄCD ......
linuxÏÂÌí¼Ó·Óɵķ½·¨£º
Ò»£ºÊ¹Óà route ÃüÁîÌí¼Ó
ʹÓÃroute ÃüÁîÌí¼ÓµÄ·ÓÉ£¬»úÆ÷ÖØÆô»òÕßÍø¿¨ÖØÆôºó·ÓɾÍʧЧÁË£¬·½·¨£º
//Ìí¼Óµ½Ö÷»úµÄ·ÓÉ
# route add –host 192.168.168.110 dev eth0
# route add –host 192.168.168.119 gw 192.168.168.1
//Ìí¼Óµ½ÍøÂçµÄ·ÓÉ
# route add –net IP netma ......
¹¦ÄÜ˵Ã÷£º.bz2ÎļþµÄѹËõ³ÌÐò¡£
Óï¡¡¡¡·¨£ºbzip2 [-cdfhkLstvVz][--repetitive-best][--repetitive-fast][- ѹËõµÈ¼¶][ҪѹËõµÄÎļþ]
²¹³ä˵Ã÷£ºbzip2²ÉÓÃеÄѹËõÑÝËã·¨£¬Ñ¹ËõЧ¹û±È´«Í³µÄLZ77/LZ78ѹËõÑÝËã·¨À´µÃºÃ¡£ÈôûÓмÓÉÏÈκβÎÊý£¬bzip2ѹËõÍêÎļþºó»á²úÉú.bz2µÄѹËõÎļþ£¬²¢É¾³ýÔʼµÄÎļþ¡£
²Î¡¡¡¡Êý£º
¡¡- ......
¼øÓÚÖ§¸¶±¦µÈ·þÎñÎÞÊÓÎÒÃÇLinuxÓû§µÄ´æÔÚ£¬Ã»°ì·¨£¬ÄÇÖ»ºÃÔÚLinuxÉÏÓÃVirtualBoxÐéÄâÒ»¸öWindowsϵͳÁË¡£ÏµÍ³×°ºÃÁË£¬ÔÚÈÕ³£Ê¹Óùý³ÌÖУ¬ÍùÍùÒª´ÓVirtualBoxµÄ¿Í»§»ú£¨guest system£©ÖÐʹÓÃÖ÷»ú£¨host system£©ÀïÃæµÄÎļþ£¬ÄÇôͨ¹ý¹²ÏíÎļþ¼ÐµÄ·½Ê½¿ÉÒÔ´ï³É´ËÄ¿µÄ¡£
ÎÒÔÚÕâÀï ......
SelectÔÚSocket±à³ÌÖл¹ÊDZȽÏÖØÒªµÄ£¬¿ÉÊǶÔÓÚ³õѧSocketµÄÈËÀ´Ëµ¶¼²»Ì«°®ÓÃSelectд³ÌÐò£¬ËûÃÇÖ»ÊÇÏ°¹ßдÖîÈç connect¡¢accept¡¢recv»òrecvfromÕâÑùµÄ×èÈû³ÌÐò£¨Ëùν×èÈû·½Ê½block£¬¹ËÃû˼Ò壬¾ÍÊǽø³Ì»òÊÇÏß³ÌÖ´Ðе½ÕâЩº¯Êýʱ±ØÐëµÈ
´ýij¸öʼþµÄ·¢Éú£¬Èç¹ûʼþûÓз¢Éú£¬½ø³Ì»òÏ߳̾ͱ»×èÈû£¬º¯Êý²»ÄÜÁ¢¼´·µ» ......