media-ioc-enum-links.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media_ioc_enum_links:
  4. **************************
  5. ioctl MEDIA_IOC_ENUM_LINKS
  6. **************************
  7. Name
  8. ====
  9. MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
  10. Synopsis
  11. ========
  12. .. c:macro:: MEDIA_IOC_ENUM_LINKS
  13. ``int ioctl(int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`media_links_enum`.
  20. Description
  21. ===========
  22. To enumerate pads and/or links for a given entity, applications set the
  23. entity field of a struct :c:type:`media_links_enum`
  24. structure and initialize the struct
  25. :c:type:`media_pad_desc` and struct
  26. :c:type:`media_link_desc` structure arrays pointed by
  27. the ``pads`` and ``links`` fields. They then call the
  28. MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
  29. If the ``pads`` field is not NULL, the driver fills the ``pads`` array
  30. with information about the entity's pads. The array must have enough
  31. room to store all the entity's pads. The number of pads can be retrieved
  32. with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
  33. If the ``links`` field is not NULL, the driver fills the ``links`` array
  34. with information about the entity's outbound links. The array must have
  35. enough room to store all the entity's outbound links. The number of
  36. outbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
  37. Only forward links that originate at one of the entity's source pads are
  38. returned during the enumeration process.
  39. .. c:type:: media_links_enum
  40. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  41. .. flat-table:: struct media_links_enum
  42. :header-rows: 0
  43. :stub-columns: 0
  44. :widths: 1 1 2
  45. * - __u32
  46. - ``entity``
  47. - Entity id, set by the application.
  48. * - struct :c:type:`media_pad_desc`
  49. - \*\ ``pads``
  50. - Pointer to a pads array allocated by the application. Ignored if
  51. NULL.
  52. * - struct :c:type:`media_link_desc`
  53. - \*\ ``links``
  54. - Pointer to a links array allocated by the application. Ignored if
  55. NULL.
  56. * - __u32
  57. - ``reserved[4]``
  58. - Reserved for future extensions. Drivers and applications must set
  59. the array to zero.
  60. .. c:type:: media_pad_desc
  61. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  62. .. flat-table:: struct media_pad_desc
  63. :header-rows: 0
  64. :stub-columns: 0
  65. :widths: 1 1 2
  66. * - __u32
  67. - ``entity``
  68. - ID of the entity this pad belongs to.
  69. * - __u16
  70. - ``index``
  71. - Pad index, starts at 0.
  72. * - __u32
  73. - ``flags``
  74. - Pad flags, see :ref:`media-pad-flag` for more details.
  75. * - __u32
  76. - ``reserved[2]``
  77. - Reserved for future extensions. Drivers and applications must set
  78. the array to zero.
  79. .. c:type:: media_link_desc
  80. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  81. .. flat-table:: struct media_link_desc
  82. :header-rows: 0
  83. :stub-columns: 0
  84. :widths: 1 1 2
  85. * - struct :c:type:`media_pad_desc`
  86. - ``source``
  87. - Pad at the origin of this link.
  88. * - struct :c:type:`media_pad_desc`
  89. - ``sink``
  90. - Pad at the target of this link.
  91. * - __u32
  92. - ``flags``
  93. - Link flags, see :ref:`media-link-flag` for more details.
  94. * - __u32
  95. - ``reserved[2]``
  96. - Reserved for future extensions. Drivers and applications must set
  97. the array to zero.
  98. Return Value
  99. ============
  100. On success 0 is returned, on error -1 and the ``errno`` variable is set
  101. appropriately. The generic error codes are described at the
  102. :ref:`Generic Error Codes <gen-errors>` chapter.
  103. EINVAL
  104. The struct :c:type:`media_links_enum` ``id``
  105. references a non-existing entity.