Nayzer
Nayzer

Reputation: 247

How can I create a fake device file to mimic dev/mem?

I want to control the access to dev/mem.

In order to do so, I am thinking of creating a fake dev/mem, so that processes access it instead of the actual dev/mem.

My process would then modify dev/mem depending on the changes in the fake one.

Is that possible? If so, how do I do this?

Upvotes: 0

Views: 845

Answers (1)

subin
subin

Reputation: 490

Look at drivers/char/mem.c, in chr_dev_init(), remove the register, class_create, device_create calls. Move these calls to your driver and from your driver's read/write calls, directly call the ones in mem.c

Upvotes: 2

Related Questions