1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _media_ioc_enum_links:
6 **************************
7 ioctl MEDIA_IOC_ENUM_LINKS
8 **************************
13 MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
18 .. c:macro:: MEDIA_IOC_ENUM_LINKS
20 ``int ioctl(int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp)``
26 File descriptor returned by :c:func:`open()`.
29 Pointer to struct :c:type:`media_links_enum`.
34 To enumerate pads and/or links for a given entity, applications set the
35 entity field of a struct :c:type:`media_links_enum`
36 structure and initialize the struct
37 :c:type:`media_pad_desc` and struct
38 :c:type:`media_link_desc` structure arrays pointed by
39 the ``pads`` and ``links`` fields. They then call the
40 MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
42 If the ``pads`` field is not NULL, the driver fills the ``pads`` array
43 with information about the entity's pads. The array must have enough
44 room to store all the entity's pads. The number of pads can be retrieved
45 with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
47 If the ``links`` field is not NULL, the driver fills the ``links`` array
48 with information about the entity's outbound links. The array must have
49 enough room to store all the entity's outbound links. The number of
50 outbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
52 Only forward links that originate at one of the entity's source pads are
53 returned during the enumeration process.
55 .. c:type:: media_links_enum
57 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
59 .. flat-table:: struct media_links_enum
66 - Entity id, set by the application.
68 * - struct :c:type:`media_pad_desc`
70 - Pointer to a pads array allocated by the application. Ignored if
73 * - struct :c:type:`media_link_desc`
75 - Pointer to a links array allocated by the application. Ignored if
80 - Reserved for future extensions. Drivers and applications must set
83 .. c:type:: media_pad_desc
85 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
87 .. flat-table:: struct media_pad_desc
94 - ID of the entity this pad belongs to.
98 - Pad index, starts at 0.
102 - Pad flags, see :ref:`media-pad-flag` for more details.
106 - Reserved for future extensions. Drivers and applications must set
110 .. c:type:: media_link_desc
112 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
114 .. flat-table:: struct media_link_desc
119 * - struct :c:type:`media_pad_desc`
121 - Pad at the origin of this link.
123 * - struct :c:type:`media_pad_desc`
125 - Pad at the target of this link.
129 - Link flags, see :ref:`media-link-flag` for more details.
133 - Reserved for future extensions. Drivers and applications must set
139 On success 0 is returned, on error -1 and the ``errno`` variable is set
140 appropriately. The generic error codes are described at the
141 :ref:`Generic Error Codes <gen-errors>` chapter.
144 The struct :c:type:`media_links_enum` ``id``
145 references a non-existing entity.