在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > file_operations下函數(shù)詳解

            file_operations下函數(shù)詳解

            作者: 時間:2011-06-21 來源:網(wǎng)絡(luò) 收藏

            struct {

            struct module *owner;

            // 指向擁有該結(jié)構(gòu)的模塊的指針,避免正在操作時被卸載,一般為初始化為THIS_MODULES

            loff_t (*llseek) (struct file *, loff_t, int);

            // llseek用來修改文件當前的讀寫位置,返回新位置

            // loff_t為一個長偏移量。當此指針為空,seek調(diào)用將會以不可預期的方式修改file結(jié)構(gòu)中的位置計數(shù)器。

            ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);

            // 從設(shè)備中同步讀取數(shù)據(jù)。讀取成功返回讀取的字節(jié)數(shù)。設(shè)置為NULL,調(diào)用時返回-EINVAL

            ssize_t (*aio_read) (struct kiocb *, char __user *, size_t, loff_t);

            // 初始化一個異步的讀取操作,為NULL時全部通過read處理

            ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);

            // 向設(shè)備發(fā)送數(shù)據(jù)。

            ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, loff_t);

            // 初始化一個異步的寫入操作。

            int (*readdir) (struct file *, void *, filldir_t);

            // 僅用于讀取目錄,對于設(shè)備文件,該字段為 NULL

            unsigned int (*poll) (struct file *, struct poll_table_struct *);

            // 返回一個位掩碼,用來指出非阻塞的讀取或?qū)懭胧欠窨赡堋?br style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px; word-wrap: break-word" />
            // 將pool定義為 NULL,設(shè)備會被認為即可讀也可寫。

            int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);

            // 提供一種執(zhí)行設(shè)備特殊命令的方法。不設(shè)置入口點,返回-ENOTTY

            long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);

            // 不使用BLK的文件系統(tǒng),將使用此種指針代替ioctl

            long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

            // 在64位系統(tǒng)上,32位的ioctl調(diào)用,將使用此指針代替

            int (*mmap) (struct file *, struct vm_area_struct *);

            // 用于請求將設(shè)備內(nèi)存映射到進程地址空間。如果無此方法,將訪問-ENODEV。

            int (*open) (struct inode *, struct file *);

            // 如果為空,設(shè)備的打開操作永遠成功,但系統(tǒng)不會通知驅(qū)動程序

            // 由VFS調(diào)用,當VFS打開一個文件,即建立了一個新的struct file,之后調(diào)用open方法分配文件結(jié)構(gòu)。open屬于struct

            inode_operations。

            int (*flush) (struct file *);

            // 發(fā)生在進程關(guān)閉設(shè)備文件描述符副本,執(zhí)行并等待,若設(shè)置為NULL,內(nèi)核將忽略用戶應(yīng)用程序的請求。

            int (*release) (struct inode *, struct file *);

            // file結(jié)構(gòu)釋放時,將調(diào)用此指針函數(shù),release與open相同可設(shè)置為NULL

            int (*fsync) (struct file *, struct dentry *, int datasync);


            上一頁 1 2 下一頁

            關(guān)鍵詞: 詳解 函數(shù) file_operations

            評論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉