fs: factor out common code in fget() and fget_raw()