Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb uAPI docs: document demux mmap/munmap syscalls

With the new dmx mmap interface, those two syscalls are now
handled by the subsystem. Document them.

This patch is based on the V4L2 text for those ioctls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

+172
+116
Documentation/media/uapi/dvb/dmx-mmap.rst
··· 1 + .. _dmx-mmap: 2 + 3 + ***************** 4 + Digital TV mmap() 5 + ***************** 6 + 7 + Name 8 + ==== 9 + 10 + dmx-mmap - Map device memory into application address space 11 + 12 + .. warning:: this API is still experimental 13 + 14 + Synopsis 15 + ======== 16 + 17 + .. code-block:: c 18 + 19 + #include <unistd.h> 20 + #include <sys/mman.h> 21 + 22 + 23 + .. c:function:: void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset ) 24 + :name: dmx-mmap 25 + 26 + Arguments 27 + ========= 28 + 29 + ``start`` 30 + Map the buffer to this address in the application's address space. 31 + When the ``MAP_FIXED`` flag is specified, ``start`` must be a 32 + multiple of the pagesize and mmap will fail when the specified 33 + address cannot be used. Use of this option is discouraged; 34 + applications should just specify a ``NULL`` pointer here. 35 + 36 + ``length`` 37 + Length of the memory area to map. This must be a multiple of the 38 + DVB packet length (188, on most drivers). 39 + 40 + ``prot`` 41 + The ``prot`` argument describes the desired memory protection. 42 + Regardless of the device type and the direction of data exchange it 43 + should be set to ``PROT_READ`` | ``PROT_WRITE``, permitting read 44 + and write access to image buffers. Drivers should support at least 45 + this combination of flags. 46 + 47 + ``flags`` 48 + The ``flags`` parameter specifies the type of the mapped object, 49 + mapping options and whether modifications made to the mapped copy of 50 + the page are private to the process or are to be shared with other 51 + references. 52 + 53 + ``MAP_FIXED`` requests that the driver selects no other address than 54 + the one specified. If the specified address cannot be used, 55 + :ref:`mmap() <dmx-mmap>` will fail. If ``MAP_FIXED`` is specified, 56 + ``start`` must be a multiple of the pagesize. Use of this option is 57 + discouraged. 58 + 59 + One of the ``MAP_SHARED`` or ``MAP_PRIVATE`` flags must be set. 60 + ``MAP_SHARED`` allows applications to share the mapped memory with 61 + other (e. g. child-) processes. 62 + 63 + .. note:: 64 + 65 + The Linux Digital TV applications should not set the 66 + ``MAP_PRIVATE``, ``MAP_DENYWRITE``, ``MAP_EXECUTABLE`` or ``MAP_ANON`` 67 + flags. 68 + 69 + ``fd`` 70 + File descriptor returned by :ref:`open() <dmx_fopen>`. 71 + 72 + ``offset`` 73 + Offset of the buffer in device memory, as returned by 74 + :ref:`DMX_QUERYBUF` ioctl. 75 + 76 + 77 + Description 78 + =========== 79 + 80 + The :ref:`mmap() <dmx-mmap>` function asks to map ``length`` bytes starting at 81 + ``offset`` in the memory of the device specified by ``fd`` into the 82 + application address space, preferably at address ``start``. This latter 83 + address is a hint only, and is usually specified as 0. 84 + 85 + Suitable length and offset parameters are queried with the 86 + :ref:`DMX_QUERYBUF` ioctl. Buffers must be allocated with the 87 + :ref:`DMX_REQBUFS` ioctl before they can be queried. 88 + 89 + To unmap buffers the :ref:`munmap() <dmx-munmap>` function is used. 90 + 91 + 92 + Return Value 93 + ============ 94 + 95 + On success :ref:`mmap() <dmx-mmap>` returns a pointer to the mapped buffer. On 96 + error ``MAP_FAILED`` (-1) is returned, and the ``errno`` variable is set 97 + appropriately. Possible error codes are: 98 + 99 + EBADF 100 + ``fd`` is not a valid file descriptor. 101 + 102 + EACCES 103 + ``fd`` is not open for reading and writing. 104 + 105 + EINVAL 106 + The ``start`` or ``length`` or ``offset`` are not suitable. (E. g. 107 + they are too large, or not aligned on a ``PAGESIZE`` boundary.) 108 + 109 + The ``flags`` or ``prot`` value is not supported. 110 + 111 + No buffers have been allocated with the 112 + :ref:`DMX_REQBUFS` ioctl. 113 + 114 + ENOMEM 115 + Not enough physical or virtual memory was available to complete the 116 + request.
+54
Documentation/media/uapi/dvb/dmx-munmap.rst
··· 1 + .. _dmx-munmap: 2 + 3 + ************ 4 + DVB munmap() 5 + ************ 6 + 7 + Name 8 + ==== 9 + 10 + dmx-munmap - Unmap device memory 11 + 12 + .. warning:: This API is still experimental. 13 + 14 + 15 + Synopsis 16 + ======== 17 + 18 + .. code-block:: c 19 + 20 + #include <unistd.h> 21 + #include <sys/mman.h> 22 + 23 + 24 + .. c:function:: int munmap( void *start, size_t length ) 25 + :name: dmx-munmap 26 + 27 + Arguments 28 + ========= 29 + 30 + ``start`` 31 + Address of the mapped buffer as returned by the 32 + :ref:`mmap() <dmx-mmap>` function. 33 + 34 + ``length`` 35 + Length of the mapped buffer. This must be the same value as given to 36 + :ref:`mmap() <dmx-mmap>`. 37 + 38 + 39 + Description 40 + =========== 41 + 42 + Unmaps a previously with the :ref:`mmap() <dmx-mmap>` function mapped 43 + buffer and frees it, if possible. 44 + 45 + 46 + Return Value 47 + ============ 48 + 49 + On success :ref:`munmap() <dmx-munmap>` returns 0, on failure -1 and the 50 + ``errno`` variable is set appropriately: 51 + 52 + EINVAL 53 + The ``start`` or ``length`` is incorrect, or no buffers have been 54 + mapped yet.
+2
Documentation/media/uapi/dvb/dmx_fcalls.rst
··· 13 13 dmx-fclose 14 14 dmx-fread 15 15 dmx-fwrite 16 + dmx-mmap 17 + dmx-munmap 16 18 dmx-start 17 19 dmx-stop 18 20 dmx-set-filter