Re: [PATCH v2 5/6] debugfs: add debugfs_create_atomic64_t for atomic64_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 05, 2023 at 09:23:09AM -0700, Linus Torvalds wrote:
> On Wed, Apr 5, 2023 at 9:11 AM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
> >
> > Oh but I don't get the atomic incs, so we'd need debugfs_create_atomic_long_t().
> 
>   debugfs_create_ulong("total_mod_size",
>        0400, mod_debugfs_root,
>        &total_mod_size.counter);
> 
> but I didn't actually try to compile that kind of version.
> 
> (I think "counter" is actually a _signed_ long, so maybe the types don't match).

I see yes, sadly we'd have to cast to (unsigned long *) to make that
work as atomic_long counters are long long int:

   debugfs_create_ulong("total_mod_size",
        0400, mod_debugfs_root,
-        &total_mod_size.counter);
+        (unsigned long *)&total_mod_size.counter);

That's:

unsigned long min bits 32
long long     min bits 64

But since we'd be doing our accounting in atomic_long and just use
debugfs for prints I think that's fine. Just a bit ugly.

  Luis



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux