github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_media.txt (about)

     1  # Copyright 2022 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <uapi/linux/media.h>
     5  
     6  resource fd_media[fd]
     7  resource fd_request[fd]
     8  resource media_entity_id[int32]: MEDIA_ENT_ID_FLAG_NEXT
     9  resource media_pad_index[int16]
    10  
    11  syz_open_dev$media(dev ptr[in, string["/dev/media#"]], id intptr, flags flags[open_flags]) fd_media
    12  
    13  ioctl$MEDIA_IOC_DEVICE_INFO(fd fd_media, cmd const[MEDIA_IOC_DEVICE_INFO], arg ptr[out, array[int8, MEDIA_DEVICE_INFO_SIZE]])
    14  ioctl$MEDIA_IOC_ENUM_ENTITIES(fd fd_media, cmd const[MEDIA_IOC_ENUM_ENTITIES], arg ptr[inout, media_entity_desc])
    15  ioctl$MEDIA_IOC_ENUM_LINKS(fd fd_media, cmd const[MEDIA_IOC_ENUM_LINKS], arg ptr[inout, media_links_enum])
    16  ioctl$MEDIA_IOC_SETUP_LINK(fd fd_media, cmd const[MEDIA_IOC_SETUP_LINK], arg ptr[in, media_link_desc])
    17  ioctl$MEDIA_IOC_G_TOPOLOGY(fd fd_media, cmd const[MEDIA_IOC_G_TOPOLOGY], arg ptr[inout, media_v2_topology])
    18  ioctl$MEDIA_IOC_REQUEST_ALLOC(fd fd_media, cmd const[MEDIA_IOC_REQUEST_ALLOC], arg ptr[out, fd_request])
    19  
    20  ioctl$MEDIA_REQUEST_IOC_QUEUE(fd fd_request, cmd const[MEDIA_REQUEST_IOC_QUEUE], arg const[0])
    21  ioctl$MEDIA_REQUEST_IOC_REINIT(fd fd_request, cmd const[MEDIA_REQUEST_IOC_REINIT], arg const[0])
    22  
    23  define MEDIA_DEVICE_INFO_SIZE	sizeof(struct media_device_info)
    24  define MEDIA_ENTITY_DESC_SIZE	sizeof(struct media_entity_desc)
    25  
    26  media_entity_desc {
    27  	id	media_entity_id	(in)
    28  } [size[MEDIA_ENTITY_DESC_SIZE]]
    29  
    30  media_links_enum {
    31  	entity		media_entity_id	(in)
    32  	pads		ptr[out, array[media_pad_desc, 2]]
    33  	links		ptr[out, array[media_link_desc, 2]]
    34  	reserved	array[const[0, int32], 4]
    35  }
    36  
    37  media_link_desc {
    38  	source		media_pad_desc
    39  	sink		media_pad_desc
    40  	flags		flags[media_link_flags, int32]
    41  	reserved	array[int32, 2]
    42  }
    43  
    44  media_link_flags = MEDIA_LNK_FL_ENABLED, MEDIA_LNK_FL_IMMUTABLE, MEDIA_LNK_FL_DYNAMIC, MEDIA_LNK_FL_DATA_LINK, MEDIA_LNK_FL_INTERFACE_LINK
    45  
    46  media_pad_desc {
    47  	entity		media_entity_id
    48  	index		media_pad_index
    49  	flags		flags[media_pad_flags, int32]
    50  	reserved	array[int32, 2]
    51  }
    52  
    53  media_pad_flags = MEDIA_PAD_FL_SINK, MEDIA_PAD_FL_SOURCE, MEDIA_PAD_FL_MUST_CONNECT
    54  
    55  media_v2_topology {
    56  	topology_version	int64	(out)
    57  	num_entities		len[ptr_entities, int32]
    58  	reserved1		const[0, int32]
    59  	ptr_entities		ptr64[out, array[media_v2_entity]]
    60  	num_interfaces		len[ptr_interfaces, int32]
    61  	reserved2		const[0, int32]
    62  	ptr_interfaces		ptr64[out, array[media_v2_interface]]
    63  	num_pads		len[ptr_pads, int32]
    64  	reserved3		const[0, int32]
    65  	ptr_pads		ptr64[out, array[media_v2_pad]]
    66  	num_links		len[ptr_links, int32]
    67  	reserved4		const[0, int32]
    68  	ptr_links		ptr64[out, array[media_v2_link]]
    69  } [packed]
    70  
    71  media_v2_entity {
    72  	id		media_entity_id
    73  	name		array[int8, 64]
    74  	function	int32
    75  	flags		int32
    76  	reserved	array[int32, 5]
    77  } [packed]
    78  
    79  media_v2_interface {
    80  	id		int32
    81  	intf_type	int32
    82  	flags		int32
    83  	reserved	array[int32, 9]
    84  	raw		array[int32, 16]
    85  } [packed]
    86  
    87  media_v2_pad {
    88  	id		int32
    89  	entity_id	media_entity_id
    90  	flags		int32
    91  # The v1 pad indexes are int16, so we use int16 as resource base,
    92  # but v2 pad indexes are int32, so we need the pad.
    93  	index		padto32[media_pad_index]
    94  	reserved	array[int32, 4]
    95  } [packed]
    96  
    97  media_v2_link {
    98  	id		int32
    99  	source_id	int32
   100  	sink_id		int32
   101  	flags		int32
   102  	reserved	array[int32, 6]
   103  } [packed]