Rock type effects porosity - igneous tend to be low porosity.
Sorting degree effects porosity, well sorted are high porosity and poor sorting causes a low porosity due to finer grains filling in the gaps.
Level of diagenesis can affect porosity, loose and unconsolidated leads to high porosity and compacted sediments have a low porosity.
Porosity reduces during burial because grains are compacted together and water is squeezed out, cement also precipitates between the grains to fill the pores.
Rounded grains create a high porosity, angular grains create a low porosity because they fit together better.
Grain size does not affect porosity.
Rocks have a secondary porosity due to joints, fractures and faults - particularly in limestone.
Permeability is the capacity of a rock to allow fluids to pass through.
Permeability is controlled by:
Connectivity of pores
Grain size
Coarse - high permeability due to less resistance from friction.
Number and size of joints and fractures.
Effective porosity is the volume of connected pores in a unit volume of rock. Clay has a 50% porosity but a 0% effective porosity.