[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 3/3] inspect: improve detection of FreeBSD install discs



On Thursday 28 November 2013 14:12:16 Richard W.M. Jones wrote:
> On Thu, Nov 28, 2013 at 02:48:38PM +0100, Pino Toscano wrote:
> > Check for /boot/loader.rc as "install disc" detection, using it to
> > mark FreeBSD install discs.
> > Also, check for /mfsroot.gz to see whether such disc is also a live
> > one.
> > 
> > See also RHBZ#1033207.
> > ---
> > 
> >  src/inspect-fs-cd.c | 19 ++++++++++++++++++-
> >  src/inspect-fs.c    |  3 ++-
> >  2 files changed, 20 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/inspect-fs-cd.c b/src/inspect-fs-cd.c
> > index eaeaa6f..fff0629 100644
> > --- a/src/inspect-fs-cd.c
> > +++ b/src/inspect-fs-cd.c
> > @@ -327,6 +327,16 @@ check_isolinux_installer_root (guestfs_h *g,
> > struct inspect_fs *fs)> 
> >    return 0;
> >  
> >  }
> > 
> > +/* FreeBSD with /boot/loader.rc.
> > + */
> > +static int
> > +check_freebsd_installer_root (guestfs_h *g, struct inspect_fs *fs)
> > +{
> > +  fs->type = OS_TYPE_FREEBSD;
> > +
> > +  return 0;
> > +}
> > +
> > 
> >  /* Windows 2003 and similar versions.
> >  
> >   *
> >   * NB: txtsetup file contains Windows \r\n line endings, which
> >   guestfs_grep> 
> > @@ -430,7 +440,8 @@ guestfs___check_installer_root (guestfs_h *g,
> > struct inspect_fs *fs)> 
> >     * need to unpack this and look inside to tell the difference.
> >     */
> >    
> >    if (guestfs_is_file (g, "/casper/filesystem.squashfs") > 0 ||
> > 
> > -      guestfs_is_file (g, "/live/filesystem.squashfs") > 0)
> > +      guestfs_is_file (g, "/live/filesystem.squashfs") > 0 ||
> > +      guestfs_is_file (g, "/mfsroot.gz") > 0)
> > 
> >      fs->is_live_disk = 1;
> >    
> >    /* Debian/Ubuntu. */
> > 
> > @@ -461,6 +472,12 @@ guestfs___check_installer_root (guestfs_h *g,
> > struct inspect_fs *fs)> 
> >        return -1;
> >    
> >    }
> > 
> > +  /* FreeBSD. */
> > +  else if (guestfs_is_file (g, "/boot/loader.rc") > 0) {
> > +    if (check_freebsd_installer_root (g, fs) == -1)
> > +      return -1;
> > +  }
> 
> I think you should just inline this function, makes the code simpler.

That is OK too. I added it to follow what has been done for the other 
OSes/cases, to have an own function in case there is more work to do.
It can be split again, if needed, I guess.

Sending a v2 of this.

-- 
Pino Toscano


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]