* Re: Contribution [not found] <mailman.37.1492012806.25481.grub-devel@gnu.org> @ 2017-04-12 16:51 ` Nicole 2017-04-12 17:03 ` Contribution Xen 2017-04-12 18:25 ` Contributions Nicole 1 sibling, 1 reply; 8+ messages in thread From: Nicole @ 2017-04-12 16:51 UTC (permalink / raw) To: grub-devel Thank you for your kind reply, Vladimir. I failed to find the probe command - I promise - I spent quite a few hours digging through the source. As for the $((...)) and $[...] - I'll look into it. It seems that my paltry contributions are not needed, after all. Nicole > Date: Wed, 12 Apr 2017 10:41:19 +0000 > From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com> > To: The development of GNU GRUB <grub-devel@gnu.org> > Subject: Re: Contribution > Message-ID: > <CAEaD8JNP896sLDK90ERqZT6i38WD1g8Wy1DwrnoneKQ2zka5Vw@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > On Wed, Apr 12, 2017, 20:37 Nicole <nicole.king464@gmail.com> wrote: > >> I have written two small, simple modules to address limitations I found >> in in Grub. >> >> 1. does simple arithmetic - nothing fancy. It's invoked by using >> something like this: >> >> insmod arithmetic >> arithmetic --set fred --min 2 -- max 10 "1" "+" "2" >> >> the operators supported are unary -,!; binary +,-,/,*,%,<,<=,<.<=,!=,== >> --set works in the usual way. If the result is greater than --max, the >> --min value is returned and vice versa; this useful for cycling round a >> group of partitions in a round-robin fashion >> > Can you have a look if we can have bash syntax $((...)) and $[...] instead? > It's more compact and nicer. > >> >> 2. diskinfo.mod introduces two commands: disklabel, diskuuid which >> return the label and uuid of the specified disk partition. This is >> useful where, having decided which partition, amongst several, to boot, >> you can fill in the appropriate value in the "root=UUID=" or >> "root=label=" Linux kernel parameter. >> > Have a look at probe command. Does it cover your usecase? > >> >> I looked for details on how to submit new modules, but failed to find >> anything. How do I go about this? >> > Just send patches here. > >> >> Nicole >> >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel >> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Contribution 2017-04-12 16:51 ` Contribution Nicole @ 2017-04-12 17:03 ` Xen 2017-04-12 20:06 ` Contribution Vladimir 'phcoder' Serbinenko 0 siblings, 1 reply; 8+ messages in thread From: Xen @ 2017-04-12 17:03 UTC (permalink / raw) To: grub-devel Nicole schreef op 12-04-2017 18:51: > Thank you for your kind reply, Vladimir. I failed to find the probe > command - I promise - I spent quite a few hours digging through the > source. As for the $((...)) and $[...] - I'll look into it. > > It seems that my paltry contributions are not needed, after all. Bash syntax will not have the min/max behaviour though unless you use a kind of modulo which will make it complex. ie. normally you would do that with: x = (x + 1) mod 4, or x = (x - 1 + 4) mod 4. although I'm not sure a standard "round robin" function like that would be meaningful but who knows. so the " arithmetic --set fred --min 2 -- max 10 "1" "+" "2" " will come down to fred=$(( (((fred-2) + 1) % 8) + 2 )) -- I assume. Or if you still had those min/max functions it'd come down to ? arithmetic --set fred --min 2 --max 10 $(( fred + 1 )) ? Regards. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Contribution 2017-04-12 17:03 ` Contribution Xen @ 2017-04-12 20:06 ` Vladimir 'phcoder' Serbinenko 0 siblings, 0 replies; 8+ messages in thread From: Vladimir 'phcoder' Serbinenko @ 2017-04-12 20:06 UTC (permalink / raw) To: The development of GNU GRUB [-- Attachment #1: Type: text/plain, Size: 1168 bytes --] On Thu, Apr 13, 2017, 03:04 Xen <list@xenhideout.nl> wrote: > Nicole schreef op 12-04-2017 18:51: > > Thank you for your kind reply, Vladimir. I failed to find the probe > > command - I promise - I spent quite a few hours digging through the > > source. As for the $((...)) and $[...] - I'll look into it. > > > > It seems that my paltry contributions are not needed, after all. > > Bash syntax will not have the min/max behaviour though unless you use a > kind of modulo which will make it complex. > There is a $[a>b?a:b] syntax > > ie. normally you would do that with: x = (x + 1) mod 4, or x = (x - 1 + > 4) mod 4. > > although I'm not sure a standard "round robin" function like that would > be meaningful but who knows. > > so the " arithmetic --set fred --min 2 -- max 10 "1" "+" "2" " > > will come down to > > fred=$(( (((fred-2) + 1) % 8) + 2 )) -- I assume. Or if you still had > those min/max functions it'd come down to ? > > arithmetic --set fred --min 2 --max 10 $(( fred + 1 )) ? > > Regards. > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > [-- Attachment #2: Type: text/html, Size: 2476 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Contributions [not found] <mailman.37.1492012806.25481.grub-devel@gnu.org> 2017-04-12 16:51 ` Contribution Nicole @ 2017-04-12 18:25 ` Nicole 2017-04-12 20:08 ` Contributions Vladimir 'phcoder' Serbinenko 1 sibling, 1 reply; 8+ messages in thread From: Nicole @ 2017-04-12 18:25 UTC (permalink / raw) To: grub-devel I've looked carefully at both the parser and the lexer. It's a long while since I've used either of these tools, but I can find no reference to anything that does arithmetic. The only instance of plus signs that I can find are in the regular expressions and in the C code. There appears to be no provision to recognise a "$((" - the parser seems to expect only a variable name (with or without enclosing braces). "$[" is used for arrays in bash - in any case the lexer doesn't recognise it. Nicole ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Contributions 2017-04-12 18:25 ` Contributions Nicole @ 2017-04-12 20:08 ` Vladimir 'phcoder' Serbinenko 0 siblings, 0 replies; 8+ messages in thread From: Vladimir 'phcoder' Serbinenko @ 2017-04-12 20:08 UTC (permalink / raw) To: The development of GNU GRUB [-- Attachment #1: Type: text/plain, Size: 932 bytes --] On Thu, Apr 13, 2017, 04:25 Nicole <nicole.king464@gmail.com> wrote: > I've looked carefully at both the parser and the lexer. It's a long > while since I've used either of these tools, but I can find no reference > to anything that does arithmetic. The only instance of plus signs that I > can find are in the regular expressions and in the C code. There appears > to be no provision to recognise a "$((" - the parser seems to expect > only a variable name (with or without enclosing braces). "$[" is used > for arrays in bash - in any case the lexer doesn't recognise it. > I think you misunderstood me. The is no arithmetic currently. What I meant is that they may be better integrated if they are done using bash syntax rather than by having a separate command. > > Nicole > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > [-- Attachment #2: Type: text/html, Size: 1835 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.65479.1492027745.22739.grub-devel@gnu.org>]
* Re: Contribution [not found] <mailman.65479.1492027745.22739.grub-devel@gnu.org> @ 2017-04-12 20:57 ` Nicole 0 siblings, 0 replies; 8+ messages in thread From: Nicole @ 2017-04-12 20:57 UTC (permalink / raw) To: grub-devel Vladimir, Thanks for your attention. The modules are there if you want them, if not, I'll use them locally, only. Nicole ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.65311.1491983735.22739.grub-devel@gnu.org>]
* Contribution [not found] <mailman.65311.1491983735.22739.grub-devel@gnu.org> @ 2017-04-12 10:36 ` Nicole 2017-04-12 10:41 ` Contribution Vladimir 'phcoder' Serbinenko 0 siblings, 1 reply; 8+ messages in thread From: Nicole @ 2017-04-12 10:36 UTC (permalink / raw) To: grub-devel I have written two small, simple modules to address limitations I found in in Grub. 1. does simple arithmetic - nothing fancy. It's invoked by using something like this: insmod arithmetic arithmetic --set fred --min 2 -- max 10 "1" "+" "2" the operators supported are unary -,!; binary +,-,/,*,%,<,<=,<.<=,!=,== --set works in the usual way. If the result is greater than --max, the --min value is returned and vice versa; this useful for cycling round a group of partitions in a round-robin fashion 2. diskinfo.mod introduces two commands: disklabel, diskuuid which return the label and uuid of the specified disk partition. This is useful where, having decided which partition, amongst several, to boot, you can fill in the appropriate value in the "root=UUID=" or "root=label=" Linux kernel parameter. I looked for details on how to submit new modules, but failed to find anything. How do I go about this? Nicole ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Contribution 2017-04-12 10:36 ` Contribution Nicole @ 2017-04-12 10:41 ` Vladimir 'phcoder' Serbinenko 0 siblings, 0 replies; 8+ messages in thread From: Vladimir 'phcoder' Serbinenko @ 2017-04-12 10:41 UTC (permalink / raw) To: The development of GNU GRUB [-- Attachment #1: Type: text/plain, Size: 1385 bytes --] On Wed, Apr 12, 2017, 20:37 Nicole <nicole.king464@gmail.com> wrote: > I have written two small, simple modules to address limitations I found > in in Grub. > > 1. does simple arithmetic - nothing fancy. It's invoked by using > something like this: > > insmod arithmetic > arithmetic --set fred --min 2 -- max 10 "1" "+" "2" > > the operators supported are unary -,!; binary +,-,/,*,%,<,<=,<.<=,!=,== > --set works in the usual way. If the result is greater than --max, the > --min value is returned and vice versa; this useful for cycling round a > group of partitions in a round-robin fashion > Can you have a look if we can have bash syntax $((...)) and $[...] instead? It's more compact and nicer. > > 2. diskinfo.mod introduces two commands: disklabel, diskuuid which > return the label and uuid of the specified disk partition. This is > useful where, having decided which partition, amongst several, to boot, > you can fill in the appropriate value in the "root=UUID=" or > "root=label=" Linux kernel parameter. > Have a look at probe command. Does it cover your usecase? > > I looked for details on how to submit new modules, but failed to find > anything. How do I go about this? > Just send patches here. > > Nicole > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > [-- Attachment #2: Type: text/html, Size: 2970 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-12 20:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.37.1492012806.25481.grub-devel@gnu.org>
2017-04-12 16:51 ` Contribution Nicole
2017-04-12 17:03 ` Contribution Xen
2017-04-12 20:06 ` Contribution Vladimir 'phcoder' Serbinenko
2017-04-12 18:25 ` Contributions Nicole
2017-04-12 20:08 ` Contributions Vladimir 'phcoder' Serbinenko
[not found] <mailman.65479.1492027745.22739.grub-devel@gnu.org>
2017-04-12 20:57 ` Contribution Nicole
[not found] <mailman.65311.1491983735.22739.grub-devel@gnu.org>
2017-04-12 10:36 ` Contribution Nicole
2017-04-12 10:41 ` Contribution Vladimir 'phcoder' Serbinenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).