From nobody Sun Feb 8 14:13:01 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 711A02ECE91 for ; Mon, 19 Jan 2026 21:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768856688; cv=none; b=OXfDPIPlEssfikSIdijG/SOo+qhLRPRKyEc5jWFLvKjPBAtbI4z5P/X1CVu7yYB21tw80r/Kljc4FA3scetvvdzShwht4YgJttbM+UPm37BsIojIaipAxA5lfXhq5hrJ+hG7kV8GFEdI/woVN3m4z64ZKPyXv4SWQTFmgQNeJrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768856688; c=relaxed/simple; bh=f2SqH/fw4uU2GRKBJhy3PgUfEnkJ0k0kZ7Wj00Pd78A=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=av720/hDzxeBcxSpVQhs/7bPXsjPauY4CTMpQAU6Fdhrpr9g9Fx8sXYCXEGN8lBBjePEVLfPmMt1aVqepaedLyu+MM0sRZts63wuAHXjbtB49n6lyhuWF+ZufCSS2wU8jlyzsc6IZSOHZ/6xKpW3klEcKC0f+eo/pwWEwPqtKKY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=f0vyYj9I; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f0vyYj9I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768856686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oKSRzVqBoQOOo4lbHRVM5q4aKhOza8YqKKV/MGsaxoE=; b=f0vyYj9Iw81ColN45ABGJpDZjihpscYKB4nZYB3+w7MMQl/GMiFsSJCmY3dfmY/cewyfjj H4aYyT2ANRDYPfNr7nTvcorSvmMBWin8P7EWqkxPEh4w+s5JOT2yWdh4HylToqTDTDXOcQ txMv+LpJXVrH61yoVZ1yPxErVxBuvTs= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-naREuLfuMpWfuNh6olJyqQ-1; Mon, 19 Jan 2026 16:04:45 -0500 X-MC-Unique: naREuLfuMpWfuNh6olJyqQ-1 X-Mimecast-MFC-AGG-ID: naREuLfuMpWfuNh6olJyqQ_1768856684 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 31CD21956095; Mon, 19 Jan 2026 21:04:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC78D19560AB; Mon, 19 Jan 2026 21:04:41 +0000 (UTC) From: Wander Lairson Costa To: Steven Rostedt , Gabriele Monaco , Nam Cao , Wander Lairson Costa , linux-kernel@vger.kernel.org (open list), linux-trace-kernel@vger.kernel.org (open list:RUNTIME VERIFICATION (RV)) Subject: [PATCH 15/26] rv/rvgen: use class constant for init marker Date: Mon, 19 Jan 2026 17:45:51 -0300 Message-ID: <20260119205601.105821-16-wander@redhat.com> In-Reply-To: <20260119205601.105821-1-wander@redhat.com> References: <20260119205601.105821-1-wander@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Replace hardcoded string literal and magic number with a class constant for the initial state marker in DOT file parsing. The previous implementation used the magic string "__init_" directly in the code along with a hardcoded length of 7 for substring extraction, which made the code less maintainable and harder to understand. This change introduces a class constant init_marker to serve as a single source of truth for the initial state prefix. The code now uses startswith() for clearer intent and calculates the substring position dynamically using len(), eliminating the magic number. If the marker value needs to change in the future, only the constant definition requires updating rather than multiple locations in the code. The refactoring improves code readability and maintainability while preserving the exact same runtime behavior. Signed-off-by: Wander Lairson Costa Reviewed-by: Gabriele Monaco Reviewed-by: Nam Cao --- tools/verification/rvgen/rvgen/automata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/verification/rvgen/rvgen/automata.py b/tools/verificatio= n/rvgen/rvgen/automata.py index b302af3e5133e..8548265955570 100644 --- a/tools/verification/rvgen/rvgen/automata.py +++ b/tools/verification/rvgen/rvgen/automata.py @@ -25,6 +25,7 @@ class Automata: """ =20 invalid_state_str =3D "INVALID_STATE" + init_marker =3D "__init_" =20 def __init__(self, file_path, model_name=3DNone): self.__dot_path =3D file_path @@ -96,8 +97,8 @@ class Automata: =20 # "enabled_fired"}; -> enabled_fired state =3D raw_state.replace('"', '').replace('};', '').replace= (',', '_') - if state[0:7] =3D=3D "__init_": - initial_state =3D state[7:] + if state.startswith(self.init_marker): + initial_state =3D state[len(self.init_marker):] else: states.append(state) if "doublecircle" in self.__dot_lines[cursor]: --=20 2.52.0