• 标准C的标记化结构初始化语法


    1 struct file_operations {
    2         struct module *owner;
    3         loff_t (*llseek) (struct file *, loff_t, int);
    4         ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
    5         ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
    6         ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
    7         ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
    8         int (*readdir) (struct file *, void *, filldir_t);
    9         unsigned int (*poll) (struct file *, struct poll_table_struct *);
    10         int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
    11         long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
    12         long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
    13         int (*mmap) (struct file *, struct vm_area_struct *);
    14         int (*open) (struct inode *, struct file *);
    15         int (*flush) (struct file *, fl_owner_t id);
    16         int (*release) (struct inode *, struct file *);
    17         int (*fsync) (struct file *, struct dentry *, int datasync);
    18         int (*aio_fsync) (struct kiocb *, int datasync);
    19         int (*fasync) (int, struct file *, int);
    20         int (*lock) (struct file *, int, struct file_lock *);
    21         ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
    22         ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
    23         unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
    24         int (*check_flags)(int);
    25         int (*dir_notify)(struct file *filp, unsigned long arg);
    26         int (*flock) (struct file *, int, struct file_lock *);
    27         ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
    28         ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
    29 };

       

    1 static struct file_operations simple_fops = {
    2         .open = simple_open,
    3         .write = simple_write,
    4         .owner = THIS_MODULE,
    5 };

    允许对结构成员进行重新排列。

  • 相关阅读:
    LA 2038 Strategic game(最小点覆盖,树形dp,二分匹配)
    UVA 10564 Paths through the Hourglass(背包)
    Codeforces Round #323 (Div. 2) D 582B Once Again...(快速幂)
    UVALive 3530 Martian Mining(贪心,dp)
    UVALive 4727 Jump(约瑟夫环,递推)
    UVALive 4731 Cellular Network(贪心,dp)
    UVA Mega Man's Mission(状压dp)
    Aizu 2456 Usoperanto (贪心)
    UVA 11404 Plalidromic Subsquence (回文子序列,LCS)
    Aizu 2304 Reverse Roads(无向流)
  • 原文地址:https://www.cnblogs.com/lilto/p/11876427.html
Copyright © 2020-2023  润新知