def countFreeEntries(behavior, buf)
      num_free = 0
      0.step(buf.size - 1, DIR_ENT_SIZE) do |offset|
        if isFree(buf[offset], behavior)
          num_free += 1
        else
          return num_free
        end
      end
      num_free
    end
def countFreeEntries(behavior, buf)
      num_free = 0
      0.step(buf.size - 1, DIR_ENT_SIZE) do |offset|
        if isFree(buf[offset], behavior)
          num_free += 1
        else
          return num_free
        end
      end
      num_free
    end
Return the number of contiguous free entries starting at buf[0] according to behavior.