18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: MC 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _media_ioc_enum_links: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci************************** 78c2ecf20Sopenharmony_ciioctl MEDIA_IOC_ENUM_LINKS 88c2ecf20Sopenharmony_ci************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciMEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: MEDIA_IOC_ENUM_LINKS 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`media_links_enum`. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciTo enumerate pads and/or links for a given entity, applications set the 358c2ecf20Sopenharmony_cientity field of a struct :c:type:`media_links_enum` 368c2ecf20Sopenharmony_cistructure and initialize the struct 378c2ecf20Sopenharmony_ci:c:type:`media_pad_desc` and struct 388c2ecf20Sopenharmony_ci:c:type:`media_link_desc` structure arrays pointed by 398c2ecf20Sopenharmony_cithe ``pads`` and ``links`` fields. They then call the 408c2ecf20Sopenharmony_ciMEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure. 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciIf the ``pads`` field is not NULL, the driver fills the ``pads`` array 438c2ecf20Sopenharmony_ciwith information about the entity's pads. The array must have enough 448c2ecf20Sopenharmony_ciroom to store all the entity's pads. The number of pads can be retrieved 458c2ecf20Sopenharmony_ciwith :ref:`MEDIA_IOC_ENUM_ENTITIES`. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciIf the ``links`` field is not NULL, the driver fills the ``links`` array 488c2ecf20Sopenharmony_ciwith information about the entity's outbound links. The array must have 498c2ecf20Sopenharmony_cienough room to store all the entity's outbound links. The number of 508c2ecf20Sopenharmony_cioutbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciOnly forward links that originate at one of the entity's source pads are 538c2ecf20Sopenharmony_cireturned during the enumeration process. 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci.. c:type:: media_links_enum 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci.. flat-table:: struct media_links_enum 608c2ecf20Sopenharmony_ci :header-rows: 0 618c2ecf20Sopenharmony_ci :stub-columns: 0 628c2ecf20Sopenharmony_ci :widths: 1 1 2 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci * - __u32 658c2ecf20Sopenharmony_ci - ``entity`` 668c2ecf20Sopenharmony_ci - Entity id, set by the application. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci * - struct :c:type:`media_pad_desc` 698c2ecf20Sopenharmony_ci - \*\ ``pads`` 708c2ecf20Sopenharmony_ci - Pointer to a pads array allocated by the application. Ignored if 718c2ecf20Sopenharmony_ci NULL. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci * - struct :c:type:`media_link_desc` 748c2ecf20Sopenharmony_ci - \*\ ``links`` 758c2ecf20Sopenharmony_ci - Pointer to a links array allocated by the application. Ignored if 768c2ecf20Sopenharmony_ci NULL. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci * - __u32 798c2ecf20Sopenharmony_ci - ``reserved[4]`` 808c2ecf20Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 818c2ecf20Sopenharmony_ci the array to zero. 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci.. c:type:: media_pad_desc 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci.. flat-table:: struct media_pad_desc 888c2ecf20Sopenharmony_ci :header-rows: 0 898c2ecf20Sopenharmony_ci :stub-columns: 0 908c2ecf20Sopenharmony_ci :widths: 1 1 2 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci * - __u32 938c2ecf20Sopenharmony_ci - ``entity`` 948c2ecf20Sopenharmony_ci - ID of the entity this pad belongs to. 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci * - __u16 978c2ecf20Sopenharmony_ci - ``index`` 988c2ecf20Sopenharmony_ci - Pad index, starts at 0. 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci * - __u32 1018c2ecf20Sopenharmony_ci - ``flags`` 1028c2ecf20Sopenharmony_ci - Pad flags, see :ref:`media-pad-flag` for more details. 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci * - __u32 1058c2ecf20Sopenharmony_ci - ``reserved[2]`` 1068c2ecf20Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 1078c2ecf20Sopenharmony_ci the array to zero. 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci.. c:type:: media_link_desc 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci.. flat-table:: struct media_link_desc 1158c2ecf20Sopenharmony_ci :header-rows: 0 1168c2ecf20Sopenharmony_ci :stub-columns: 0 1178c2ecf20Sopenharmony_ci :widths: 1 1 2 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci * - struct :c:type:`media_pad_desc` 1208c2ecf20Sopenharmony_ci - ``source`` 1218c2ecf20Sopenharmony_ci - Pad at the origin of this link. 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci * - struct :c:type:`media_pad_desc` 1248c2ecf20Sopenharmony_ci - ``sink`` 1258c2ecf20Sopenharmony_ci - Pad at the target of this link. 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci * - __u32 1288c2ecf20Sopenharmony_ci - ``flags`` 1298c2ecf20Sopenharmony_ci - Link flags, see :ref:`media-link-flag` for more details. 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci * - __u32 1328c2ecf20Sopenharmony_ci - ``reserved[2]`` 1338c2ecf20Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 1348c2ecf20Sopenharmony_ci the array to zero. 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciReturn Value 1378c2ecf20Sopenharmony_ci============ 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 1408c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 1418c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ciEINVAL 1448c2ecf20Sopenharmony_ci The struct :c:type:`media_links_enum` ``id`` 1458c2ecf20Sopenharmony_ci references a non-existing entity. 146