Ignore:
Timestamp:
Jan 1, 2021, 5:31:48 AM (5 years ago)
Author:
Paul Smedley
Message:

Add source for uniaud32 based on code from linux kernel 5.4.86

Location:
GPL/branches/uniaud32-next
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/include/linux/fs.h

    r598 r615  
    4343#define MAY_WRITE 2
    4444#define MAY_READ 4
    45 
    46 #define FMODE_READ 1
    47 #define FMODE_WRITE 2
    4845
    4946#define READ 0
     
    167164         void * f_list;
    168165        struct dentry           *f_dentry;
    169         struct file_operations  *f_op;
     166        const struct file_operations    *f_op;
     167        spinlock_t              f_lock;
    170168        atomic_t                f_count;
    171169        unsigned int            f_flags;
     
    237235        int (*read) (struct file *, char *, size_t, loff_t *);
    238236        int (*write) (struct file *, const char *, size_t, loff_t *);
     237        ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
     238        ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
    239239        int (*readdir) (struct file *, void *, filldir_t);
    240240        unsigned int (*poll) (struct file *, struct poll_table_struct *);
     
    259259
    260260
    261 extern int register_chrdev(unsigned int, const char *, struct file_operations *);
     261extern int register_chrdev(unsigned int, const char *, const struct file_operations *);
    262262extern int unregister_chrdev(unsigned int, const char *);
    263263
    264264extern 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)
     265extern void kill_fasync(struct fasync_struct **, int, int);
     266
     267
     268/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
     269#define fops_get(fops) \
     270        (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
     271#define fops_put(fops) \
     272        do { if (fops) module_put((fops)->owner); } while(0)
     273/*
     274 * This one is to be used *ONLY* from ->open() instances.
     275 * fops must be non-NULL, pinned down *and* module dependencies
     276 * should be sufficient to pin the caller down as well.
     277 */
     278#define replace_fops(f, fops) \
     279        do {    \
     280                struct file *__file = (f); \
     281                fops_put(__file->f_op); \
     282        } while(0)
    269283
    270284#define minor(a) MINOR(a)
     
    276290#define nonseekable_open(i,f) 0
    277291
     292struct kiocb {
     293        struct file             *ki_filp;
     294        loff_t                  ki_pos;
     295        void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
     296        void                    *private;
     297        int                     ki_flags;
     298};
     299
     300extern int stream_open(struct inode * inode, struct file * filp);
     301
     302/*
     303 * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
     304 * to O_WRONLY and O_RDWR via the strange trick in do_dentry_open()
     305 */
     306
     307/* file is open for reading */
     308#define FMODE_READ              (( fmode_t)0x1)
     309/* file is open for writing */
     310#define FMODE_WRITE             (( fmode_t)0x2)
     311/* file is seekable */
     312#define FMODE_LSEEK             (( fmode_t)0x4)
     313/* file can be accessed using pread */
     314#define FMODE_PREAD             (( fmode_t)0x8)
     315/* file can be accessed using pwrite */
     316#define FMODE_PWRITE            (( fmode_t)0x10)
     317/* File is opened for execution with sys_execve / sys_uselib */
     318#define FMODE_EXEC              (( fmode_t)0x20)
     319/* File is opened with O_NDELAY (only set for block devices) */
     320#define FMODE_NDELAY            (( fmode_t)0x40)
     321/* File is opened with O_EXCL (only set for block devices) */
     322#define FMODE_EXCL              (( fmode_t)0x80)
     323/* File is opened using open(.., 3, ..) and is writeable only for ioctls
     324   (specialy hack for floppy.c) */
     325#define FMODE_WRITE_IOCTL       (( fmode_t)0x100)
     326/* 32bit hashes as llseek() offset (for directories) */
     327#define FMODE_32BITHASH         (( fmode_t)0x200)
     328/* 64bit hashes as llseek() offset (for directories) */
     329#define FMODE_64BITHASH         (( fmode_t)0x400)
     330
     331/* File needs atomic accesses to f_pos */
     332#define FMODE_ATOMIC_POS        (( fmode_t)0x8000)
     333
     334/* File is stream-like */
     335#define FMODE_STREAM            (( fmode_t)0x200000)
     336
    278337#endif /* _LINUX_FS_H */
Note: See TracChangeset for help on using the changeset viewer.