Changeset 66659ff in rtems-libbsd for freebsd/sys/sys/file.h


Ignore:
Timestamp:
11/06/13 15:20:21 (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
9ca3faf
Parents:
ce96623
git-author:
Sebastian Huber <sebastian.huber@…> (11/06/13 15:20:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/11/13 09:08:08)
Message:

Update to FreeBSD 9.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/sys/file.h

    rce96623 r66659ff  
    6464#define DTYPE_SEM       9       /* posix semaphore */
    6565#define DTYPE_PTS       10      /* pseudo teletype master device */
     66#define DTYPE_DEV       11      /* Device specific fd type */
     67#define DTYPE_CAPABILITY        12      /* capability */
     68#define DTYPE_PROCDESC  13      /* process descriptor */
    6669
    6770#ifdef _KERNEL
     
    6972struct file;
    7073struct ucred;
     74
     75#define FOF_OFFSET      0x01    /* Use the offset in uio argument */
     76#define FOF_NOLOCK      0x02    /* Do not take FOFFSET_LOCK */
     77#define FOF_NEXTOFF     0x04    /* Also update f_nextoff */
     78#define FOF_NOUPDATE    0x10    /* Do not update f_offset */
     79off_t foffset_lock(struct file *fp, int flags);
     80void foffset_lock_uio(struct file *fp, struct uio *uio, int flags);
     81void foffset_unlock(struct file *fp, off_t val, int flags);
     82void foffset_unlock_uio(struct file *fp, struct uio *uio, int flags);
     83
     84static inline off_t
     85foffset_get(struct file *fp)
     86{
     87
     88        return (foffset_lock(fp, FOF_NOLOCK));
     89}
    7190
    7291typedef int fo_rdwr_t(struct file *fp, struct uio *uio,
    7392                    struct ucred *active_cred, int flags,
    7493                    struct thread *td);
    75 #define FOF_OFFSET      1       /* Use the offset in uio argument */
    7694typedef int fo_truncate_t(struct file *fp, off_t length,
    7795                    struct ucred *active_cred, struct thread *td);
     
    84102                    struct ucred *active_cred, struct thread *td);
    85103typedef int fo_close_t(struct file *fp, struct thread *td);
     104typedef int fo_chmod_t(struct file *fp, mode_t mode,
     105                    struct ucred *active_cred, struct thread *td);
     106typedef int fo_chown_t(struct file *fp, uid_t uid, gid_t gid,
     107                    struct ucred *active_cred, struct thread *td);
    86108typedef int fo_flags_t;
    87109
     
    95117        fo_stat_t       *fo_stat;
    96118        fo_close_t      *fo_close;
     119        fo_chmod_t      *fo_chmod;
     120        fo_chown_t      *fo_chown;
    97121        fo_flags_t      fo_flags;       /* DFLAG_* below */
    98122};
     
    240264
    241265#define FOFFSET_LOCKED       0x1
    242 #define FOFFSET_LOCK_WAITING 0x2                 
     266#define FOFFSET_LOCK_WAITING 0x2
     267#define FDEVFS_VNODE         0x4
    243268
    244269#endif /* _KERNEL || _WANT_FILE */
     
    280305
    281306#ifndef __rtems__
    282 int fget(struct thread *td, int fd, struct file **fpp);
     307int fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp);
    283308#else /* __rtems__ */
    284309struct file *rtems_bsd_get_file(int fd);
    285310
    286311static inline int
    287 fget(struct thread *td, int fd, struct file **fpp)
     312fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp)
    288313{
    289314        struct file *fp = rtems_bsd_get_file(fd);
    290315
    291316        (void) td;
     317        (void) rights;
    292318
    293319        *fpp = fp;
     
    296322}
    297323#endif /* __rtems__ */
    298 int fget_read(struct thread *td, int fd, struct file **fpp);
    299 int fget_write(struct thread *td, int fd, struct file **fpp);
     324int fget_mmap(struct thread *td, int fd, cap_rights_t rights,
     325    u_char *maxprotp, struct file **fpp);
     326int fget_read(struct thread *td, int fd, cap_rights_t rights,
     327    struct file **fpp);
     328int fget_write(struct thread *td, int fd, cap_rights_t rights,
     329    struct file **fpp);
     330int fgetcap(struct thread *td, int fd, struct file **fpp);
    300331int _fdrop(struct file *fp, struct thread *td);
    301332
     
    314345fo_stat_t       soo_stat;
    315346fo_close_t      soo_close;
     347
     348fo_chmod_t      invfo_chmod;
     349fo_chown_t      invfo_chown;
    316350#else /* __rtems__ */
    317351int rtems_bsd_soo_kqfilter(rtems_libio_t *iop, struct knote *kn);
     
    337371}
    338372#endif /* __rtems__ */
    339 int fgetvp(struct thread *td, int fd, struct vnode **vpp);
    340 int fgetvp_read(struct thread *td, int fd, struct vnode **vpp);
    341 int fgetvp_write(struct thread *td, int fd, struct vnode **vpp);
    342 
    343 int fgetsock(struct thread *td, int fd, struct socket **spp, u_int *fflagp);
     373int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp);
     374int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights,
     375    struct vnode **vpp);
     376int fgetvp_rights(struct thread *td, int fd, cap_rights_t need,
     377    cap_rights_t *have, struct vnode **vpp);
     378int fgetvp_read(struct thread *td, int fd, cap_rights_t rights,
     379    struct vnode **vpp);
     380int fgetvp_write(struct thread *td, int fd, cap_rights_t rights,
     381    struct vnode **vpp);
     382
     383int fgetsock(struct thread *td, int fd, cap_rights_t rights,
     384    struct socket **spp, u_int *fflagp);
    344385void fputsock(struct socket *sp);
     386
     387static __inline int
     388_fnoop(void)
     389{
     390
     391        return (0);
     392}
    345393
    346394#define fhold(fp)                                                       \
     
    348396#ifndef __rtems__
    349397#define fdrop(fp, td)                                                   \
    350         (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : 0)
     398        (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : _fnoop())
    351399#else /* __rtems__ */
    352400#define fdrop(fp, td) do { } while (0)
     
    362410static __inline fo_stat_t       fo_stat;
    363411static __inline fo_close_t      fo_close;
    364 
    365 static __inline int
    366 fo_read(fp, uio, active_cred, flags, td)
    367         struct file *fp;
    368         struct uio *uio;
    369         struct ucred *active_cred;
    370         int flags;
    371         struct thread *td;
     412static __inline fo_chmod_t      fo_chmod;
     413static __inline fo_chown_t      fo_chown;
     414
     415static __inline int
     416fo_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
     417    int flags, struct thread *td)
    372418{
    373419
     
    376422
    377423static __inline int
    378 fo_write(fp, uio, active_cred, flags, td)
    379         struct file *fp;
    380         struct uio *uio;
    381         struct ucred *active_cred;
    382         int flags;
    383         struct thread *td;
     424fo_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
     425    int flags, struct thread *td)
    384426{
    385427
     
    388430
    389431static __inline int
    390 fo_truncate(fp, length, active_cred, td)
    391         struct file *fp;
    392         off_t length;
    393         struct ucred *active_cred;
    394         struct thread *td;
     432fo_truncate(struct file *fp, off_t length, struct ucred *active_cred,
     433    struct thread *td)
    395434{
    396435
     
    400439
    401440static __inline int
    402 fo_ioctl(fp, com, data, active_cred, td)
    403         struct file *fp;
    404         u_long com;
    405         void *data;
    406         struct ucred *active_cred;
    407         struct thread *td;
     441fo_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,
     442    struct thread *td)
    408443{
    409444
     
    427462
    428463static __inline int
    429 fo_poll(fp, events, active_cred, td)
    430         struct file *fp;
    431         int events;
    432         struct ucred *active_cred;
    433         struct thread *td;
     464fo_poll(struct file *fp, int events, struct ucred *active_cred,
     465    struct thread *td)
    434466{
    435467
     
    446478#ifndef __rtems__
    447479static __inline int
    448 fo_stat(fp, sb, active_cred, td)
    449         struct file *fp;
    450         struct stat *sb;
    451         struct ucred *active_cred;
    452         struct thread *td;
     480fo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
     481    struct thread *td)
    453482{
    454483
     
    457486
    458487static __inline int
    459 fo_close(fp, td)
    460         struct file *fp;
    461         struct thread *td;
     488fo_close(struct file *fp, struct thread *td)
    462489{
    463490
     
    467494
    468495static __inline int
    469 fo_kqfilter(fp, kn)
    470         struct file *fp;
    471         struct knote *kn;
     496fo_kqfilter(struct file *fp, struct knote *kn)
    472497{
    473498
     
    479504}
    480505
     506#ifndef __rtems__
     507static __inline int
     508fo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
     509    struct thread *td)
     510{
     511
     512        return ((*fp->f_ops->fo_chmod)(fp, mode, active_cred, td));
     513}
     514
     515static __inline int
     516fo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
     517    struct thread *td)
     518{
     519
     520        return ((*fp->f_ops->fo_chown)(fp, uid, gid, active_cred, td));
     521}
     522#endif /* __rtems__ */
     523
    481524#endif /* _KERNEL */
    482525
Note: See TracChangeset for help on using the changeset viewer.