Thread (11 messages) 11 messages, 4 authors, 2026-03-16

Re: [PATCH RESEND 2/2] KVM: arm64: nv: Expose shadow page tables in debugfs

From: Wei-Lin Chang <hidden>
Date: 2026-03-16 10:52:42
Also in: kvmarm, lkml

On Sat, Mar 14, 2026 at 09:39:17AM +0000, Marc Zyngier wrote:
On Fri, 13 Mar 2026 22:28:38 +0000,
Wei-Lin Chang [off-list ref] wrote:
quoted
On Wed, Mar 11, 2026 at 03:41:32PM +0000, Sebastian Ene wrote:
quoted
On Sun, Mar 08, 2026 at 11:18:29PM +0000, Wei-Lin Chang wrote:
[...]
quoted
quoted
quoted
+void kvm_nested_s2_ptdump_create_debugfs(struct kvm_s2_mmu *mmu)
+{
+	struct dentry *dent;
+	/* format: 0x<vttbr>-0x<vtcr>-s2-{en, dis}abled\0 */
+	char file_name[2 + 16 + 1 + 2 + 16 + 4 + 3 + 6];
Can you hide the size of this definition behind a macro ?
Sure, no problem.
I don't think a macro helps that much on its own. I'd rather this is
made a bit more foolproof by directly expressing the actual string
this results into, and use that for the size:

  #define S2FNAMESZ sizeof("0x0123456789abcdef-0x0123456789abcdef-s2-disabled")

  char file_name[S2FNAME];

which is less ambiguous. The compiler will happily optimise this to a
nice constant that also accounts for the final '\0'.
Thanks for the advice!
Makes sense to me, I'll change it to that.

Thanks,
Wei-Lin Chang
Thanks,

	M.

-- 
Jazz isn't dead. It just smells funny.
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help