struct file<`a::A, `r::TR> {
  struct list_head	f_list;
  struct dentry		*f_dentry;
  struct vfsmount       *f_vfsmnt;
  struct file_operations<`a>	*f_op;
  atomic_t		f_count;
  unsigned int 		f_flags;
  mode_t		f_mode;
  loff_t			f_pos;
  unsigned long 		f_reada, f_ramax, f_raend, f_ralen, f_rawin;
  struct fown_struct	f_owner;
  unsigned int		f_uid, f_gid;
  int			f_error;

  unsigned long		f_version;

  /* needed for tty driver, and maybe others */
  `a			*`r private_data;

  /* preallocated helper kiobuf to speedup O_DIRECT */
  struct kiobuf		*f_iobuf;
  long			f_iobuf_lock;
};


struct file_operations<`a::A,`r::TR> { <`i>
        struct module *owner;
        loff_t (*llseek) (struct file<`a,`r> *, loff_t, int)  __attribute__((no_throw));
        ssize_t (*read) (struct file<`a,`r> *, char *{valueof(`i)} @nozeroterm buffer, tag_t<`i> bufsize, loff_t *) 
	  __attribute__((no_throw)); //@requires(numelts(buffer) == bufsize)
        ssize_t (*write) (struct file<`a,`r> *, char *{valueof(`i)} @nozeroterm buffer, tag_t<`i> bufsize, loff_t *) 
	  __attribute__((no_throw)); //@requires(numelts(buffer) == bufsize)
        int (*readdir) (struct file<`a,`r> *, void *, filldir_t)  __attribute__((no_throw));
        unsigned int (*poll) (struct file<`a,`r> *, struct poll_table_struct *)  __attribute__((no_throw));
        int (*ioctl) (struct inode *, struct file<`a,`r> *, unsigned int, int*)  __attribute__((no_throw));
        int (*mmap) (struct file<`a,`r> *, struct vm_area_struct *)  __attribute__((no_throw));
        int (*open) (struct inode *, struct file<`a,`r> *)  __attribute__((no_throw));
        int (*flush) (struct file<`a,`r> *)  __attribute__((no_throw));
        int (*release) (struct inode *, struct file<`a,`r> *) __attribute__((no_throw));
        int (*fsync) (struct file<`a,`r> *, struct dentry *, int datasync)  __attribute__((no_throw));
        int (*fasync) (int, struct file<`a,`r> *, int)  __attribute__((no_throw));
        int (*lock) (struct file<`a,`r> *, int, struct file_lock *)  __attribute__((no_throw));
        ssize_t (*readv) (struct file<`a,`r> *, const struct iovec *, unsigned long, loff_t *)  __attribute__((no_throw));
        ssize_t (*writev) (struct file<`a,`r> *, const struct iovec *, unsigned long, loff_t *)  __attribute__((no_throw));
        ssize_t (*sendpage) (struct file<`a,`r> *, struct page *, int, size_t, loff_t *, int)  __attribute__((no_throw));
        unsigned long (*get_unmapped_area)(struct file<`a,`r> *, unsigned long, unsigned long, unsigned long, unsigned long)  __attribute__((no_throw));
};

extern loff_t no_llseek(struct file<`a, `r::TR> *file, loff_t offset, int origin)  __attribute__((no_throw));
static inline void poll_wait(struct file<`a, `r::TR> * filp, wait_queue_head_t * wait_address, poll_table *p);
