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

Re: [libvirt] [PATCH 5/7] Move file info functions to libvirt_util



On Fri, Sep 25, 2009 at 02:27:31PM +0100, Mark McLoughlin wrote:
> Rename virStorageBackendUpdateVolTargetInfo to virStorageFileGetInfo()
> and move to util/storage_file.[ch]
> 
> * src/storage/storage_backend.[ch]: move code from here ...
> 
> * src/util/storage_file.[ch]: ... to here
> 
> * src/libvirt_private.syms: export new functions
> 
> * src/storage/storage_backend_fs.c, src/storage/storage_backend_mpath.c,
>   src/storage/storage_backend_scsi.c: update from above changes
> 
> * po/POTFILES.in: add storage_file.c
> ---
>  po/POTFILES.in                      |    1 +
>  src/libvirt_private.syms            |    2 +
>  src/storage/storage_backend.c       |  148 ++-------------------------------
>  src/storage/storage_backend.h       |    9 --
>  src/storage/storage_backend_fs.c    |   18 ++--
>  src/storage/storage_backend_mpath.c |    7 +-
>  src/storage/storage_backend_scsi.c  |    7 +-
>  src/util/storage_file.c             |  157 +++++++++++++++++++++++++++++++++++
>  src/util/storage_file.h             |   13 +++
>  9 files changed, 194 insertions(+), 168 deletions(-)

NACK to this one too, based suggestion against patch 6

> -
> -    target->perms.mode = sb.st_mode & S_IRWXUGO;
> -    target->perms.uid = sb.st_uid;
> -    target->perms.gid = sb.st_gid;
> -
> -    VIR_FREE(target->perms.label);
> -
> -#if HAVE_SELINUX
> -    /* XXX: make this a security driver call */
> -    if (fgetfilecon(fd, &filecon) == -1) {
> -        if (errno != ENODATA && errno != ENOTSUP) {
> -            virReportSystemError(conn, errno,
> -                                 _("cannot get file context of '%s'"),
> -                                 target->path);
> -            return -1;
> -        } else {
> -            target->perms.label = NULL;
> -        }
> -    } else {
> -        target->perms.label = strdup(filecon);
> -        if (target->perms.label == NULL) {
> -            virReportOOMError(conn);
> -            return -1;
> -        }
> -        freecon(filecon);
> -    }
> -#else
> -    target->perms.label = NULL;
> -#endif

This bit of code / todo item is another good argument against moving it - we
need to eventually mak this call into the security driver, and don't want to
have to move the security drivers into the src/util/ directory / library too.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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