<div dir="ltr"><div dir="ltr"><br><br></div>Hi,<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 18, 2019 at 10:39 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 17/07/2019 22:28, Vijay Kumar Banerjee wrote:<br>
> +static int<br>
> +testmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,<br>
> + int nprot, vm_memattr_t *memattr)<br>
> +{<br>
> + test_state *state = dev->si_drv1;<br>
> +<br>
> + assert(memattr == VM_MEMATTR_DEFAULT);<br>
> + assert(paddr != NULL);<br>
> + assert(nprot != PROT_NONE);<br>
<br>
If you know the value in your test, then test for this value. You should <br>
avoid != tests whenever possible.<br>
<br></blockquote><div>Understood. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Here the nprot should be PROT_READ | PROT_WRITE?<br>
<br></blockquote><div>Yes. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Does the MAP_SHARED not end up here somehow?<br>
<br></blockquote><div>The MAP* flags are checked by the RTEMS mmap before calling the mmap</div><div>handler, so it doesn't end up here. The map parameters are used to check </div><div>erros and set the other attributes accordingly. The mmap handler is called </div><div>with only the mapping->addr parameter and the mapping->flags is not passed.</div><div><br></div><div>Just to make sure I understood properly, should the asserts be like :</div><div>```</div><div>assert(paddr != NULL);<br>assert(memattr == VM_MEMATTR_DEFAULT);</div><div>assert(nprot == PROT_READ | PROT_WRITE);<br>```</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> + assert(*state == TEST_KQFILTER);<br>
> + *state = TEST_MMAP;<br>
> +<br>
> + return 0;<br>
> +}<br>
> +<br>
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone : +49 89 189 47 41-16<br>
Fax : +49 89 189 47 41-09<br>
E-Mail : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
PGP : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
</blockquote></div></div>