Here's what I have done. Mine is a homebrew camper but you may be able to do something similar.
Here it is whilst driving. Covers, pillows, sleeping bags behind it.
Easily folds down to get the stuff.
Can quickly be taken off to get the kids up or down. You can see here where the brackets are screwed onto the bed board that slides forwards and backwards. You can also see the shed latch to stop it sliding forward. However, weight and friction means it never moves but they are there anyway.
If you've not guessed by now it's a child's bed guard. Cost about £10 second hand off ebay.
Jon.
1982 Diesel hightop. 1Y engine. Still work in progress but running and taking us on holidays.