1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun.. c:namespace:: MC 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun.. _media_ioc_enum_links: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun************************** 7*4882a593Smuzhiyunioctl MEDIA_IOC_ENUM_LINKS 8*4882a593Smuzhiyun************************** 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunName 11*4882a593Smuzhiyun==== 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunMEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSynopsis 16*4882a593Smuzhiyun======== 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun.. c:macro:: MEDIA_IOC_ENUM_LINKS 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun``int ioctl(int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp)`` 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunArguments 23*4882a593Smuzhiyun========= 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun``fd`` 26*4882a593Smuzhiyun File descriptor returned by :c:func:`open()`. 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun``argp`` 29*4882a593Smuzhiyun Pointer to struct :c:type:`media_links_enum`. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunDescription 32*4882a593Smuzhiyun=========== 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunTo enumerate pads and/or links for a given entity, applications set the 35*4882a593Smuzhiyunentity field of a struct :c:type:`media_links_enum` 36*4882a593Smuzhiyunstructure and initialize the struct 37*4882a593Smuzhiyun:c:type:`media_pad_desc` and struct 38*4882a593Smuzhiyun:c:type:`media_link_desc` structure arrays pointed by 39*4882a593Smuzhiyunthe ``pads`` and ``links`` fields. They then call the 40*4882a593SmuzhiyunMEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure. 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunIf the ``pads`` field is not NULL, the driver fills the ``pads`` array 43*4882a593Smuzhiyunwith information about the entity's pads. The array must have enough 44*4882a593Smuzhiyunroom to store all the entity's pads. The number of pads can be retrieved 45*4882a593Smuzhiyunwith :ref:`MEDIA_IOC_ENUM_ENTITIES`. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunIf the ``links`` field is not NULL, the driver fills the ``links`` array 48*4882a593Smuzhiyunwith information about the entity's outbound links. The array must have 49*4882a593Smuzhiyunenough room to store all the entity's outbound links. The number of 50*4882a593Smuzhiyunoutbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`. 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunOnly forward links that originate at one of the entity's source pads are 53*4882a593Smuzhiyunreturned during the enumeration process. 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun.. c:type:: media_links_enum 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun.. flat-table:: struct media_links_enum 60*4882a593Smuzhiyun :header-rows: 0 61*4882a593Smuzhiyun :stub-columns: 0 62*4882a593Smuzhiyun :widths: 1 1 2 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun * - __u32 65*4882a593Smuzhiyun - ``entity`` 66*4882a593Smuzhiyun - Entity id, set by the application. 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun * - struct :c:type:`media_pad_desc` 69*4882a593Smuzhiyun - \*\ ``pads`` 70*4882a593Smuzhiyun - Pointer to a pads array allocated by the application. Ignored if 71*4882a593Smuzhiyun NULL. 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun * - struct :c:type:`media_link_desc` 74*4882a593Smuzhiyun - \*\ ``links`` 75*4882a593Smuzhiyun - Pointer to a links array allocated by the application. Ignored if 76*4882a593Smuzhiyun NULL. 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun * - __u32 79*4882a593Smuzhiyun - ``reserved[4]`` 80*4882a593Smuzhiyun - Reserved for future extensions. Drivers and applications must set 81*4882a593Smuzhiyun the array to zero. 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun.. c:type:: media_pad_desc 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun.. flat-table:: struct media_pad_desc 88*4882a593Smuzhiyun :header-rows: 0 89*4882a593Smuzhiyun :stub-columns: 0 90*4882a593Smuzhiyun :widths: 1 1 2 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun * - __u32 93*4882a593Smuzhiyun - ``entity`` 94*4882a593Smuzhiyun - ID of the entity this pad belongs to. 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun * - __u16 97*4882a593Smuzhiyun - ``index`` 98*4882a593Smuzhiyun - Pad index, starts at 0. 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun * - __u32 101*4882a593Smuzhiyun - ``flags`` 102*4882a593Smuzhiyun - Pad flags, see :ref:`media-pad-flag` for more details. 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun * - __u32 105*4882a593Smuzhiyun - ``reserved[2]`` 106*4882a593Smuzhiyun - Reserved for future extensions. Drivers and applications must set 107*4882a593Smuzhiyun the array to zero. 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun.. c:type:: media_link_desc 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun.. flat-table:: struct media_link_desc 115*4882a593Smuzhiyun :header-rows: 0 116*4882a593Smuzhiyun :stub-columns: 0 117*4882a593Smuzhiyun :widths: 1 1 2 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun * - struct :c:type:`media_pad_desc` 120*4882a593Smuzhiyun - ``source`` 121*4882a593Smuzhiyun - Pad at the origin of this link. 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun * - struct :c:type:`media_pad_desc` 124*4882a593Smuzhiyun - ``sink`` 125*4882a593Smuzhiyun - Pad at the target of this link. 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun * - __u32 128*4882a593Smuzhiyun - ``flags`` 129*4882a593Smuzhiyun - Link flags, see :ref:`media-link-flag` for more details. 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun * - __u32 132*4882a593Smuzhiyun - ``reserved[2]`` 133*4882a593Smuzhiyun - Reserved for future extensions. Drivers and applications must set 134*4882a593Smuzhiyun the array to zero. 135*4882a593Smuzhiyun 136*4882a593SmuzhiyunReturn Value 137*4882a593Smuzhiyun============ 138*4882a593Smuzhiyun 139*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set 140*4882a593Smuzhiyunappropriately. The generic error codes are described at the 141*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter. 142*4882a593Smuzhiyun 143*4882a593SmuzhiyunEINVAL 144*4882a593Smuzhiyun The struct :c:type:`media_links_enum` ``id`` 145*4882a593Smuzhiyun references a non-existing entity. 146