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