Changeset 66659ff in rtems-libbsd for freebsd/sys/sys/file.h
- Timestamp:
- 11/06/13 15:20:21 (9 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freebsd/sys/sys/file.h
rce96623 r66659ff 64 64 #define DTYPE_SEM 9 /* posix semaphore */ 65 65 #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 */ 66 69 67 70 #ifdef _KERNEL … … 69 72 struct file; 70 73 struct 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 */ 79 off_t foffset_lock(struct file *fp, int flags); 80 void foffset_lock_uio(struct file *fp, struct uio *uio, int flags); 81 void foffset_unlock(struct file *fp, off_t val, int flags); 82 void foffset_unlock_uio(struct file *fp, struct uio *uio, int flags); 83 84 static inline off_t 85 foffset_get(struct file *fp) 86 { 87 88 return (foffset_lock(fp, FOF_NOLOCK)); 89 } 71 90 72 91 typedef int fo_rdwr_t(struct file *fp, struct uio *uio, 73 92 struct ucred *active_cred, int flags, 74 93 struct thread *td); 75 #define FOF_OFFSET 1 /* Use the offset in uio argument */76 94 typedef int fo_truncate_t(struct file *fp, off_t length, 77 95 struct ucred *active_cred, struct thread *td); … … 84 102 struct ucred *active_cred, struct thread *td); 85 103 typedef int fo_close_t(struct file *fp, struct thread *td); 104 typedef int fo_chmod_t(struct file *fp, mode_t mode, 105 struct ucred *active_cred, struct thread *td); 106 typedef int fo_chown_t(struct file *fp, uid_t uid, gid_t gid, 107 struct ucred *active_cred, struct thread *td); 86 108 typedef int fo_flags_t; 87 109 … … 95 117 fo_stat_t *fo_stat; 96 118 fo_close_t *fo_close; 119 fo_chmod_t *fo_chmod; 120 fo_chown_t *fo_chown; 97 121 fo_flags_t fo_flags; /* DFLAG_* below */ 98 122 }; … … 240 264 241 265 #define FOFFSET_LOCKED 0x1 242 #define FOFFSET_LOCK_WAITING 0x2 266 #define FOFFSET_LOCK_WAITING 0x2 267 #define FDEVFS_VNODE 0x4 243 268 244 269 #endif /* _KERNEL || _WANT_FILE */ … … 280 305 281 306 #ifndef __rtems__ 282 int fget(struct thread *td, int fd, struct file **fpp);307 int fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp); 283 308 #else /* __rtems__ */ 284 309 struct file *rtems_bsd_get_file(int fd); 285 310 286 311 static inline int 287 fget(struct thread *td, int fd, struct file **fpp)312 fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp) 288 313 { 289 314 struct file *fp = rtems_bsd_get_file(fd); 290 315 291 316 (void) td; 317 (void) rights; 292 318 293 319 *fpp = fp; … … 296 322 } 297 323 #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); 324 int fget_mmap(struct thread *td, int fd, cap_rights_t rights, 325 u_char *maxprotp, struct file **fpp); 326 int fget_read(struct thread *td, int fd, cap_rights_t rights, 327 struct file **fpp); 328 int fget_write(struct thread *td, int fd, cap_rights_t rights, 329 struct file **fpp); 330 int fgetcap(struct thread *td, int fd, struct file **fpp); 300 331 int _fdrop(struct file *fp, struct thread *td); 301 332 … … 314 345 fo_stat_t soo_stat; 315 346 fo_close_t soo_close; 347 348 fo_chmod_t invfo_chmod; 349 fo_chown_t invfo_chown; 316 350 #else /* __rtems__ */ 317 351 int rtems_bsd_soo_kqfilter(rtems_libio_t *iop, struct knote *kn); … … 337 371 } 338 372 #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); 373 int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp); 374 int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights, 375 struct vnode **vpp); 376 int fgetvp_rights(struct thread *td, int fd, cap_rights_t need, 377 cap_rights_t *have, struct vnode **vpp); 378 int fgetvp_read(struct thread *td, int fd, cap_rights_t rights, 379 struct vnode **vpp); 380 int fgetvp_write(struct thread *td, int fd, cap_rights_t rights, 381 struct vnode **vpp); 382 383 int fgetsock(struct thread *td, int fd, cap_rights_t rights, 384 struct socket **spp, u_int *fflagp); 344 385 void fputsock(struct socket *sp); 386 387 static __inline int 388 _fnoop(void) 389 { 390 391 return (0); 392 } 345 393 346 394 #define fhold(fp) \ … … 348 396 #ifndef __rtems__ 349 397 #define fdrop(fp, td) \ 350 (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : 0)398 (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : _fnoop()) 351 399 #else /* __rtems__ */ 352 400 #define fdrop(fp, td) do { } while (0) … … 362 410 static __inline fo_stat_t fo_stat; 363 411 static __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; 412 static __inline fo_chmod_t fo_chmod; 413 static __inline fo_chown_t fo_chown; 414 415 static __inline int 416 fo_read(struct file *fp, struct uio *uio, struct ucred *active_cred, 417 int flags, struct thread *td) 372 418 { 373 419 … … 376 422 377 423 static __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; 424 fo_write(struct file *fp, struct uio *uio, struct ucred *active_cred, 425 int flags, struct thread *td) 384 426 { 385 427 … … 388 430 389 431 static __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; 432 fo_truncate(struct file *fp, off_t length, struct ucred *active_cred, 433 struct thread *td) 395 434 { 396 435 … … 400 439 401 440 static __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; 441 fo_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred, 442 struct thread *td) 408 443 { 409 444 … … 427 462 428 463 static __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; 464 fo_poll(struct file *fp, int events, struct ucred *active_cred, 465 struct thread *td) 434 466 { 435 467 … … 446 478 #ifndef __rtems__ 447 479 static __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; 480 fo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, 481 struct thread *td) 453 482 { 454 483 … … 457 486 458 487 static __inline int 459 fo_close(fp, td) 460 struct file *fp; 461 struct thread *td; 488 fo_close(struct file *fp, struct thread *td) 462 489 { 463 490 … … 467 494 468 495 static __inline int 469 fo_kqfilter(fp, kn) 470 struct file *fp; 471 struct knote *kn; 496 fo_kqfilter(struct file *fp, struct knote *kn) 472 497 { 473 498 … … 479 504 } 480 505 506 #ifndef __rtems__ 507 static __inline int 508 fo_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 515 static __inline int 516 fo_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 481 524 #endif /* _KERNEL */ 482 525
Note: See TracChangeset
for help on using the changeset viewer.