Infer open mode.