Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/file.h
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
typedef int fo_seek_t(struct file *fp, off_t offset, int whence, | typedef int fo_seek_t(struct file *fp, off_t offset, int whence, | ||||
struct thread *td); | struct thread *td); | ||||
typedef int fo_fill_kinfo_t(struct file *fp, struct kinfo_file *kif, | typedef int fo_fill_kinfo_t(struct file *fp, struct kinfo_file *kif, | ||||
struct filedesc *fdp); | struct filedesc *fdp); | ||||
typedef int fo_mmap_t(struct file *fp, vm_map_t map, vm_offset_t *addr, | typedef int fo_mmap_t(struct file *fp, vm_map_t map, vm_offset_t *addr, | ||||
vm_size_t size, vm_prot_t prot, vm_prot_t cap_maxprot, | vm_size_t size, vm_prot_t prot, vm_prot_t cap_maxprot, | ||||
int flags, vm_ooffset_t foff, struct thread *td); | int flags, vm_ooffset_t foff, struct thread *td); | ||||
typedef int fo_aio_queue_t(struct file *fp, struct kaiocb *job); | typedef int fo_aio_queue_t(struct file *fp, struct kaiocb *job); | ||||
typedef int fo_add_seals_t(struct file *fp, int flags); | |||||
typedef int fo_get_seals_t(struct file *fp, int *flags); | |||||
typedef int fo_flags_t; | typedef int fo_flags_t; | ||||
struct fileops { | struct fileops { | ||||
fo_rdwr_t *fo_read; | fo_rdwr_t *fo_read; | ||||
fo_rdwr_t *fo_write; | fo_rdwr_t *fo_write; | ||||
fo_truncate_t *fo_truncate; | fo_truncate_t *fo_truncate; | ||||
fo_ioctl_t *fo_ioctl; | fo_ioctl_t *fo_ioctl; | ||||
fo_poll_t *fo_poll; | fo_poll_t *fo_poll; | ||||
fo_kqfilter_t *fo_kqfilter; | fo_kqfilter_t *fo_kqfilter; | ||||
fo_stat_t *fo_stat; | fo_stat_t *fo_stat; | ||||
fo_close_t *fo_close; | fo_close_t *fo_close; | ||||
fo_chmod_t *fo_chmod; | fo_chmod_t *fo_chmod; | ||||
fo_chown_t *fo_chown; | fo_chown_t *fo_chown; | ||||
fo_sendfile_t *fo_sendfile; | fo_sendfile_t *fo_sendfile; | ||||
fo_seek_t *fo_seek; | fo_seek_t *fo_seek; | ||||
fo_fill_kinfo_t *fo_fill_kinfo; | fo_fill_kinfo_t *fo_fill_kinfo; | ||||
fo_mmap_t *fo_mmap; | fo_mmap_t *fo_mmap; | ||||
fo_aio_queue_t *fo_aio_queue; | fo_aio_queue_t *fo_aio_queue; | ||||
fo_add_seals_t *fo_add_seals; | |||||
fo_get_seals_t *fo_get_seals; | |||||
fo_flags_t fo_flags; /* DFLAG_* below */ | fo_flags_t fo_flags; /* DFLAG_* below */ | ||||
}; | }; | ||||
#define DFLAG_PASSABLE 0x01 /* may be passed via unix sockets. */ | #define DFLAG_PASSABLE 0x01 /* may be passed via unix sockets. */ | ||||
#define DFLAG_SEEKABLE 0x02 /* seekable / nonsequential */ | #define DFLAG_SEEKABLE 0x02 /* seekable / nonsequential */ | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#if defined(_KERNEL) || defined(_WANT_FILE) | #if defined(_KERNEL) || defined(_WANT_FILE) | ||||
▲ Show 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | return ((*fp->f_ops->fo_mmap)(fp, map, addr, size, prot, cap_maxprot, | ||||
flags, foff, td)); | flags, foff, td)); | ||||
} | } | ||||
static __inline int | static __inline int | ||||
fo_aio_queue(struct file *fp, struct kaiocb *job) | fo_aio_queue(struct file *fp, struct kaiocb *job) | ||||
{ | { | ||||
return ((*fp->f_ops->fo_aio_queue)(fp, job)); | return ((*fp->f_ops->fo_aio_queue)(fp, job)); | ||||
} | |||||
static __inline int | |||||
fo_add_seals(struct file *fp, int seals) | |||||
{ | |||||
if (fp->f_ops->fo_add_seals == NULL) | |||||
return (EINVAL); | |||||
return ((*fp->f_ops->fo_add_seals)(fp, seals)); | |||||
} | |||||
static __inline int | |||||
fo_get_seals(struct file *fp, int *seals) | |||||
{ | |||||
if (fp->f_ops->fo_get_seals == NULL) | |||||
return (EINVAL); | |||||
return ((*fp->f_ops->fo_get_seals)(fp, seals)); | |||||
} | } | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* !SYS_FILE_H */ | #endif /* !SYS_FILE_H */ |