Cleanup read and write routines.
Cleanup read and write routines.

Submitted-by: Andrew Thompson

NewEraCracker/pfsense,ch1c4um/pfsense,jxmx/pfsense,pfsense/pfsense,ch1c4um/pfsense,pfsense/pfsense,NOYB/pfsense,ch1c4um/pfsense,NewEraCracker/pfsense,dennypage/pfsense,NOYB/pfsense,ch1c4um/pfsense,NewEraCracker/pfsense,pfsense/pfsense,dennypage/pfsense,pfsense/pfsense,BlackstarGroup/pfsense,phil-davis/pfsense,dennypage/pfsense,NewEraCracker/pfsense,phil-davis/pfsense,jxmx/pfsense,phil-davis/pfsense,ptorsten/pfsense,ptorsten/pfsense,brunostein/pfsense,brunostein/pfsense,phil-davis/pfsense,dennypage/pfsense,ptorsten/pfsense,NOYB/pfsense,BlackstarGroup/pfsense,brunostein/pfsense,BlackstarGroup/pfsense,BlackstarGroup/pfsense,jxmx/pfsense