[Patch v3 1/6] introduce several basic utility function