Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/include/linux/fs.h

    r598 r679  
    1212 */
    1313
     14#include <linux/init.h>
    1415#include <linux/types.h>
    1516#include <linux/fcntl.h>
     
    2021#include <linux/dcache.h>
    2122#include <linux/vmalloc.h>
    22 #include <linux/tqueue.h>
     23#include <linux/pid.h>
     24#include <linux/err.h>
     25#include <linux/workqueue.h>
    2326
    2427#define FALSE   0
     
    4346#define MAY_WRITE 2
    4447#define MAY_READ 4
    45 
    46 #define FMODE_READ 1
    47 #define FMODE_WRITE 2
    4848
    4949#define READ 0
     
    167167         void * f_list;
    168168        struct dentry           *f_dentry;
    169         struct file_operations  *f_op;
     169        const struct file_operations    *f_op;
     170        struct inode            *f_inode;       /* cached value */
     171        spinlock_t              f_lock;
    170172        atomic_t                f_count;
    171173        unsigned int            f_flags;
     
    184186
    185187struct inode {
    186 #ifdef TARGET_OS2
    187         kdev_t                  i_rdev;
    188         struct semaphore        i_sem;
    189         union {
    190                 void            *generic_ip;
    191         } u;
    192 
    193 #else
    194188         void * i_hash;
    195189         void * i_list;
     
    227221                void                            *generic_ip;
    228222        } u;
    229 #endif
    230223};
    231224
     
    237230        int (*read) (struct file *, char *, size_t, loff_t *);
    238231        int (*write) (struct file *, const char *, size_t, loff_t *);
     232        ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
     233        ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
    239234        int (*readdir) (struct file *, void *, filldir_t);
    240235        unsigned int (*poll) (struct file *, struct poll_table_struct *);
    241         int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
     236        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
     237        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
    242238        int (*mmap) (struct file *, struct vm_area_struct *);
    243239        int (*open) (struct inode *, struct file *);
     
    259255
    260256
    261 extern int register_chrdev(unsigned int, const char *, struct file_operations *);
     257extern int register_chrdev(unsigned int, const char *, const struct file_operations *);
    262258extern int unregister_chrdev(unsigned int, const char *);
    263259
    264260extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
    265 extern void kill_fasync(struct fasync_struct *, int, int);
    266 
    267 #define fops_get(x) (x)
    268 #define fops_put(x) do { ; } while (0)
     261extern void kill_fasync(struct fasync_struct **, int, int);
     262
     263
     264/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
     265#define fops_get(fops) \
     266        (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
     267#define fops_put(fops) \
     268        do { if (fops) module_put((fops)->owner); } while(0)
     269/*
     270 * This one is to be used *ONLY* from ->open() instances.
     271 * fops must be non-NULL, pinned down *and* module dependencies
     272 * should be sufficient to pin the caller down as well.
     273 */
     274#define replace_fops(f, fops) \
     275        do {    \
     276                struct file *__file = (f); \
     277                fops_put(__file->f_op); \
     278        } while(0)
    269279
    270280#define minor(a) MINOR(a)
     
    276286#define nonseekable_open(i,f) 0
    277287
     288struct kiocb {
     289        struct file             *ki_filp;
     290        loff_t                  ki_pos;
     291        void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
     292        void                    *private;
     293        int                     ki_flags;
     294};
     295
     296extern int stream_open(struct inode * inode, struct file * filp);
     297
     298/*
     299 * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
     300 * to O_WRONLY and O_RDWR via the strange trick in do_dentry_open()
     301 */
     302
     303/* file is open for reading */
     304#define FMODE_READ              (( fmode_t)0x1)
     305/* file is open for writing */
     306#define FMODE_WRITE             (( fmode_t)0x2)
     307/* file is seekable */
     308#define FMODE_LSEEK             (( fmode_t)0x4)
     309/* file can be accessed using pread */
     310#define FMODE_PREAD             (( fmode_t)0x8)
     311/* file can be accessed using pwrite */
     312#define FMODE_PWRITE            (( fmode_t)0x10)
     313/* File is opened for execution with sys_execve / sys_uselib */
     314#define FMODE_EXEC              (( fmode_t)0x20)
     315/* File is opened with O_NDELAY (only set for block devices) */
     316#define FMODE_NDELAY            (( fmode_t)0x40)
     317/* File is opened with O_EXCL (only set for block devices) */
     318#define FMODE_EXCL              (( fmode_t)0x80)
     319/* File is opened using open(.., 3, ..) and is writeable only for ioctls
     320   (specialy hack for floppy.c) */
     321#define FMODE_WRITE_IOCTL       (( fmode_t)0x100)
     322/* 32bit hashes as llseek() offset (for directories) */
     323#define FMODE_32BITHASH         (( fmode_t)0x200)
     324/* 64bit hashes as llseek() offset (for directories) */
     325#define FMODE_64BITHASH         (( fmode_t)0x400)
     326
     327/* File needs atomic accesses to f_pos */
     328#define FMODE_ATOMIC_POS        (( fmode_t)0x8000)
     329
     330/* File is stream-like */
     331#define FMODE_STREAM            (( fmode_t)0x200000)
     332
     333static inline struct inode *file_inode(const struct file *f)
     334{
     335        return f->f_inode;
     336}
     337
    278338#endif /* _LINUX_FS_H */
Note: See TracChangeset for help on using the changeset viewer.