From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Blaise Boscaccy <bboscaccy@linux.microsoft.com>
Subject: Re: [PATCH] oid_registry: allow arbitrary size OIDs
Date: Tue, 25 Nov 2025 17:12:30 -0500 [thread overview]
Message-ID: <799a5022a9d427f6fb47005f7f3259bd14932e88.camel@HansenPartnership.com> (raw)
In-Reply-To: <3954380.1764102837@warthog.procyon.org.uk>
On Tue, 2025-11-25 at 20:33 +0000, David Howells wrote:
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
>
> > This isn't usually a problem
> > except that it prevents us from representing the 2.25. prefix OIDs
> > which are the OID representation of UUIDs and have a 128 bit number
> > following the prefix.
>
> Ewww.
Yes, well, not responsible for standards bodies ...
>
> > Rather than import not often used perl arithmetic modules,
>
> Do they not work? Or are they just not commonly installed?
A bit of both: Math::Int128 looked like it might solve my problem but
SUSE doesn't build it. Math::BigInt is built but has a really horrible
API. bc is actually an improvement: it's just really converting
decimal to binary at arbitrary size then we just do string operations
on long strings of binary numbers ... it's easier than actual maths ...
>
> > + # Base128 encode the number
> > + my $j;
> > + my $b;
> > + for ($j = 0; $j < $tmp; $j++) {
>
> I would do:
>
> for (my $j = 0; $j < $tmp; $j++) {
OK.
> > + $b = oct("0b".substr($c, $j * 7, 7));
>
> I would probably do "my $b = ..." here.
I can't do that: $b is used outside the scope.
> > +
> > + push @octets, $b | 0x80;
> > }
> > - push @octets, $c & 0x7f;
> > + $b = oct("0b".substr($c, $j * 7, 7));
> > + push @octets, $b;
>
> and just combine these two lines:
>
> push @octets, oct("0b".substr($c, $j * 7, 7));
Will do (it was actually that way until I added a debugging printk.
Regards,
James
>
> Using "oct("0b"...)" looks weird, but I guess it should work.
>
> David
>
next prev parent reply other threads:[~2025-11-25 22:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 18:19 James Bottomley
2025-11-25 18:33 ` Andrew Morton
2025-11-25 20:33 ` David Howells
2025-11-25 22:12 ` James Bottomley [this message]
2025-11-25 20:35 ` David Howells
2025-11-25 22:03 ` James Bottomley
2025-11-26 19:22 ` [PATCH v2 1/1] " James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=799a5022a9d427f6fb47005f7f3259bd14932e88.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=bboscaccy@linux.microsoft.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®