sync_file.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * include/linux/sync_file.h
  3. *
  4. * Copyright (C) 2012 Google, Inc.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. */
  12. #ifndef _LINUX_SYNC_FILE_H
  13. #define _LINUX_SYNC_FILE_H
  14. #include <linux/types.h>
  15. #include <linux/kref.h>
  16. #include <linux/ktime.h>
  17. #include <linux/list.h>
  18. #include <linux/spinlock.h>
  19. #include <linux/fence.h>
  20. #include <linux/fence-array.h>
  21. /**
  22. * struct sync_file - sync file to export to the userspace
  23. * @file: file representing this fence
  24. * @kref: reference count on fence.
  25. * @name: name of sync_file. Useful for debugging
  26. * @sync_file_list: membership in global file list
  27. * @wq: wait queue for fence signaling
  28. * @fence: fence with the fences in the sync_file
  29. * @cb: fence callback information
  30. */
  31. struct sync_file {
  32. struct file *file;
  33. struct kref kref;
  34. char name[32];
  35. #ifdef CONFIG_DEBUG_FS
  36. struct list_head sync_file_list;
  37. #endif
  38. wait_queue_head_t wq;
  39. struct fence *fence;
  40. struct fence_cb cb;
  41. };
  42. #define POLL_ENABLED FENCE_FLAG_USER_BITS
  43. struct sync_file *sync_file_create(struct fence *fence);
  44. struct fence *sync_file_get_fence(int fd);
  45. #endif /* _LINUX_SYNC_H */