⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 head.txt

📁 linux 下对8021q协议的配置和实现的增强
💻 TXT
字号:
1. 内核     #include <linux/module.h>            p35     #include <linux/init.h>           initial                              static int __init initialization_function(void)                                                                             {                                                                              	              								} 										module_init(initialization_function);         MODULE_LICENSE("GPL");             许可证                                              & module_author  module_description , module_version modeul_alias                                                module_device_tablep37static void __exit cleanup_function(void){}module_exit(cleanup_function);usr environment developinsmodmodprobermmod#include <linux/init.h>module_init(init_function);module_exit(cleanup_function);__init__initdata__exit__exitdata#include <linux/sched.h>           //include most of apistruct task_struct *currentcurrent->pid              //current id of threadcurrent->comm              //command nameobj-m              //makefile /sys/module        /proc/modules          //yesterdayvermagic.o              //a target file#include <linux/module.h>#include <linux/version.h>LINUX_VERSION_CODE                   EXPORT_SYMBOL  (symbol);EXPORT_SYMBOL_GPL(symbol);module_init(init_function);module_exit(exit_function);#include <linux/moduleparam.h>module_param(variable, type, perm);#include <linux/kernel.h>int printk(const char *fmt, ...);P742.SCULL   "Simple Character Utility for Loading Localities"#include <linux/types.h>dev_t               the No of devicesint MAJOR(dev_t dev);int MINOR(dev_t dev);           may and minor numberdev_t MKDEV(unsigned int major, unsigned int minorj);   //make device number#include <linux/fs.h>//have known the numbe of majorint register_chrdev_region(dev_t first, unsigned int count , char*name)//allocationint alloc_chrdev_region(dev_t *dev, unsigned int firstminor, unsigned int count , char *name);//unregistvoid unregister_chrdev_region(dev_t first, unsigned int count);//oldint register_chrdev(unsigned int major, const char*name , struct file_operations *fops)int unregister_chrdev(unsigned int major, const char*name);//important data structurestruct file_operatins;           //the methods of file saved struct file;                     //mention an opend filestruct inode;                     // a file in disks#include <linux/cdev.h>struct cdev *cdev_alloc(void);void cdev_init(struct cdev*dev, struct file_operations *fops);int cdev_add(struct cdev*dev, dev_t num, unsigned int count);void cdev_del(struct cdev *dev);                  //the structure of cdev in kernal stands for the char device#include <linux/kernel.h>container_of (pointer, type, field);#include <asm/uaccess.h>unsigned long copy_from_user (void *to, const void *from, unsigned long count);unsigned long copy_to_user (void *to, const void *from, unsigned long count);3.Multi ProgrammmingP132#include <asm/semaphore.h>#include <linux/completion.h>#include <linux/spinlock.h>#include <asm/atomic.h>#include <asm/bitops.h>#include <linux/seqlock.h>#include <linux/rcupdate.h>p1794. senior char drive #include <linux/ioctl.h>   //<linux/fs.h>int ioctl(int fd, unsigned long cmd, ..)//_IOC_NRBITS_IOC_TYPEBITS_IOC_SIZEBITS_IOC_DIRBITS//_IOC_NONE_IOC_READ_IOC_WRITE//create ioctl_IOC(dir, type,nr,size)_IO(type,nr)_IOR(type,nr,size)_IOW(type,nr,size)_IOWR(type,nr,size)//decode the ioctal_IOC_DIR(nr)_IOC_TYPE(nr)_IOC_NR(nr)_IOC_SIZE(nr)#include <asm/uaccess.h>int access_ok(int type, const vid *addr, unsigned long size)// to check if the pointer is available//type:  VERIFY_READ  //VERIFY_WRITE#include <asm/uaccess.h>int put_user(datum,ptr);           //before the operations, should run the access_okint get_user (local,ptr);int __put_user(datum,ptr);            //assumed that the access_ok is finishedint __get_user(local, ptr);#include <linux/capability.h>int capable(int capability);#include <linux/wait.h>typedef struct {    }  wait_queue_head_t;void int_waitqueue_head(wait_queue_head_t *queue);.....#include <linux/sched.h>set_current_state(int state);   //set the current state of running, TASK_RUNNING--READY,  TASK_INTERRUPTIBLE & TASK_UNINTERRUPTIBLE --SLEEPvoid schedule(void);        //to choose a thread in the queue, including the current or others....#include <linux/poll.h>P2085.a. time#include <linux/param.h>#include <linux/jiffies.h>#include <linux/time.h>#include <asm/msr.h>#inlcude <linux/timex.h>b. delay#include <linux/wait.h>#include <linux/sched.h>#include <linux/delay.h>c. timer#include <asm/hardirq.h>#include ,linux/timer.h>d.tasklet#include <linux/interrupt.h> e.working queue#include <linux/workqueue.h>P2316kmalloc#include <linux/slab.h>void *kmalloc(size_t size, int flags);void kfree(void* obj);#include <linux/mm.h><malloc.h><mempool.h><linux/vmalloc.h><asm/io.h><linux/percpu.h><linux/bootmem.h>p2547#include <linux/kernel.h>#include <asm/io.h>#include <linux/ioport.h>#include <asm/system.h>P2858#include <linx/interrupt.h><linux/irq.h.h><asm/signal.h>P2989#include <linux/types.h>   typedef u8;typedef u16;typedef u32;typedef u64;__u8    __u16;#include <asm/page.h>#include <asm/byteorder.h>#include <asm/unaligned.h>#include <linux/err.h>#include <linux/list.h>P322#include <linux/pci.h>P356#include <linux/usb.h>P404#include <linux/kobject.h>#include <linux/sysfs.h>#include <linux/firmware.h>P453#include <linux/mm.h>#include <asm/page.h>#include <linux/highmem.h>#include <asm/kmap_types.h>#include <asm/io.h>#include <linux/dma-mapping.h>#include <linux/dmapool.h>#include <asm/scatterlist.h>#include <asm/dma.h>P487#include <linux/fs.h>#include <linux/genhd.h>#include <linux/blkdev.h>#include <linux/bio.h>    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -