On Fri, Apr 21, 2023 at 06:30:52AM -0700, alan somers wrote:
On Fri, Apr 21, 2023 at 2:32 AM Laszlo Ersek
<lersek(a)redhat.com> wrote:
>
> On 4/21/23 11:20, Richard W.M. Jones wrote:
> > See:
https://github.com/libguestfs/nbdkit/issues/21
> >
> > Tested by applying the following patch to the example plugin and
> > running it with verbose enabled:
> >
> > --- a/plugins/rust/examples/ramdisk.rs
> > +++ b/plugins/rust/examples/ramdisk.rs
> > @@ -43,6 +43,12 @@ struct RamDisk {
> > }
> >
> > impl Server for RamDisk {
> > + fn after_fork() -> Result<()> {
> > + // A place to start background threads.
> > + eprintln!("forked");
> > + Ok(())
> > + }
> > +
> > fn get_size(&self) -> Result<i64> {
> > Ok(DISK.lock().unwrap().len() as i64)
> > }
> > @@ -76,4 +82,4 @@ impl Server for RamDisk {
> > }
> > }
> >
> > -plugin!(RamDisk {thread_model, write_at});
> > +plugin!(RamDisk {thread_model, write_at, after_fork});
>
> I *think* diffs embedded in commit messages are best quoted somehow (or
> at least indented); I vaguely recall "naked" diffs in the commit message
> confusing git-am.
>
> I've not written a line of Rust thus far, so I'll let Alan review the
patch.
That patch looks good from first glance. Have you tried running it yet?
Yes it works fine. I will push it shortly.
I didn't look at the other part of the user's bug report.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW