Re: [PATCH 1/5] qemuOpenFileAs: Move into util/virqemu.c

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

 



On Mon, Aug 24, 2020 at 16:18:40 +0100, Daniel Berrange wrote:
> On Thu, Aug 06, 2020 at 11:55:12AM +0200, Peter Krempa wrote:
> > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> > ---
> >  src/libvirt_private.syms |   1 +
> >  src/qemu/qemu_driver.c   | 138 ++-------------------------------------
> >  src/util/virqemu.c       | 130 ++++++++++++++++++++++++++++++++++++
> >  src/util/virqemu.h       |   7 ++
> >  4 files changed, 144 insertions(+), 132 deletions(-)
> 
> The original source files were not built on Win32, the new
> source files are. This causes a build failure due to...

Sigh. I thought that I could make it to be an universal helper. Not very
useful, but universal.

An alternative solution could be to dump it to qemu_domain.c ...

> 
> > diff --git a/src/util/virqemu.c b/src/util/virqemu.c
> > index 20cb09d878..e1c8673390 100644
> > --- a/src/util/virqemu.c
> > +++ b/src/util/virqemu.c
> > @@ -22,12 +22,18 @@
> > 
> >  #include <config.h>
> > 
> > +#include <sys/types.h>
> > +#include <sys/stat.h>
> > +#include <fcntl.h>
> > +#include <unistd.h>
> > +
> >  #include "virbuffer.h"
> >  #include "virerror.h"
> >  #include "virlog.h"
> >  #include "virqemu.h"
> >  #include "virstring.h"
> >  #include "viralloc.h"
> > +#include "virfile.h"
> > 
> >  #define VIR_FROM_THIS VIR_FROM_NONE
> > 
> > @@ -441,3 +447,127 @@ virQEMUBuildQemuImgKeySecretOpts(virBufferPtr buf,
> >          virBufferAddLit(buf, ",");
> >      }
> >  }
> > +
> > +
> > +int
> > +virQEMUFileOpenAs(uid_t fallback_uid,
> > +                  gid_t fallback_gid,
> > +                  bool dynamicOwnership,
> > +                  const char *path,
> > +                  int oflags,
> > +                  bool *needUnlink)
> > +{
> > +    struct stat sb;
> > +    bool is_reg = true;
> > +    bool need_unlink = false;
> > +    unsigned int vfoflags = 0;
> > +    int fd = -1;
> > +    int path_shared = virFileIsSharedFS(path);
> > +    uid_t uid = geteuid();
> > +    gid_t gid = getegid();
> 
> ... these calls
> 
> 
> We'll need to provide a  stub that raises an error on win32 for this.

... to avoid a need for this. It's not as universal of a helper anyways.




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux