Resistive switching behaviors and mechanisms of HfS2 film memory devices studied by experiments and density functional theory calculations