Merge branch 'for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu
[sfrench/cifs-2.6.git] / Documentation / media / uapi / mediactl / media-ioc-enum-entities.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _media_ioc_enum_entities:
4
5 *****************************
6 ioctl MEDIA_IOC_ENUM_ENTITIES
7 *****************************
8
9 Name
10 ====
11
12 MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties
13
14
15 Synopsis
16 ========
17
18 .. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp )
19     :name: MEDIA_IOC_ENUM_ENTITIES
20
21
22 Arguments
23 =========
24
25 ``fd``
26     File descriptor returned by :ref:`open() <media-func-open>`.
27
28 ``argp``
29     Pointer to struct :c:type:`media_entity_desc`.
30
31
32 Description
33 ===========
34
35 To query the attributes of an entity, applications set the id field of a
36 struct :c:type:`media_entity_desc` structure and
37 call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this
38 structure. The driver fills the rest of the structure or returns an
39 EINVAL error code when the id is invalid.
40
41 .. _media-ent-id-flag-next:
42
43 Entities can be enumerated by or'ing the id with the
44 ``MEDIA_ENT_ID_FLAG_NEXT`` flag. The driver will return information
45 about the entity with the smallest id strictly larger than the requested
46 one ('next entity'), or the ``EINVAL`` error code if there is none.
47
48 Entity IDs can be non-contiguous. Applications must *not* try to
49 enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing
50 id's until they get an error.
51
52
53 .. c:type:: media_entity_desc
54
55 .. tabularcolumns:: |p{1.5cm}|p{1.7cm}|p{1.6cm}|p{1.5cm}|p{11.2cm}|
56
57 .. flat-table:: struct media_entity_desc
58     :header-rows:  0
59     :stub-columns: 0
60     :widths: 1 1 1 1 8
61
62     *  -  __u32
63        -  ``id``
64        -
65        -
66        -  Entity ID, set by the application. When the ID is or'ed with
67           ``MEDIA_ENT_ID_FLAG_NEXT``, the driver clears the flag and returns
68           the first entity with a larger ID. Do not expect that the ID will
69           always be the same for each instance of the device. In other words,
70           do not hardcode entity IDs in an application.
71
72     *  -  char
73        -  ``name``\ [32]
74        -
75        -
76        -  Entity name as an UTF-8 NULL-terminated string. This name must be unique
77           within the media topology.
78
79     *  -  __u32
80        -  ``type``
81        -
82        -
83        -  Entity type, see :ref:`media-entity-functions` for details.
84
85     *  -  __u32
86        -  ``revision``
87        -
88        -
89        -  Entity revision. Always zero (obsolete)
90
91     *  -  __u32
92        -  ``flags``
93        -
94        -
95        -  Entity flags, see :ref:`media-entity-flag` for details.
96
97     *  -  __u32
98        -  ``group_id``
99        -
100        -
101        -  Entity group ID. Always zero (obsolete)
102
103     *  -  __u16
104        -  ``pads``
105        -
106        -
107        -  Number of pads
108
109     *  -  __u16
110        -  ``links``
111        -
112        -
113        -  Total number of outbound links. Inbound links are not counted in
114           this field.
115
116     *  -  __u32
117        -  ``reserved[4]``
118        -
119        -
120        -  Reserved for future extensions. Drivers and applications must set
121           the array to zero.
122
123     *  -  union
124
125     *  -
126        -  struct
127        -  ``dev``
128        -
129        -  Valid for (sub-)devices that create a single device node.
130
131     *  -
132        -
133        -  __u32
134        -  ``major``
135        -  Device node major number.
136
137     *  -
138        -
139        -  __u32
140        -  ``minor``
141        -  Device node minor number.
142
143     *  -
144        -  __u8
145        -  ``raw``\ [184]
146        -
147        -
148
149
150 Return Value
151 ============
152
153 On success 0 is returned, on error -1 and the ``errno`` variable is set
154 appropriately. The generic error codes are described at the
155 :ref:`Generic Error Codes <gen-errors>` chapter.
156
157 EINVAL
158     The struct :c:type:`media_entity_desc` ``id``
159     references a non-existing entity.