Hi,
On Thu, Jul 18, 2019 at 10:39 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 17/07/2019 22:28, Vijay Kumar Banerjee wrote:
> > +static int
> > +testmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
> > +         int nprot, vm_memattr_t *memattr)
> > +{
> > +     test_state *state = dev->si_drv1;
> > +
> > +     assert(memattr == VM_MEMATTR_DEFAULT);
> > +     assert(paddr != NULL);
> > +     assert(nprot != PROT_NONE);
>
> If you know the value in your test, then test for this value. You should
> avoid != tests whenever possible.
>
> Understood.

> Here the nprot should be PROT_READ | PROT_WRITE?
>
> Yes.

> Does the MAP_SHARED not end up here somehow?
>
> The MAP* flags are checked by the RTEMS mmap before calling the mmap
handler, so it doesn't end up here. The map parameters are used to check
erros and set the other attributes accordingly. The mmap handler is called
with only the mapping->addr parameter and the mapping->flags is not passed.

Just to make sure I understood properly, should the asserts be like :
```
assert(paddr != NULL);
assert(memattr == VM_MEMATTR_DEFAULT);
assert(nprot == PROT_READ | PROT_WRITE);
```

> > +     assert(*state == TEST_KQFILTER);
> > +     *state = TEST_MMAP;
> > +
> > +     return 0;
> > +}
> > +
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to