lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200902152930.mniirxa4iln2fqri@medion>
Date:   Wed, 2 Sep 2020 16:29:30 +0100
From:   Alex Dewar <alex.dewar90@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Alex Dewar <alex.dewar90@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Christian Brauner <christian.brauner@...ntu.com>,
        "David S. Miller" <davem@...emloft.net>,
        Nayna Jain <nayna@...ux.ibm.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Sourabh Jain <sourabhjain@...ux.ibm.com>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 0/2] simple sysfs wrappers for single values

On Sat, Aug 29, 2020 at 06:23:13PM -0700, Joe Perches wrote:
> On Sat, 2020-08-29 at 17:28 -0700, Joe Perches wrote:
> > On Sun, 2020-08-30 at 00:37 +0100, Alex Dewar wrote:
> > > Hi all,
> > > 
> > > I've noticed there seems to have been a fair amount of discussion around
> > > the subject of possible helper methods for use in the context of sysfs
> > > show methods (which I haven't had a chance to go through in detail yet
> > > -- sorry!), so I thought I'd send out a couple of patches I've been
> > > working on for this, in case it's of any interest to anyone.
> > 
> > If you really want to do this, I suggest you get use
> > wrappers like sysfs_emit_string, sysfs_emit_int, sysfs_emit_u64
> > though I don't see _that_ much value.
> 
> Just fyi:
> 
> the treewide converted sysfs_emit uses
> end up with these integer outputs:

Thanks for looking at the code. It does look like my approach was a bit
too simplistic!

> 
> $ git grep -P -oh 'sysfs_emit\(buf, "%\d*[luixd]*\\n"' | \
>   sort | uniq -c | sort -rn
>    1482 sysfs_emit(buf, "%d\n"
>     549 sysfs_emit(buf, "%u\n"
>     118 sysfs_emit(buf, "%ld\n"
>     100 sysfs_emit(buf, "%lu\n"
>      78 sysfs_emit(buf, "%llu\n"
>      62 sysfs_emit(buf, "%i\n"
>      47 sysfs_emit(buf, "%x\n"
>      24 sysfs_emit(buf, "%lld\n"
>      12 sysfs_emit(buf, "%llx\n"
>      12 sysfs_emit(buf, "%08x\n"
>      12 sysfs_emit(buf, "%02x\n"
>      10 sysfs_emit(buf, "%016llx\n"
>       8 sysfs_emit(buf, "%04x\n"
>       6 sysfs_emit(buf, "%lx\n"
>       5 sysfs_emit(buf, "%02d\n"
>       4 sysfs_emit(buf, "%04d\n"
>       2 sysfs_emit(buf, "%08lx\n"
>       1 sysfs_emit(buf, "%li\n"
>       1 sysfs_emit(buf, "%4x\n"
>       1 sysfs_emit(buf, "%0x\n"
>       1 sysfs_emit(buf, "%06x\n"
>       1 sysfs_emit(buf, "%03x\n"
>       1 sysfs_emit(buf, "%01x\n"
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ