Structure and switching of bacterial flagellar filaments studied by X-ray fiber diffraction