Add an optional mode for mkdir

This is a back-compatible change, to be able to choose a mode for mkdir.