<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lbmk.git/util, branch 20230319</title>
<subtitle>libreboot build system (LibreBoot MaKe)
</subtitle>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/'/>
<entry>
<title>util/nvmutil: optimise rhex() further</title>
<updated>2023-03-06T21:30:33+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-03-06T19:21:46+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=f9e20b8a1d93dec3b6389ca9a7575765c9cc733d'/>
<id>f9e20b8a1d93dec3b6389ca9a7575765c9cc733d</id>
<content type='text'>
reduce the number of calls to read() by using
bit shifts. when rnum is zero, read again. in
most cases, a nibble will not be zero, so this
will usually result in about 13-15 of of 16
nibbles being used. this is in comparison to
8 nibbles being used before, which means that
the number of calls to read() are roughly
halved. at the same time, the extra amount of
logic is minimal (and probably less) when
compiled, outside of calls to read(), because
shifting is better optimised (on 64-bit machines,
the uint64_t will be shifted with just a single
instruction, if the compiler is decent), whereas
the alternative would be to always precisely use
exactly 16 nibbles by counting up to 16, which
would involve the use of an and mask and still
need a shift, plus...

you get the point. this is probably the most
efficient code ever written, for generating
random numbers between the value of 0 and 15
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reduce the number of calls to read() by using
bit shifts. when rnum is zero, read again. in
most cases, a nibble will not be zero, so this
will usually result in about 13-15 of of 16
nibbles being used. this is in comparison to
8 nibbles being used before, which means that
the number of calls to read() are roughly
halved. at the same time, the extra amount of
logic is minimal (and probably less) when
compiled, outside of calls to read(), because
shifting is better optimised (on 64-bit machines,
the uint64_t will be shifted with just a single
instruction, if the compiler is decent), whereas
the alternative would be to always precisely use
exactly 16 nibbles by counting up to 16, which
would involve the use of an and mask and still
need a shift, plus...

you get the point. this is probably the most
efficient code ever written, for generating
random numbers between the value of 0 and 15
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: tidy up variable declarations</title>
<updated>2023-01-28T23:21:53+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T23:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=6b4a14ce4ac7557bacf607b80cb61d45cb5e8815'/>
<id>6b4a14ce4ac7557bacf607b80cb61d45cb5e8815</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: setWord(): declare variables first</title>
<updated>2023-01-28T22:40:01+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T22:40:01+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=031a0b553ba15e495ce1696ea19a606b239909e4'/>
<id>031a0b553ba15e495ce1696ea19a606b239909e4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: reset errno if any write attempted</title>
<updated>2023-01-28T22:14:35+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T22:14:35+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=257eedca0c729ae7341733306bc87d29b8113c28'/>
<id>257eedca0c729ae7341733306bc87d29b8113c28</id>
<content type='text'>
the way nvmutil is designed, setWord() is only ever called
under non-error conditions. however, if one part is valid but
the other one isn't, and a command is run that touches both parts,
errno is non-zero write writeGbeFile is called

in situations where one part is valid, but the other isn't, AND the
writes to gbe (in memory) results in a non-change, writeGbeFile is
not called; in this situation, errno is not being reset, despite
non-error condition

this patch fixed the bug, resulting in zero status upon exit under
such conditions
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the way nvmutil is designed, setWord() is only ever called
under non-error conditions. however, if one part is valid but
the other one isn't, and a command is run that touches both parts,
errno is non-zero write writeGbeFile is called

in situations where one part is valid, but the other isn't, AND the
writes to gbe (in memory) results in a non-change, writeGbeFile is
not called; in this situation, errno is not being reset, despite
non-error condition

this patch fixed the bug, resulting in zero status upon exit under
such conditions
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: do not write non-changes to disk</title>
<updated>2023-01-28T21:26:36+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T21:19:29+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=adc76e38140e29526131d35f2c102009bfafeff8'/>
<id>adc76e38140e29526131d35f2c102009bfafeff8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: cmd_swap(): write sequentually</title>
<updated>2023-01-28T20:30:34+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T20:27:24+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=3e150bf3032074ba4270131fd3e1fb5f0b1cc43e'/>
<id>3e150bf3032074ba4270131fd3e1fb5f0b1cc43e</id>
<content type='text'>
the current code writes part 1 first, and part 0 next,
on the disk, due to the way the swap works.

with this change, swap still swaps the two parts of the file,
on disk, but writes the new file sequentially.

this change might speed up i/o on the file system, on HDDs.
on SSDs, this change likely makes no difference at all.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the current code writes part 1 first, and part 0 next,
on the disk, due to the way the swap works.

with this change, swap still swaps the two parts of the file,
on disk, but writes the new file sequentially.

this change might speed up i/o on the file system, on HDDs.
on SSDs, this change likely makes no difference at all.
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: don't use malloc()</title>
<updated>2023-01-28T19:39:34+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T19:39:34+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=7e3a73558e8d1a410e225a0b102db38891a4990e'/>
<id>7e3a73558e8d1a410e225a0b102db38891a4990e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: fix clang build errors</title>
<updated>2023-01-28T14:11:17+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T14:11:17+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=a924d43bdd2ad836ce275cad87a27e8c22ce2fd8'/>
<id>a924d43bdd2ad836ce275cad87a27e8c22ce2fd8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: simplify rhex()</title>
<updated>2023-01-28T12:24:50+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-28T12:23:10+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=c822033beedc7765947f5e9332ee842778c5a7fb'/>
<id>c822033beedc7765947f5e9332ee842778c5a7fb</id>
<content type='text'>
don't use malloc(). instead, just load random bytes
into a uint64_t
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
don't use malloc(). instead, just load random bytes
into a uint64_t
</pre>
</div>
</content>
</entry>
<entry>
<title>util/nvmutil: use gbe[] in word() and setword()</title>
<updated>2023-01-27T20:13:15+00:00</updated>
<author>
<name>Leah Rowe</name>
<email>leah@libreboot.org</email>
</author>
<published>2023-01-27T20:13:15+00:00</published>
<link rel='alternate' type='text/html' href='https://browse.libreboot.org/lbmk.git/commit/?id=0f4852450caaee38ccfde2dc1727b0c6cf5f9fbd'/>
<id>0f4852450caaee38ccfde2dc1727b0c6cf5f9fbd</id>
<content type='text'>
this will make the code more flexible, if (when) i
add changes that allow multiple commands to be used
in a single run, on any given number of files
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this will make the code more flexible, if (when) i
add changes that allow multiple commands to be used
in a single run, on any given number of files
</pre>
</div>
</content>
</entry>
</feed>
