linux/fs: simplify interop and correct definition of loff_t

- offsets can be negative, loff_t needs to be signed, it also simplifies
  interop with the rest of the code base to use off_t than the actual linux
  definition "long long"
- don't rely on the defining "file" to "linux_file" in interface definitions
  as that causes heartache with includes

Reviewed by:	hps@
MFC after:	1 week
Sponsored by:	iX Systems
Differential Revision:	https://reviews.freebsd.org/D19274
This commit is contained in:
Matt Macy 2019-02-23 20:45:45 +00:00
parent 1adc28f5a8
commit 2ce1771c12
2 changed files with 11 additions and 11 deletions

View File

@ -129,25 +129,25 @@ do { \
pgsigio(*(queue), (sig), 0); \
} while (0)
typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
typedef int (*filldir_t)(void *, const char *, int, off_t, u64, unsigned);
struct file_operations {
struct module *owner;
ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long);
long (*compat_ioctl)(struct file *, unsigned int, unsigned long);
int (*mmap)(struct file *, struct vm_area_struct *);
ssize_t (*read)(struct linux_file *, char __user *, size_t, off_t *);
ssize_t (*write)(struct linux_file *, const char __user *, size_t, off_t *);
unsigned int (*poll) (struct linux_file *, struct poll_table_struct *);
long (*unlocked_ioctl)(struct linux_file *, unsigned int, unsigned long);
long (*compat_ioctl)(struct linux_file *, unsigned int, unsigned long);
int (*mmap)(struct linux_file *, struct vm_area_struct *);
int (*open)(struct inode *, struct file *);
int (*release)(struct inode *, struct file *);
int (*fasync)(int, struct file *, int);
int (*release)(struct inode *, struct linux_file *);
int (*fasync)(int, struct linux_file *, int);
/* Although not supported in FreeBSD, to align with Linux code
* we are adding llseek() only when it is mapped to no_llseek which returns
* an illegal seek error
*/
loff_t (*llseek)(struct file *, loff_t, int);
off_t (*llseek)(struct linux_file *, off_t, int);
#if 0
/* We do not support these methods. Don't permit them to compile. */
loff_t (*llseek)(struct file *, loff_t, int);

View File

@ -55,7 +55,7 @@ typedef uint64_t __be64;
typedef unsigned int uint;
typedef unsigned gfp_t;
typedef uint64_t loff_t;
typedef off_t loff_t;
typedef vm_paddr_t resource_size_t;
typedef uint16_t __bitwise__ __sum16;
typedef unsigned long pgoff_t;