新聞中心

        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 下一頁

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 德格县| 易门县| 炉霍县| 吴川市| 股票| 定襄县| 开平市| 公主岭市| 扶余县| 紫云| 泉州市| 玉田县| 博白县| 大宁县| 盱眙县| 正阳县| 泉州市| 上虞市| 卢湾区| 光山县| 宜丰县| 井研县| 砚山县| 永定县| 冀州市| 西吉县| 稻城县| 南昌县| 金秀| 忻城县| 广西| 麟游县| 孟州市| 无极县| 改则县| 信阳市| 仙桃市| 江口县| 西藏| 海门市| 哈尔滨市|