新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > file_operations下函數詳解

        file_operations下函數詳解

        作者: 時間:2011-06-21 來源:網絡 收藏


        // 刷新待處理的數據,如果驅動程序沒有實現,fsync調用將返回-EINVAL

        int (*aio_fsync) (struct kiocb *, int datasync);

        // 異步fsync

        int (*fasync) (int, struct file *, int);

        // 通知設備FASYNC標志發生變化,如果設備不支持異步通知,該字段可以為NULL

        int (*lock) (struct file *, int, struct file_lock *);

        // 實現文件鎖,設備驅動常不去實現此lock

        ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);

        ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);

        // readv和writev 分散/聚集型的讀寫操作,實現進行涉及多個內存區域的單次讀或寫操作。

        ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);

        // 實現sendfile調用的讀取部分,將數據從一個文件描述符移到另一個,設備驅動通常將其設置為 NULL

        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);

        // 實現sendfile調用的另一部分,內核調用將其數據發送到對應文件,每次一個數據頁,設備驅動通常將其設置為NULL

        unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned

        long);

        // 在進程地址空間找到一個合適的位置,以便將底層設備中的內存段映射到該位置。大部分驅動可將其設置為NULL

        int (*check_flags)(int);

        // 允許模塊檢查傳遞給fcntl(F_SETEL…)調用的標志

        int (*dir_notify)(struct file *filp, unsigned long arg);

        // 應用程序使用fcntl來請求目錄改變通知時,調用該方法。僅對文件系統有效,驅動程序不必實現。

        int (*flock) (struct file *, int, struct file_lock *);

        // 實現文件鎖

        };

        本文引用地址:http://www.104case.com/article/150582.htm

        上一頁 1 2 下一頁

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 拉萨市| 永德县| 栾城县| 锦屏县| 雷波县| 阿拉善右旗| 永宁县| 阳高县| 吐鲁番市| 青岛市| 抚宁县| 迭部县| 炎陵县| 临澧县| 阿克| 墨竹工卡县| 德庆县| 收藏| 泰宁县| 贺州市| 稷山县| 会同县| 中江县| 澎湖县| 巴林左旗| 盐津县| 屏东县| 马边| 阿鲁科尔沁旗| 贞丰县| 江陵县| 镇康县| 安化县| 荆州市| 禹州市| 光泽县| 浙江省| 前郭尔| 汶川县| 淳安县| 九龙城区|