├── .github └── workflows │ └── lockdown.yml ├── .gitignore ├── .gitlab-ci.yml ├── .mailmap ├── AUTHORS.in ├── CONTRIBUTING.rst ├── COPYING ├── ChangeLog ├── GNUmakefile ├── HACKING ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── bin ├── Makefile.am └── virt-sandbox.c ├── build-aux ├── gitlog-to-changelog ├── minimize-po.pl ├── useless-if-before-free └── vc-list-files ├── cfg.mk ├── ci ├── buildenv │ ├── debian-10.sh │ ├── debian-sid.sh │ ├── fedora-35.sh │ ├── fedora-36.sh │ ├── fedora-rawhide.sh │ ├── opensuse-leap-153.sh │ ├── opensuse-tumbleweed.sh │ ├── ubuntu-2004.sh │ └── ubuntu-2204.sh ├── containers │ ├── debian-10.Dockerfile │ ├── debian-sid.Dockerfile │ ├── fedora-35.Dockerfile │ ├── fedora-36.Dockerfile │ ├── fedora-rawhide.Dockerfile │ ├── opensuse-leap-153.Dockerfile │ ├── opensuse-tumbleweed.Dockerfile │ ├── ubuntu-2004.Dockerfile │ └── ubuntu-2204.Dockerfile ├── gitlab.yml ├── gitlab │ ├── build-templates.yml │ ├── builds.yml │ ├── container-templates.yml │ ├── containers.yml │ └── sanity-checks.yml ├── lcitool │ └── projects │ │ └── libvirt-sandbox.yml └── manifest.yml ├── configure.ac ├── docs ├── Makefile.am ├── architecture.txt ├── libvirt-sandbox │ ├── .gitignore │ ├── Libvirt-sandbox-docs.xml │ └── Makefile.am ├── release-naming.txt └── testing.txt ├── examples ├── Makefile.am ├── README ├── demo.py ├── shell.py ├── virt-sandbox-mkinitrd.py ├── virt-sandbox.js ├── virt-sandbox.pl └── virt-sandbox.py ├── gtk-doc.make ├── libvirt-sandbox-1.0.pc.in ├── libvirt-sandbox.spec.in ├── libvirt-sandbox ├── Makefile.am ├── README ├── libvirt-sandbox-builder-container.c ├── libvirt-sandbox-builder-container.h ├── libvirt-sandbox-builder-initrd.c ├── libvirt-sandbox-builder-initrd.h ├── libvirt-sandbox-builder-machine.c ├── libvirt-sandbox-builder-machine.h ├── libvirt-sandbox-builder-private.h ├── libvirt-sandbox-builder.c ├── libvirt-sandbox-builder.h ├── libvirt-sandbox-config-all.h ├── libvirt-sandbox-config-disk.c ├── libvirt-sandbox-config-disk.h ├── libvirt-sandbox-config-initrd.c ├── libvirt-sandbox-config-initrd.h ├── libvirt-sandbox-config-interactive.c ├── libvirt-sandbox-config-interactive.h ├── libvirt-sandbox-config-mount-file.c ├── libvirt-sandbox-config-mount-file.h ├── libvirt-sandbox-config-mount-guest-bind.c ├── libvirt-sandbox-config-mount-guest-bind.h ├── libvirt-sandbox-config-mount-host-bind.c ├── libvirt-sandbox-config-mount-host-bind.h ├── libvirt-sandbox-config-mount-host-image.c ├── libvirt-sandbox-config-mount-host-image.h ├── libvirt-sandbox-config-mount-ram.c ├── libvirt-sandbox-config-mount-ram.h ├── libvirt-sandbox-config-mount.c ├── libvirt-sandbox-config-mount.h ├── libvirt-sandbox-config-network-address.c ├── libvirt-sandbox-config-network-address.h ├── libvirt-sandbox-config-network-filterref-parameter.c ├── libvirt-sandbox-config-network-filterref-parameter.h ├── libvirt-sandbox-config-network-filterref.c ├── libvirt-sandbox-config-network-filterref.h ├── libvirt-sandbox-config-network-route.c ├── libvirt-sandbox-config-network-route.h ├── libvirt-sandbox-config-network.c ├── libvirt-sandbox-config-network.h ├── libvirt-sandbox-config-service-generic.c ├── libvirt-sandbox-config-service-generic.h ├── libvirt-sandbox-config-service-systemd.c ├── libvirt-sandbox-config-service-systemd.h ├── libvirt-sandbox-config-service.c ├── libvirt-sandbox-config-service.h ├── libvirt-sandbox-config.c ├── libvirt-sandbox-config.h ├── libvirt-sandbox-console-raw.c ├── libvirt-sandbox-console-raw.h ├── libvirt-sandbox-console-rpc.c ├── libvirt-sandbox-console-rpc.h ├── libvirt-sandbox-console.c ├── libvirt-sandbox-console.h ├── libvirt-sandbox-context-interactive.c ├── libvirt-sandbox-context-interactive.h ├── libvirt-sandbox-context-service.c ├── libvirt-sandbox-context-service.h ├── libvirt-sandbox-context.c ├── libvirt-sandbox-context.h ├── libvirt-sandbox-enum-types.c.template ├── libvirt-sandbox-enum-types.h.template ├── libvirt-sandbox-init-common.c ├── libvirt-sandbox-init-lxc.c ├── libvirt-sandbox-init-qemu.c ├── libvirt-sandbox-main.c ├── libvirt-sandbox-main.h ├── libvirt-sandbox-protocol-generator.pl ├── libvirt-sandbox-protocol.x ├── libvirt-sandbox-rpcpacket.c ├── libvirt-sandbox-rpcpacket.h ├── libvirt-sandbox-util.c ├── libvirt-sandbox-util.h ├── libvirt-sandbox.h ├── libvirt-sandbox.sym └── tests │ ├── Makefile.am │ └── test-config.c ├── m4 ├── manywarnings.m4 ├── virt-capng.m4 ├── virt-compile-warnings.m4 ├── virt-coverage.m4 ├── virt-gtk-misc.m4 ├── virt-nls.m4 ├── virt-rpcgen.m4 ├── virt-selinux.m4 ├── virt-static.m4 ├── virt-win32.m4 ├── virt-xdr.m4 └── warnings.m4 ├── maint.mk ├── po ├── LINGUAS ├── Makefile.am ├── POTFILES ├── README.md ├── ca.po ├── cs.po ├── de.po ├── es.po ├── fi.po ├── fr.po ├── id.po ├── ja.po ├── ka.po ├── ko.po ├── libvirt-sandbox.pot ├── nl.po ├── pl.po ├── pt_BR.po ├── ro.po ├── si.po ├── sv.po └── uk.po └── prepare-release.sh /.github/workflows/lockdown.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown 3 | 4 | name: 'Repo Lockdown' 5 | 6 | on: 7 | issues: 8 | types: opened 9 | pull_request_target: 10 | types: opened 11 | 12 | permissions: 13 | pull-requests: write 14 | issues: write 15 | 16 | jobs: 17 | action: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: dessant/repo-lockdown@v2 21 | with: 22 | issue-comment: | 23 | Thank you for your interest in the libvirt project. 24 | 25 | Since this repository is a read-only mirror of the project's master 26 | repostory hosted on GitLab, issues opened here are not processed. 27 | 28 | We kindly request that new issues are reported to 29 | 30 | https://gitlab.com/libvirt/libvirt-sandbox/-/issues/new 31 | 32 | Thank you for your time and understanding. 33 | lock-issue: true 34 | close-issue: true 35 | pr-comment: | 36 | Thank you for your interest in the libvirt project. 37 | 38 | Since this repository is a read-only mirror of the project's master 39 | repostory hosted on GitLab, merge requests opened here are not 40 | processed. 41 | 42 | We kindly request that contributors fork the project at 43 | 44 | https://gitlab.com/libvirt/libvirt-sandbox/ 45 | 46 | push changes to the fork, and then open a new merge request at 47 | 48 | https://gitlab.com/libvirt/libvirt-sandbox/-/merge_requests/new 49 | 50 | Thank you for your time and understanding. 51 | lock-pr: true 52 | close-pr: true 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | Makefile.in 3 | Makefile 4 | aclocal.m4 5 | autom4te.cache/ 6 | compile 7 | config.guess 8 | config.h 9 | config.h.in 10 | config.log 11 | config.status 12 | config.sub 13 | configure 14 | depcomp 15 | install-sh 16 | *.tar.xz 17 | libtool 18 | ltmain.sh 19 | missing 20 | m4/libtool.m4 21 | m4/ltsugar.m4 22 | m4/ltoptions.m4 23 | m4/lt~obsolete.m4 24 | m4/ltversion.m4 25 | po/*.gmo 26 | stamp-h1 27 | build-aux/test-driver 28 | INSTALL 29 | libvirt-sandbox-1.0.pc 30 | libvirt-sandbox.spec 31 | .deps/ 32 | .libs/ 33 | .tx/ 34 | libvirt-sandbox/LibvirtSandbox-1.0.gir 35 | libvirt-sandbox/LibvirtSandbox-1.0.typelib 36 | *.lo 37 | *.la 38 | *.o 39 | *.pyc 40 | *~ 41 | libvirt-sandbox/libvirt-sandbox-init-lxc 42 | libvirt-sandbox/libvirt-sandbox-init-common 43 | libvirt-sandbox/libvirt-sandbox-init-qemu 44 | libvirt-sandbox/libvirt-sandbox-enum-types.h 45 | libvirt-sandbox/libvirt-sandbox-enum-types.c 46 | libvirt-sandbox/libvirt-sandbox-protocol.c 47 | libvirt-sandbox/libvirt-sandbox-protocol.h 48 | libvirt-sandbox/tests/*.cfg 49 | libvirt-sandbox/tests/test-config 50 | bin/virt-sandbox 51 | build/ 52 | bin/*.1 53 | *.log 54 | *.trs 55 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | 2 | stages: 3 | - containers 4 | - builds 5 | - sanity_checks 6 | 7 | .script_variables: &script_variables | 8 | export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" 9 | export SCRATCH_DIR="/tmp/scratch" 10 | export VROOT="$SCRATCH_DIR/vroot" 11 | export LIBDIR="$VROOT/lib" 12 | export CCACHE_DIR="$PWD/ccache" 13 | export CCACHE_MAXSIZE="500M" 14 | export PATH="$CCACHE_WRAPPERSDIR:$VROOT/bin:$PATH" 15 | export PKG_CONFIG_PATH="$LIBDIR/pkgconfig" 16 | export XDG_DATA_DIRS="$VROOT/share:/usr/share" 17 | export GI_TYPELIB_PATH="$LIBDIR/girepository-1.0" 18 | export LD_LIBRARY_PATH="$LIBDIR" 19 | 20 | .native_git_build_job: 21 | cache: 22 | paths: 23 | - ccache/ 24 | key: "$CI_JOB_NAME" 25 | script: 26 | - *script_variables 27 | - pushd "$PWD" 28 | - mkdir -p "$SCRATCH_DIR" 29 | - cd "$SCRATCH_DIR" 30 | - git clone --depth 1 https://gitlab.com/libvirt/libvirt.git 31 | - git clone --depth 1 https://gitlab.com/libvirt/libvirt-glib.git 32 | - cd libvirt 33 | - meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR" 34 | - ninja -C build install 35 | - cd ../libvirt-glib 36 | - meson build "--prefix=$VROOT" "--libdir=$LIBDIR" 37 | - ninja -C build install 38 | - popd 39 | - mkdir build 40 | - cd build 41 | - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc 42 | - $MAKE 43 | - $MAKE check 44 | - $MAKE install 45 | - $MAKE dist 46 | - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt-sandbox*.tar.xz ; fi 47 | 48 | .native_git_build_job_prebuilt_env: 49 | extends: 50 | - .native_git_build_job 51 | - .gitlab_native_build_job_prebuilt_env 52 | 53 | .native_git_build_job_local_env: 54 | extends: 55 | - .native_git_build_job 56 | - .gitlab_native_build_job_local_env 57 | 58 | .native_build_job: 59 | cache: 60 | paths: 61 | - ccache/ 62 | key: "$CI_JOB_NAME" 63 | script: 64 | - *script_variables 65 | - mkdir build 66 | - cd build 67 | - ../autogen.sh --prefix="$VROOT" --enable-gtk-doc 68 | - $MAKE 69 | - $MAKE check 70 | - $MAKE install 71 | - $MAKE dist 72 | - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild -ta libvirt-sandbox*.tar.xz ; fi 73 | 74 | .native_build_job_prebuilt_env: 75 | extends: 76 | - .native_build_job 77 | - .gitlab_native_build_job_prebuilt_env 78 | 79 | .native_build_job_local_env: 80 | extends: 81 | - .native_build_job 82 | - .gitlab_native_build_job_local_env 83 | 84 | include: '/ci/gitlab.yml' -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # 'git shortlog --help' and look for mailmap for the format of each line 2 | 3 | # Email consolidation: 4 | # 5 | 6 | 7 | -------------------------------------------------------------------------------- /AUTHORS.in: -------------------------------------------------------------------------------- 1 | libvirt-sandbox Authors 2 | ======================= 3 | 4 | The primary maintainers of libvirt-sandbox are: 5 | 6 | Daniel P. Berrange 7 | Dan Walsh 8 | Guido Günther 9 | Michal Privoznik 10 | 11 | Patches have been received from: 12 | 13 | #authorslist# 14 | 15 | ... send patches to get your name added ... 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | Contributing to libvirt-sandbox 3 | =============================== 4 | 5 | The libvirt Sandbox API binding accepts code contributions via merge requests 6 | on the GitLab project: 7 | 8 | https://gitlab.com/libvirt/libvirt-sandbox/-/merge_requests 9 | 10 | It is required that automated CI pipelines succeed before a merge request 11 | will be accepted. The global pipeline status for the ``master`` branch is 12 | visible at: 13 | 14 | https://gitlab.com/libvirt/libvirt-sandbox/pipelines 15 | 16 | CI pipeline results for merge requests will be visible via the contributors' 17 | own private repository fork: 18 | 19 | https://gitlab.com/yourusername/libvirt-sandbox/pipelines 20 | 21 | Contributions submitted to the project must be in compliance with the 22 | Developer Certificate of Origin Version 1.1. This is documented at: 23 | 24 | https://developercertificate.org/ 25 | 26 | To indicate compliance, each commit in a series must have a "Signed-off-by" 27 | tag with the submitter's name and email address. This can be added by passing 28 | the ``-s`` flag to ``git commit`` when creating the patches. 29 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libvirt/libvirt-sandbox/a45b7f29b820deb4a25a8e1cac2cdb2aa9efce53/ChangeLog -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | Tips for hacking on libvirt-sandbox 2 | =================================== 3 | 4 | To test the GObject introspection based language bindings without 5 | having to run make install, there are two environment variables 6 | that need to be set: 7 | 8 | export GI_TYPELIB_PATH=`pwd`/libvirt-sandbox 9 | export LD_LIBRARY_PATH=`pwd`/libvirt-sandbox/.libs 10 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = libvirt-sandbox bin examples docs po 3 | 4 | ACLOCAL_AMFLAGS = -I m4 5 | 6 | pkgconfigdir = $(libdir)/pkgconfig 7 | pkgconfig_DATA = libvirt-sandbox-1.0.pc 8 | 9 | EXTRA_DIST = \ 10 | $(PACKAGE).spec \ 11 | $(pkgconfig_DATA:%.pc=%.pc.in) \ 12 | AUTHORS.in \ 13 | $(NULL) 14 | 15 | DISTCLEAN_FILES = $(PACKAGE).spec $(pkgconfig_DATA) 16 | 17 | DISTCHECK_CONFIGURE_FLAGS = --enable-introspection=yes --enable-gtk-doc=yes 18 | 19 | dist-hook: gen-ChangeLog gen-AUTHORS 20 | 21 | # Generate the ChangeLog file (with all entries since the switch to git) 22 | # and insert it into the directory we're about to use to create a tarball. 23 | .PHONY: gen-ChangeLog gen-AUTHORS 24 | gen-ChangeLog: 25 | if test -d .git || test -d ../.git; then \ 26 | $(top_srcdir)/build-aux/gitlog-to-changelog \ 27 | > $(distdir)/cl-t; \ 28 | rm -f $(distdir)/ChangeLog; \ 29 | mv $(distdir)/cl-t $(distdir)/ChangeLog; \ 30 | fi 31 | 32 | gen-AUTHORS: 33 | $(AM_V_GEN)if test -d $(srcdir)/.git; then \ 34 | out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \ 35 | perl -p -e "s/#authorslist#// and print '$$out'" \ 36 | < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \ 37 | mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \ 38 | fi 39 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libvirt Sandbox 2 | =============== 3 | 4 | The libvirt-sandbox package provides an API for building application 5 | sandboxes using libvirt. Sandboxes can be based on either container 6 | or machine based virtualization technology. Also included is a simple 7 | command line tool for launching sandboxes for arbitrary commands. 8 | 9 | Installation 10 | ------------ 11 | 12 | The libvirt-sandbox package uses GNU autotools, so the build install 13 | process follows the standard process documented in the INSTALL file. 14 | As a quick start you can do 15 | 16 | ./configure --prefix=/usr --sysconfdir=/etc \ 17 | --localstatedir=/var --libdir=/usr/lib 18 | make 19 | sudo make install 20 | 21 | Or to install into a private user specific location 22 | 23 | ./configure --prefix=$HOME/libvirt-sandbox 24 | make 25 | make install 26 | 27 | The following mandatory dependancies are required in order to 28 | build libvirt-sandbox 29 | 30 | libvirt-glib >= 0.1.7 31 | libvirt >= 1.0.2 32 | glib2 >= 2.28.0 33 | 34 | And either the libvirt LXC or QEMU/KVM drivers. 35 | 36 | 37 | Communication 38 | ------------- 39 | 40 | To communicate with the development team, or to post patches 41 | there is a technical mailing list: 42 | 43 | https://www.redhat.com/mailman/listinfo/libvir-list 44 | 45 | End user support can be found at 46 | 47 | https://www.redhat.com/mailman/listinfo/libvirt-users 48 | 49 | There is also a mailing list for new release announcements: 50 | 51 | https://www.redhat.com/mailman/listinfo/libvirt-announce 52 | 53 | Bugs found when using an OS distribution's binary packages should 54 | be reported to the OS vendors' own bug tracker first. 55 | 56 | The latest libvirt-sandbox code can be found in GIT at: 57 | 58 | https://gitlab.com/libvirt/libvirt-sandbox 59 | 60 | Licensing 61 | --------- 62 | 63 | libvirt-sandbox is provided under the terms of the GNU Lesser General 64 | Public License as published by the Free Software Foundation; either 65 | version 2.1 of the License, or (at your option) any later version. 66 | 67 | Please see the COPYING file for the complete LGPLv2+ license 68 | terms, or visit . 69 | 70 | -- End of readme 71 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | set -e 5 | srcdir=`dirname $0` 6 | test -z "$srcdir" && srcdir=. 7 | 8 | THEDIR=`pwd` 9 | cd $srcdir 10 | 11 | DIE=0 12 | 13 | for prog in autoreconf automake autoconf libtool 14 | do 15 | ($prog --version) < /dev/null > /dev/null 2>&1 || { 16 | echo 17 | echo "You must have $prog installed to compile libvirt-sandbox." 18 | DIE=1 19 | } 20 | done 21 | 22 | if test "$DIE" -eq 1; then 23 | exit 1 24 | fi 25 | 26 | if test -z "$*"; then 27 | echo "I am going to run ./configure with no args - if you " 28 | echo "wish to pass any extra arguments to it, please specify them on " 29 | echo "the $0 command line." 30 | fi 31 | 32 | # Real ChangeLog/AUTHORS is auto-generated from GIT logs at 33 | # make dist time, but automake requires that it 34 | # exists at all times :-( 35 | touch ChangeLog AUTHORS 36 | 37 | mkdir -p build-aux 38 | autoreconf -if 39 | 40 | cd $THEDIR 41 | 42 | if test "x$1" = "x--system"; then 43 | shift 44 | prefix=/usr 45 | libdir=$prefix/lib 46 | sysconfdir=/etc 47 | localstatedir=/var 48 | if [ -d /usr/lib64 ]; then 49 | libdir=$prefix/lib64 50 | fi 51 | EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir" 52 | fi 53 | 54 | $srcdir/configure $EXTRA_ARGS "$@" && { 55 | echo 56 | echo "Now type 'make' to compile libvirt-sandbox." 57 | } 58 | -------------------------------------------------------------------------------- /bin/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | bin_PROGRAMS = virt-sandbox 3 | 4 | EXTRA_DIST = $(bin_SCRIPTS) 5 | 6 | man1_MANS = \ 7 | virt-sandbox.1 \ 8 | $(NULL) 9 | 10 | POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" 11 | 12 | virt-sandbox.1: virt-sandbox.c Makefile 13 | $(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ 14 | 15 | CLEANFILES = $(man1_MANS) 16 | 17 | virt_sandbox_SOURCES = virt-sandbox.c 18 | virt_sandbox_CFLAGS = \ 19 | $(GIO_UNIX_CFLAGS) \ 20 | $(LIBVIRT_GOBJECT_CFLAGS) \ 21 | -I$(top_srcdir) \ 22 | -DLOCALEDIR="\"$(datadir)/locale"\" \ 23 | $(WARN_CFLAGS) \ 24 | $(NULL) 25 | virt_sandbox_LDFLAGS = \ 26 | $(GIO_UNIX_LIBS) \ 27 | $(LIBVIRT_GOBJECT_LIBS) \ 28 | ../libvirt-sandbox/libvirt-sandbox-1.0.la \ 29 | $(WARN_CFLAGS) \ 30 | $(NULL) 31 | -------------------------------------------------------------------------------- /build-aux/minimize-po.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my @block; 4 | my $msgstr = 0; 5 | my $empty = 0; 6 | my $unused = 0; 7 | my $fuzzy = 0; 8 | while (<>) { 9 | if (/^$/) { 10 | if (!$empty && !$unused && !$fuzzy) { 11 | print @block; 12 | } 13 | @block = (); 14 | $msgstr = 0; 15 | $fuzzy = 0; 16 | push @block, $_; 17 | } else { 18 | if (/^msgstr/) { 19 | $msgstr = 1; 20 | $empty = 1; 21 | } 22 | if (/^#.*fuzzy/) { 23 | $fuzzy = 1; 24 | } 25 | if (/^#~ msgstr/) { 26 | $unused = 1; 27 | } 28 | if ($msgstr && /".+"/) { 29 | $empty = 0; 30 | } 31 | push @block, $_; 32 | } 33 | } 34 | 35 | if (@block && !$empty && !$unused) { 36 | print @block; 37 | } 38 | -------------------------------------------------------------------------------- /build-aux/vc-list-files: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # List version-controlled file names. 3 | 4 | # Print a version string. 5 | scriptversion=2011-05-16.22; # UTC 6 | 7 | # Copyright (C) 2006-2011 Free Software Foundation, Inc. 8 | 9 | # This program is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | 23 | # List the specified version-controlled files. 24 | # With no argument, list them all. With a single DIRECTORY argument, 25 | # list the version-controlled files in that directory. 26 | 27 | # If there's an argument, it must be a single, "."-relative directory name. 28 | # cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/ 29 | 30 | postprocess= 31 | case $1 in 32 | --help) cat <. 44 | EOF 45 | exit ;; 46 | 47 | --version) 48 | year=`echo "$scriptversion" | sed 's/[^0-9].*//'` 49 | cat < 53 | This is free software: you are free to change and redistribute it. 54 | There is NO WARRANTY, to the extent permitted by law. 55 | EOF 56 | exit ;; 57 | 58 | -C) 59 | test "$2" = . || postprocess="| sed 's|^|$2/|'" 60 | cd "$2" || exit 1 61 | shift; shift ;; 62 | esac 63 | 64 | test $# = 0 && set . 65 | 66 | for dir 67 | do 68 | if test -d .git; then 69 | test "x$dir" = x. \ 70 | && dir= sed_esc= \ 71 | || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; } 72 | # Ignore git symlinks - either they point into the tree, in which case 73 | # we don't need to visit the target twice, or they point somewhere 74 | # else (often into a submodule), in which case the content does not 75 | # belong to this package. 76 | eval exec git ls-tree -r 'HEAD:"$dir"' \ 77 | \| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess 78 | elif test -d .hg; then 79 | eval exec hg locate '"$dir/*"' $postprocess 80 | elif test -d .bzr; then 81 | test "$postprocess" = '' && postprocess="| sed 's|^\./||'" 82 | eval exec bzr ls -R --versioned '"$dir"' $postprocess 83 | elif test -d CVS; then 84 | test "$postprocess" = '' && postprocess="| sed 's|^\./||'" 85 | if test -x build-aux/cvsu; then 86 | eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess 87 | elif (cvsu --help) >/dev/null 2>&1; then 88 | eval cvsu --find --types=AFGM '"$dir"' $postprocess 89 | else 90 | eval awk -F/ \''{ \ 91 | if (!$1 && $3 !~ /^-/) { \ 92 | f=FILENAME; \ 93 | if (f ~ /CVS\/Entries$/) \ 94 | f = substr(f, 1, length(f)-11); \ 95 | print f $2; \ 96 | }}'\'' \ 97 | `find "$dir" -name Entries -print` /dev/null' $postprocess 98 | fi 99 | elif test -d .svn; then 100 | eval exec svn list -R '"$dir"' $postprocess 101 | else 102 | echo "$0: Failed to determine type of version control used in `pwd`" 1>&2 103 | exit 1 104 | fi 105 | done 106 | 107 | # Local variables: 108 | # eval: (add-hook 'write-file-hooks 'time-stamp) 109 | # time-stamp-start: "scriptversion=" 110 | # time-stamp-format: "%:y-%02m-%02d.%02H" 111 | # time-stamp-time-zone: "UTC" 112 | # time-stamp-end: "; # UTC" 113 | # End: 114 | -------------------------------------------------------------------------------- /ci/buildenv/debian-10.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | export DEBIAN_FRONTEND=noninteractive 9 | apt-get update 10 | apt-get dist-upgrade -y 11 | apt-get install --no-install-recommends -y \ 12 | autoconf \ 13 | automake \ 14 | autopoint \ 15 | ca-certificates \ 16 | ccache \ 17 | cpp \ 18 | gcc \ 19 | gettext \ 20 | git \ 21 | gtk-doc-tools \ 22 | libc-dev-bin \ 23 | libc6-dev \ 24 | libcap-ng-dev \ 25 | libgirepository1.0-dev \ 26 | libglib2.0-dev \ 27 | liblzma-dev \ 28 | libselinux1-dev \ 29 | libtirpc-dev \ 30 | libtool \ 31 | libtool-bin \ 32 | libvirt-dev \ 33 | libvirt-glib-1.0-dev \ 34 | libxml2-dev \ 35 | locales \ 36 | make \ 37 | pkgconf \ 38 | xz-utils \ 39 | zlib1g-dev 40 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen 41 | dpkg-reconfigure locales 42 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt 43 | mkdir -p /usr/libexec/ccache-wrappers 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 45 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 46 | } 47 | 48 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 49 | export LANG="en_US.UTF-8" 50 | export MAKE="/usr/bin/make" 51 | -------------------------------------------------------------------------------- /ci/buildenv/debian-sid.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | export DEBIAN_FRONTEND=noninteractive 9 | apt-get update 10 | apt-get dist-upgrade -y 11 | apt-get install --no-install-recommends -y \ 12 | autoconf \ 13 | automake \ 14 | autopoint \ 15 | ca-certificates \ 16 | ccache \ 17 | cpp \ 18 | gcc \ 19 | gettext \ 20 | git \ 21 | gtk-doc-tools \ 22 | libc-dev-bin \ 23 | libc6-dev \ 24 | libcap-ng-dev \ 25 | libgirepository1.0-dev \ 26 | libglib2.0-dev \ 27 | liblzma-dev \ 28 | libselinux1-dev \ 29 | libtirpc-dev \ 30 | libtool \ 31 | libtool-bin \ 32 | libvirt-dev \ 33 | libvirt-glib-1.0-dev \ 34 | libxml2-dev \ 35 | locales \ 36 | make \ 37 | pkgconf \ 38 | xz-utils \ 39 | zlib1g-dev 40 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen 41 | dpkg-reconfigure locales 42 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt 43 | mkdir -p /usr/libexec/ccache-wrappers 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 45 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 46 | } 47 | 48 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 49 | export LANG="en_US.UTF-8" 50 | export MAKE="/usr/bin/make" 51 | -------------------------------------------------------------------------------- /ci/buildenv/fedora-35.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | dnf update -y 9 | dnf install -y \ 10 | autoconf \ 11 | automake \ 12 | ca-certificates \ 13 | ccache \ 14 | cpp \ 15 | gcc \ 16 | gettext \ 17 | gettext-devel \ 18 | git \ 19 | glib2-devel \ 20 | glibc-langpack-en \ 21 | glibc-static \ 22 | gobject-introspection-devel \ 23 | gtk-doc \ 24 | libcap-ng-devel \ 25 | libselinux-devel \ 26 | libtirpc-devel \ 27 | libtool \ 28 | libvirt-devel \ 29 | libvirt-gobject-devel \ 30 | libxml2-devel \ 31 | make \ 32 | pkgconfig \ 33 | rpcgen \ 34 | rpm-build \ 35 | xz \ 36 | xz-devel \ 37 | xz-static \ 38 | zlib-devel \ 39 | zlib-static 40 | rpm -qa | sort > /packages.txt 41 | mkdir -p /usr/libexec/ccache-wrappers 42 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 43 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 44 | } 45 | 46 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 47 | export LANG="en_US.UTF-8" 48 | export MAKE="/usr/bin/make" 49 | -------------------------------------------------------------------------------- /ci/buildenv/fedora-36.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | dnf update -y 9 | dnf install -y \ 10 | autoconf \ 11 | automake \ 12 | ca-certificates \ 13 | ccache \ 14 | cpp \ 15 | gcc \ 16 | gettext \ 17 | gettext-devel \ 18 | git \ 19 | glib2-devel \ 20 | glibc-langpack-en \ 21 | glibc-static \ 22 | gobject-introspection-devel \ 23 | gtk-doc \ 24 | libcap-ng-devel \ 25 | libselinux-devel \ 26 | libtirpc-devel \ 27 | libtool \ 28 | libvirt-devel \ 29 | libvirt-gobject-devel \ 30 | libxml2-devel \ 31 | make \ 32 | pkgconfig \ 33 | rpcgen \ 34 | rpm-build \ 35 | xz \ 36 | xz-devel \ 37 | xz-static \ 38 | zlib-devel \ 39 | zlib-static 40 | rpm -qa | sort > /packages.txt 41 | mkdir -p /usr/libexec/ccache-wrappers 42 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 43 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 44 | } 45 | 46 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 47 | export LANG="en_US.UTF-8" 48 | export MAKE="/usr/bin/make" 49 | -------------------------------------------------------------------------------- /ci/buildenv/fedora-rawhide.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | dnf update -y --nogpgcheck fedora-gpg-keys 9 | dnf distro-sync -y 10 | dnf install -y \ 11 | autoconf \ 12 | automake \ 13 | ca-certificates \ 14 | ccache \ 15 | cpp \ 16 | gcc \ 17 | gettext \ 18 | gettext-devel \ 19 | git \ 20 | glib2-devel \ 21 | glibc-langpack-en \ 22 | glibc-static \ 23 | gobject-introspection-devel \ 24 | gtk-doc \ 25 | libcap-ng-devel \ 26 | libselinux-devel \ 27 | libtirpc-devel \ 28 | libtool \ 29 | libvirt-devel \ 30 | libvirt-gobject-devel \ 31 | libxml2-devel \ 32 | make \ 33 | pkgconfig \ 34 | rpcgen \ 35 | rpm-build \ 36 | xz \ 37 | xz-devel \ 38 | xz-static \ 39 | zlib-devel \ 40 | zlib-static 41 | rpm -qa | sort > /packages.txt 42 | mkdir -p /usr/libexec/ccache-wrappers 43 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 45 | } 46 | 47 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 48 | export LANG="en_US.UTF-8" 49 | export MAKE="/usr/bin/make" 50 | -------------------------------------------------------------------------------- /ci/buildenv/opensuse-leap-153.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | zypper update -y 9 | zypper install -y \ 10 | autoconf \ 11 | automake \ 12 | ca-certificates \ 13 | ccache \ 14 | cpp \ 15 | gcc \ 16 | gettext-devel \ 17 | gettext-runtime \ 18 | git \ 19 | glib2-devel \ 20 | glibc-locale \ 21 | glibc-static \ 22 | gobject-introspection-devel \ 23 | gtk-doc \ 24 | libcap-ng-devel \ 25 | libselinux-devel \ 26 | libtirpc-devel \ 27 | libtool \ 28 | libvirt-devel \ 29 | libvirt-glib-devel \ 30 | libxml2-devel \ 31 | make \ 32 | pkgconfig \ 33 | rpcgen \ 34 | rpm-build \ 35 | xz \ 36 | xz-devel \ 37 | xz-static-devel \ 38 | zlib-devel \ 39 | zlib-devel-static 40 | rpm -qa | sort > /packages.txt 41 | mkdir -p /usr/libexec/ccache-wrappers 42 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 43 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 44 | } 45 | 46 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 47 | export LANG="en_US.UTF-8" 48 | export MAKE="/usr/bin/make" 49 | -------------------------------------------------------------------------------- /ci/buildenv/opensuse-tumbleweed.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | zypper dist-upgrade -y 9 | zypper install -y \ 10 | autoconf \ 11 | automake \ 12 | ca-certificates \ 13 | ccache \ 14 | cpp \ 15 | gcc \ 16 | gettext-devel \ 17 | gettext-runtime \ 18 | git \ 19 | glib2-devel \ 20 | glibc-locale \ 21 | glibc-static \ 22 | gobject-introspection-devel \ 23 | gtk-doc \ 24 | libcap-ng-devel \ 25 | libselinux-devel \ 26 | libtirpc-devel \ 27 | libtool \ 28 | libvirt-devel \ 29 | libvirt-glib-devel \ 30 | libxml2-devel \ 31 | make \ 32 | pkgconfig \ 33 | rpcgen \ 34 | rpm-build \ 35 | xz \ 36 | xz-devel \ 37 | xz-static-devel \ 38 | zlib-devel \ 39 | zlib-devel-static 40 | rpm -qa | sort > /packages.txt 41 | mkdir -p /usr/libexec/ccache-wrappers 42 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 43 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 44 | } 45 | 46 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 47 | export LANG="en_US.UTF-8" 48 | export MAKE="/usr/bin/make" 49 | -------------------------------------------------------------------------------- /ci/buildenv/ubuntu-2004.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | export DEBIAN_FRONTEND=noninteractive 9 | apt-get update 10 | apt-get dist-upgrade -y 11 | apt-get install --no-install-recommends -y \ 12 | autoconf \ 13 | automake \ 14 | autopoint \ 15 | ca-certificates \ 16 | ccache \ 17 | cpp \ 18 | gcc \ 19 | gettext \ 20 | git \ 21 | gtk-doc-tools \ 22 | libc-dev-bin \ 23 | libc6-dev \ 24 | libcap-ng-dev \ 25 | libgirepository1.0-dev \ 26 | libglib2.0-dev \ 27 | liblzma-dev \ 28 | libselinux1-dev \ 29 | libtirpc-dev \ 30 | libtool \ 31 | libtool-bin \ 32 | libvirt-dev \ 33 | libvirt-glib-1.0-dev \ 34 | libxml2-dev \ 35 | locales \ 36 | make \ 37 | pkgconf \ 38 | xz-utils \ 39 | zlib1g-dev 40 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen 41 | dpkg-reconfigure locales 42 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt 43 | mkdir -p /usr/libexec/ccache-wrappers 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 45 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 46 | } 47 | 48 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 49 | export LANG="en_US.UTF-8" 50 | export MAKE="/usr/bin/make" 51 | -------------------------------------------------------------------------------- /ci/buildenv/ubuntu-2204.sh: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | function install_buildenv() { 8 | export DEBIAN_FRONTEND=noninteractive 9 | apt-get update 10 | apt-get dist-upgrade -y 11 | apt-get install --no-install-recommends -y \ 12 | autoconf \ 13 | automake \ 14 | autopoint \ 15 | ca-certificates \ 16 | ccache \ 17 | cpp \ 18 | gcc \ 19 | gettext \ 20 | git \ 21 | gtk-doc-tools \ 22 | libc-dev-bin \ 23 | libc6-dev \ 24 | libcap-ng-dev \ 25 | libgirepository1.0-dev \ 26 | libglib2.0-dev \ 27 | libglib2.0-dev-bin \ 28 | libgnutls28-dev \ 29 | liblzma-dev \ 30 | libnl-3-dev \ 31 | libnl-route-3-dev \ 32 | libselinux1-dev \ 33 | libtirpc-dev \ 34 | libtool \ 35 | libtool-bin \ 36 | libxml2-dev \ 37 | libxml2-utils \ 38 | locales \ 39 | make \ 40 | meson \ 41 | ninja-build \ 42 | perl-base \ 43 | pkgconf \ 44 | python3 \ 45 | python3-docutils \ 46 | valac \ 47 | xsltproc \ 48 | xz-utils \ 49 | zlib1g-dev 50 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen 51 | dpkg-reconfigure locales 52 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt 53 | mkdir -p /usr/libexec/ccache-wrappers 54 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc 55 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 56 | } 57 | 58 | export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers" 59 | export LANG="en_US.UTF-8" 60 | export MAKE="/usr/bin/make" 61 | export NINJA="/usr/bin/ninja" 62 | export PYTHON="/usr/bin/python3" 63 | -------------------------------------------------------------------------------- /ci/containers/debian-10.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM docker.io/library/debian:10-slim 8 | 9 | RUN export DEBIAN_FRONTEND=noninteractive && \ 10 | apt-get update && \ 11 | apt-get install -y eatmydata && \ 12 | eatmydata apt-get dist-upgrade -y && \ 13 | eatmydata apt-get install --no-install-recommends -y \ 14 | autoconf \ 15 | automake \ 16 | autopoint \ 17 | ca-certificates \ 18 | ccache \ 19 | cpp \ 20 | gcc \ 21 | gettext \ 22 | git \ 23 | gtk-doc-tools \ 24 | libc-dev-bin \ 25 | libc6-dev \ 26 | libcap-ng-dev \ 27 | libgirepository1.0-dev \ 28 | libglib2.0-dev \ 29 | liblzma-dev \ 30 | libselinux1-dev \ 31 | libtirpc-dev \ 32 | libtool \ 33 | libtool-bin \ 34 | libvirt-dev \ 35 | libvirt-glib-1.0-dev \ 36 | libxml2-dev \ 37 | locales \ 38 | make \ 39 | pkgconf \ 40 | xz-utils \ 41 | zlib1g-dev && \ 42 | eatmydata apt-get autoremove -y && \ 43 | eatmydata apt-get autoclean -y && \ 44 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ 45 | dpkg-reconfigure locales && \ 46 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ 47 | mkdir -p /usr/libexec/ccache-wrappers && \ 48 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 49 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 50 | 51 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 52 | ENV LANG "en_US.UTF-8" 53 | ENV MAKE "/usr/bin/make" 54 | -------------------------------------------------------------------------------- /ci/containers/debian-sid.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM docker.io/library/debian:sid-slim 8 | 9 | RUN export DEBIAN_FRONTEND=noninteractive && \ 10 | apt-get update && \ 11 | apt-get install -y eatmydata && \ 12 | eatmydata apt-get dist-upgrade -y && \ 13 | eatmydata apt-get install --no-install-recommends -y \ 14 | autoconf \ 15 | automake \ 16 | autopoint \ 17 | ca-certificates \ 18 | ccache \ 19 | cpp \ 20 | gcc \ 21 | gettext \ 22 | git \ 23 | gtk-doc-tools \ 24 | libc-dev-bin \ 25 | libc6-dev \ 26 | libcap-ng-dev \ 27 | libgirepository1.0-dev \ 28 | libglib2.0-dev \ 29 | liblzma-dev \ 30 | libselinux1-dev \ 31 | libtirpc-dev \ 32 | libtool \ 33 | libtool-bin \ 34 | libvirt-dev \ 35 | libvirt-glib-1.0-dev \ 36 | libxml2-dev \ 37 | locales \ 38 | make \ 39 | pkgconf \ 40 | xz-utils \ 41 | zlib1g-dev && \ 42 | eatmydata apt-get autoremove -y && \ 43 | eatmydata apt-get autoclean -y && \ 44 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ 45 | dpkg-reconfigure locales && \ 46 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ 47 | mkdir -p /usr/libexec/ccache-wrappers && \ 48 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 49 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 50 | 51 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 52 | ENV LANG "en_US.UTF-8" 53 | ENV MAKE "/usr/bin/make" 54 | -------------------------------------------------------------------------------- /ci/containers/fedora-35.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM registry.fedoraproject.org/fedora:35 8 | 9 | RUN dnf install -y nosync && \ 10 | echo -e '#!/bin/sh\n\ 11 | if test -d /usr/lib64\n\ 12 | then\n\ 13 | export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\ 14 | else\n\ 15 | export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\ 16 | fi\n\ 17 | exec "$@"' > /usr/bin/nosync && \ 18 | chmod +x /usr/bin/nosync && \ 19 | nosync dnf update -y && \ 20 | nosync dnf install -y \ 21 | autoconf \ 22 | automake \ 23 | ca-certificates \ 24 | ccache \ 25 | cpp \ 26 | gcc \ 27 | gettext \ 28 | gettext-devel \ 29 | git \ 30 | glib2-devel \ 31 | glibc-langpack-en \ 32 | glibc-static \ 33 | gobject-introspection-devel \ 34 | gtk-doc \ 35 | libcap-ng-devel \ 36 | libselinux-devel \ 37 | libtirpc-devel \ 38 | libtool \ 39 | libvirt-devel \ 40 | libvirt-gobject-devel \ 41 | libxml2-devel \ 42 | make \ 43 | pkgconfig \ 44 | rpcgen \ 45 | rpm-build \ 46 | xz \ 47 | xz-devel \ 48 | xz-static \ 49 | zlib-devel \ 50 | zlib-static && \ 51 | nosync dnf autoremove -y && \ 52 | nosync dnf clean all -y && \ 53 | rpm -qa | sort > /packages.txt && \ 54 | mkdir -p /usr/libexec/ccache-wrappers && \ 55 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 56 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 57 | 58 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 59 | ENV LANG "en_US.UTF-8" 60 | ENV MAKE "/usr/bin/make" 61 | -------------------------------------------------------------------------------- /ci/containers/fedora-36.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM registry.fedoraproject.org/fedora:36 8 | 9 | RUN dnf install -y nosync && \ 10 | echo -e '#!/bin/sh\n\ 11 | if test -d /usr/lib64\n\ 12 | then\n\ 13 | export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\ 14 | else\n\ 15 | export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\ 16 | fi\n\ 17 | exec "$@"' > /usr/bin/nosync && \ 18 | chmod +x /usr/bin/nosync && \ 19 | nosync dnf update -y && \ 20 | nosync dnf install -y \ 21 | autoconf \ 22 | automake \ 23 | ca-certificates \ 24 | ccache \ 25 | cpp \ 26 | gcc \ 27 | gettext \ 28 | gettext-devel \ 29 | git \ 30 | glib2-devel \ 31 | glibc-langpack-en \ 32 | glibc-static \ 33 | gobject-introspection-devel \ 34 | gtk-doc \ 35 | libcap-ng-devel \ 36 | libselinux-devel \ 37 | libtirpc-devel \ 38 | libtool \ 39 | libvirt-devel \ 40 | libvirt-gobject-devel \ 41 | libxml2-devel \ 42 | make \ 43 | pkgconfig \ 44 | rpcgen \ 45 | rpm-build \ 46 | xz \ 47 | xz-devel \ 48 | xz-static \ 49 | zlib-devel \ 50 | zlib-static && \ 51 | nosync dnf autoremove -y && \ 52 | nosync dnf clean all -y && \ 53 | rpm -qa | sort > /packages.txt && \ 54 | mkdir -p /usr/libexec/ccache-wrappers && \ 55 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 56 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 57 | 58 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 59 | ENV LANG "en_US.UTF-8" 60 | ENV MAKE "/usr/bin/make" 61 | -------------------------------------------------------------------------------- /ci/containers/fedora-rawhide.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM registry.fedoraproject.org/fedora:rawhide 8 | 9 | RUN dnf update -y --nogpgcheck fedora-gpg-keys && \ 10 | dnf install -y nosync && \ 11 | echo -e '#!/bin/sh\n\ 12 | if test -d /usr/lib64\n\ 13 | then\n\ 14 | export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\ 15 | else\n\ 16 | export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\ 17 | fi\n\ 18 | exec "$@"' > /usr/bin/nosync && \ 19 | chmod +x /usr/bin/nosync && \ 20 | nosync dnf distro-sync -y && \ 21 | nosync dnf install -y \ 22 | autoconf \ 23 | automake \ 24 | ca-certificates \ 25 | ccache \ 26 | cpp \ 27 | gcc \ 28 | gettext \ 29 | gettext-devel \ 30 | git \ 31 | glib2-devel \ 32 | glibc-langpack-en \ 33 | glibc-static \ 34 | gobject-introspection-devel \ 35 | gtk-doc \ 36 | libcap-ng-devel \ 37 | libselinux-devel \ 38 | libtirpc-devel \ 39 | libtool \ 40 | libvirt-devel \ 41 | libvirt-gobject-devel \ 42 | libxml2-devel \ 43 | make \ 44 | pkgconfig \ 45 | rpcgen \ 46 | rpm-build \ 47 | xz \ 48 | xz-devel \ 49 | xz-static \ 50 | zlib-devel \ 51 | zlib-static && \ 52 | nosync dnf autoremove -y && \ 53 | nosync dnf clean all -y && \ 54 | rpm -qa | sort > /packages.txt && \ 55 | mkdir -p /usr/libexec/ccache-wrappers && \ 56 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 57 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 58 | 59 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 60 | ENV LANG "en_US.UTF-8" 61 | ENV MAKE "/usr/bin/make" 62 | -------------------------------------------------------------------------------- /ci/containers/opensuse-leap-153.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM registry.opensuse.org/opensuse/leap:15.3 8 | 9 | RUN zypper update -y && \ 10 | zypper install -y \ 11 | autoconf \ 12 | automake \ 13 | ca-certificates \ 14 | ccache \ 15 | cpp \ 16 | gcc \ 17 | gettext-devel \ 18 | gettext-runtime \ 19 | git \ 20 | glib2-devel \ 21 | glibc-locale \ 22 | glibc-static \ 23 | gobject-introspection-devel \ 24 | gtk-doc \ 25 | libcap-ng-devel \ 26 | libselinux-devel \ 27 | libtirpc-devel \ 28 | libtool \ 29 | libvirt-devel \ 30 | libvirt-glib-devel \ 31 | libxml2-devel \ 32 | make \ 33 | pkgconfig \ 34 | rpcgen \ 35 | rpm-build \ 36 | xz \ 37 | xz-devel \ 38 | xz-static-devel \ 39 | zlib-devel \ 40 | zlib-devel-static && \ 41 | zypper clean --all && \ 42 | rpm -qa | sort > /packages.txt && \ 43 | mkdir -p /usr/libexec/ccache-wrappers && \ 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 45 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 46 | 47 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 48 | ENV LANG "en_US.UTF-8" 49 | ENV MAKE "/usr/bin/make" 50 | -------------------------------------------------------------------------------- /ci/containers/opensuse-tumbleweed.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM registry.opensuse.org/opensuse/tumbleweed:latest 8 | 9 | RUN zypper dist-upgrade -y && \ 10 | zypper install -y \ 11 | autoconf \ 12 | automake \ 13 | ca-certificates \ 14 | ccache \ 15 | cpp \ 16 | gcc \ 17 | gettext-devel \ 18 | gettext-runtime \ 19 | git \ 20 | glib2-devel \ 21 | glibc-locale \ 22 | glibc-static \ 23 | gobject-introspection-devel \ 24 | gtk-doc \ 25 | libcap-ng-devel \ 26 | libselinux-devel \ 27 | libtirpc-devel \ 28 | libtool \ 29 | libvirt-devel \ 30 | libvirt-glib-devel \ 31 | libxml2-devel \ 32 | make \ 33 | pkgconfig \ 34 | rpcgen \ 35 | rpm-build \ 36 | xz \ 37 | xz-devel \ 38 | xz-static-devel \ 39 | zlib-devel \ 40 | zlib-devel-static && \ 41 | zypper clean --all && \ 42 | rpm -qa | sort > /packages.txt && \ 43 | mkdir -p /usr/libexec/ccache-wrappers && \ 44 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 45 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 46 | 47 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 48 | ENV LANG "en_US.UTF-8" 49 | ENV MAKE "/usr/bin/make" 50 | -------------------------------------------------------------------------------- /ci/containers/ubuntu-2004.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM docker.io/library/ubuntu:20.04 8 | 9 | RUN export DEBIAN_FRONTEND=noninteractive && \ 10 | apt-get update && \ 11 | apt-get install -y eatmydata && \ 12 | eatmydata apt-get dist-upgrade -y && \ 13 | eatmydata apt-get install --no-install-recommends -y \ 14 | autoconf \ 15 | automake \ 16 | autopoint \ 17 | ca-certificates \ 18 | ccache \ 19 | cpp \ 20 | gcc \ 21 | gettext \ 22 | git \ 23 | gtk-doc-tools \ 24 | libc-dev-bin \ 25 | libc6-dev \ 26 | libcap-ng-dev \ 27 | libgirepository1.0-dev \ 28 | libglib2.0-dev \ 29 | liblzma-dev \ 30 | libselinux1-dev \ 31 | libtirpc-dev \ 32 | libtool \ 33 | libtool-bin \ 34 | libvirt-dev \ 35 | libvirt-glib-1.0-dev \ 36 | libxml2-dev \ 37 | locales \ 38 | make \ 39 | pkgconf \ 40 | xz-utils \ 41 | zlib1g-dev && \ 42 | eatmydata apt-get autoremove -y && \ 43 | eatmydata apt-get autoclean -y && \ 44 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ 45 | dpkg-reconfigure locales && \ 46 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ 47 | mkdir -p /usr/libexec/ccache-wrappers && \ 48 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 49 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 50 | 51 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 52 | ENV LANG "en_US.UTF-8" 53 | ENV MAKE "/usr/bin/make" 54 | -------------------------------------------------------------------------------- /ci/containers/ubuntu-2204.Dockerfile: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | FROM docker.io/library/ubuntu:22.04 8 | 9 | RUN export DEBIAN_FRONTEND=noninteractive && \ 10 | apt-get update && \ 11 | apt-get install -y eatmydata && \ 12 | eatmydata apt-get dist-upgrade -y && \ 13 | eatmydata apt-get install --no-install-recommends -y \ 14 | autoconf \ 15 | automake \ 16 | autopoint \ 17 | ca-certificates \ 18 | ccache \ 19 | cpp \ 20 | gcc \ 21 | gettext \ 22 | git \ 23 | gtk-doc-tools \ 24 | libc-dev-bin \ 25 | libc6-dev \ 26 | libcap-ng-dev \ 27 | libgirepository1.0-dev \ 28 | libglib2.0-dev \ 29 | libglib2.0-dev-bin \ 30 | libgnutls28-dev \ 31 | liblzma-dev \ 32 | libnl-3-dev \ 33 | libnl-route-3-dev \ 34 | libselinux1-dev \ 35 | libtirpc-dev \ 36 | libtool \ 37 | libtool-bin \ 38 | libxml2-dev \ 39 | libxml2-utils \ 40 | locales \ 41 | make \ 42 | meson \ 43 | ninja-build \ 44 | perl-base \ 45 | pkgconf \ 46 | python3 \ 47 | python3-docutils \ 48 | valac \ 49 | xsltproc \ 50 | xz-utils \ 51 | zlib1g-dev && \ 52 | eatmydata apt-get autoremove -y && \ 53 | eatmydata apt-get autoclean -y && \ 54 | sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ 55 | dpkg-reconfigure locales && \ 56 | dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ 57 | mkdir -p /usr/libexec/ccache-wrappers && \ 58 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ 59 | ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc 60 | 61 | ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" 62 | ENV LANG "en_US.UTF-8" 63 | ENV MAKE "/usr/bin/make" 64 | ENV NINJA "/usr/bin/ninja" 65 | ENV PYTHON "/usr/bin/python3" 66 | -------------------------------------------------------------------------------- /ci/gitlab.yml: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | 8 | # Variables that can be set to control the behaviour of 9 | # pipelines that are run 10 | # 11 | # - RUN_PIPELINE - force creation of a CI pipeline when 12 | # pushing to a branch in a forked repository. Official 13 | # CI pipelines are triggered when merge requests are 14 | # created/updated. Setting this variable to a non-empty 15 | # value allows CI testing prior to opening a merge request. 16 | # 17 | # - RUN_CONTAINER_BUILDS - CI pipelines in upstream only 18 | # publish containers if CI file changes are detected. 19 | # Setting this variable to a non-empty value will force 20 | # re-publishing, even when no file changes are detected. 21 | # Typically to use from a scheduled job once a month. 22 | # 23 | # - RUN_UPSTREAM_NAMESPACE - the upstream namespace is 24 | # configured to default to 'libvirt'. When testing 25 | # changes to CI it might be useful to use a different 26 | # upstream. Setting this variable will override the 27 | # namespace considered to be upstream. 28 | # 29 | # These can be set as git push options 30 | # 31 | # $ git push -o ci.variable=RUN_PIPELINE=1 32 | # 33 | # Aliases can be set for common usage 34 | # 35 | # $ git config --local alias.push-ci "push -o ci.variable=RUN_PIPELINE=1" 36 | # 37 | # Allowing the less verbose invocation 38 | # 39 | # $ git push-ci 40 | # 41 | # Pipeline variables can also be set in the repository 42 | # pipeline config globally, or set against scheduled pipelines 43 | 44 | 45 | variables: 46 | RUN_UPSTREAM_NAMESPACE: libvirt 47 | 48 | 49 | workflow: 50 | rules: 51 | # upstream+forks: Avoid duplicate pipelines on pushes, if a MR is open 52 | - if: '$CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS' 53 | when: never 54 | 55 | # upstream+forks: Avoid pipelines on tag pushes 56 | - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG' 57 | when: never 58 | 59 | # upstream+forks: Allow pipelines in scenarios we've figured out job rules 60 | - if: '$CI_PIPELINE_SOURCE =~ /^(push|merge_request_event|api|web|schedule)$/' 61 | when: always 62 | 63 | # upstream+forks: Avoid all other pipelines 64 | - when: never 65 | 66 | 67 | debug: 68 | image: docker.io/library/alpine:3 69 | stage: sanity_checks 70 | needs: [] 71 | script: 72 | - printenv | sort 73 | rules: 74 | - if: '$RUN_DEBUG' 75 | when: always 76 | 77 | include: 78 | - local: '/ci/gitlab/container-templates.yml' 79 | - local: '/ci/gitlab/build-templates.yml' 80 | - local: '/ci/gitlab/sanity-checks.yml' 81 | - local: '/ci/gitlab/containers.yml' 82 | - local: '/ci/gitlab/builds.yml' 83 | -------------------------------------------------------------------------------- /ci/gitlab/container-templates.yml: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | 8 | # We want to publish containers with tag 'latest': 9 | # 10 | # - In upstream, for push to default branch with CI changes. 11 | # - In upstream, on request, for scheduled/manual pipelines 12 | # against default branch 13 | # 14 | # Note: never publish from merge requests since they have non-committed code 15 | # 16 | .container_job: 17 | image: docker:stable 18 | stage: containers 19 | needs: [] 20 | services: 21 | - docker:dind 22 | before_script: 23 | - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest" 24 | - docker info 25 | - docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" 26 | script: 27 | - docker build --tag "$TAG" -f "ci/containers/$NAME.Dockerfile" ci/containers ; 28 | - docker push "$TAG" 29 | after_script: 30 | - docker logout 31 | rules: 32 | # upstream: publish containers if there were CI changes on the default branch 33 | - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' 34 | when: on_success 35 | changes: 36 | - ci/gitlab/container-templates.yml 37 | - ci/containers/$NAME.Dockerfile 38 | 39 | # upstream: allow force re-publishing containers on default branch for web/api/scheduled pipelines 40 | - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $RUN_CONTAINER_BUILDS == "1"' 41 | when: on_success 42 | 43 | # upstream+forks: that's all folks 44 | - when: never 45 | -------------------------------------------------------------------------------- /ci/gitlab/containers.yml: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | 8 | # Native container jobs 9 | 10 | x86_64-debian-10-container: 11 | extends: .container_job 12 | allow_failure: false 13 | variables: 14 | NAME: debian-10 15 | 16 | 17 | x86_64-debian-sid-container: 18 | extends: .container_job 19 | allow_failure: true 20 | variables: 21 | NAME: debian-sid 22 | 23 | 24 | x86_64-fedora-35-container: 25 | extends: .container_job 26 | allow_failure: false 27 | variables: 28 | NAME: fedora-35 29 | 30 | 31 | x86_64-fedora-36-container: 32 | extends: .container_job 33 | allow_failure: false 34 | variables: 35 | NAME: fedora-36 36 | 37 | 38 | x86_64-fedora-rawhide-container: 39 | extends: .container_job 40 | allow_failure: true 41 | variables: 42 | NAME: fedora-rawhide 43 | 44 | 45 | x86_64-opensuse-leap-153-container: 46 | extends: .container_job 47 | allow_failure: false 48 | variables: 49 | NAME: opensuse-leap-153 50 | 51 | 52 | x86_64-opensuse-tumbleweed-container: 53 | extends: .container_job 54 | allow_failure: true 55 | variables: 56 | NAME: opensuse-tumbleweed 57 | 58 | 59 | x86_64-ubuntu-2004-container: 60 | extends: .container_job 61 | allow_failure: false 62 | variables: 63 | NAME: ubuntu-2004 64 | 65 | 66 | x86_64-ubuntu-2204-container: 67 | extends: .container_job 68 | allow_failure: false 69 | variables: 70 | NAME: ubuntu-2204 71 | -------------------------------------------------------------------------------- /ci/gitlab/sanity-checks.yml: -------------------------------------------------------------------------------- 1 | # THIS FILE WAS AUTO-GENERATED 2 | # 3 | # $ lcitool manifest ci/manifest.yml 4 | # 5 | # https://gitlab.com/libvirt/libvirt-ci 6 | 7 | 8 | check-dco: 9 | stage: sanity_checks 10 | needs: [] 11 | image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master 12 | script: 13 | - /check-dco "$RUN_UPSTREAM_NAMESPACE" 14 | rules: 15 | # upstream+forks: Run pipelines on MR 16 | - if: '$CI_PIPELINE_SOURCE =~ "merge_request_event"' 17 | when: on_success 18 | 19 | # forks: pushes to branches with pipeline requested 20 | - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $RUN_PIPELINE' 21 | when: on_success 22 | 23 | # upstream+forks: that's all folks 24 | - when: never 25 | variables: 26 | GIT_DEPTH: 1000 27 | -------------------------------------------------------------------------------- /ci/lcitool/projects/libvirt-sandbox.yml: -------------------------------------------------------------------------------- 1 | --- 2 | packages: 3 | - autoconf 4 | - automake 5 | - autopoint 6 | - ccache 7 | - cpp 8 | - gcc 9 | - gettext 10 | - glib2 11 | - gobject-introspection 12 | - gtk-doc 13 | - libc-static 14 | - libcap-ng 15 | - liblzma 16 | - liblzma-static 17 | - libselinux 18 | - libtirpc 19 | - libtool 20 | - libtoolize 21 | - libxml2 22 | - make 23 | - pkg-config 24 | - rpcgen 25 | - rpmbuild 26 | - xz 27 | - zlib 28 | - zlib-static 29 | -------------------------------------------------------------------------------- /ci/manifest.yml: -------------------------------------------------------------------------------- 1 | projects: 2 | - libvirt-sandbox 3 | - libvirt+dist 4 | - libvirt-glib+dist 5 | 6 | gitlab: 7 | namespace: libvirt 8 | project: libvirt-sandbox 9 | 10 | targets: 11 | debian-10: x86_64 12 | 13 | debian-sid: 14 | jobs: 15 | - arch: x86_64 16 | allow-failure: true 17 | 18 | fedora-35: x86_64 19 | 20 | fedora-36: x86_64 21 | 22 | fedora-rawhide: 23 | jobs: 24 | - arch: x86_64 25 | allow-failure: true 26 | 27 | opensuse-leap-153: 28 | jobs: 29 | - arch: x86_64 30 | variables: 31 | RPM: skip 32 | 33 | opensuse-tumbleweed: 34 | jobs: 35 | - arch: x86_64 36 | allow-failure: true 37 | variables: 38 | RPM: skip 39 | 40 | ubuntu-2004: x86_64 41 | 42 | ubuntu-2204: 43 | projects: 44 | - libvirt-sandbox 45 | - libvirt+minimal 46 | - libvirt-glib 47 | 48 | jobs: 49 | - arch: x86_64 50 | template: .native_git_build_job 51 | suffix: -git 52 | variables: 53 | RPM: skip 54 | -------------------------------------------------------------------------------- /docs/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = libvirt-sandbox 3 | -------------------------------------------------------------------------------- /docs/libvirt-sandbox/.gitignore: -------------------------------------------------------------------------------- 1 | Libvirt-sandbox-decl-list.txt 2 | Libvirt-sandbox-decl.txt 3 | Libvirt-sandbox-overrides.txt 4 | Libvirt-sandbox-sections.txt 5 | Libvirt-sandbox-undeclared.txt 6 | Libvirt-sandbox-undocumented.txt 7 | Libvirt-sandbox-unused.txt 8 | Libvirt-sandbox.args 9 | Libvirt-sandbox.hierarchy 10 | Libvirt-sandbox.interfaces 11 | Libvirt-sandbox.prerequisites 12 | Libvirt-sandbox.signals 13 | Libvirt-sandbox.types 14 | Libvirt-sandbox-scan.c 15 | html-build.stamp 16 | html.stamp 17 | html/ 18 | scan-build.stamp 19 | setup-build.stamp 20 | sgml-build.stamp 21 | sgml.stamp 22 | xml/ 23 | -------------------------------------------------------------------------------- /docs/libvirt-sandbox/Libvirt-sandbox-docs.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | ]> 7 | 8 | 9 | Libvirt-sandbox Reference Manual 10 | 11 | 12 | 13 | Libvirt-sandbox 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Object Hierarchy 41 | 42 | 43 | 44 | API Index 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/libvirt-sandbox/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | DOC_MODULE=Libvirt-sandbox 3 | 4 | DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml 5 | 6 | DOC_SOURCE_DIR=$(top_srcdir)/libvirt-sandbox 7 | 8 | SCANGOBJ_OPTIONS= 9 | 10 | SCAN_OPTIONS=--rebuild-sections --rebuild-types 11 | 12 | MKDB_OPTIONS=--sgml-mode --output-format=xml 13 | 14 | MKTMPL_OPTIONS= 15 | 16 | MKHTML_OPTIONS= 17 | 18 | FIXXREF_OPTIONS= 19 | 20 | HFILE_GLOB=$(top_srcdir)/libvirt-sandbox/*.h 21 | CFILE_GLOB=$(top_srcdir)/libvirt-sandbox/*.c 22 | 23 | IGNORE_HFILES= 24 | 25 | HTML_IMAGES= 26 | 27 | content_files= 28 | 29 | expand_content_files= 30 | 31 | GTKDOC_CFLAGS= \ 32 | $(GIO_UNIX_CFLAGS) \ 33 | $(LIBVIRT_GLIB_CFLAGS) \ 34 | $(LIBVIRT_GOBJECT_CFLAGS) 35 | GTKDOC_LIBS = \ 36 | $(GIO_UNIX_LIBS) \ 37 | $(LIBVIRT_GLIB_LIBS) \ 38 | $(LIBVIRT_GOBJECT_LIBS) \ 39 | $(top_builddir)/libvirt-sandbox/libvirt-sandbox-1.0.la 40 | 41 | include $(top_srcdir)/gtk-doc.make 42 | -------------------------------------------------------------------------------- /docs/testing.txt: -------------------------------------------------------------------------------- 1 | Test Plan for libvirt Sandbox 2 | ============================= 3 | 4 | For all tests, repeat with both KVM and LXC, eg 5 | 6 | export LIBVIRT_DEFAULT_URI=qemu:///session 7 | export LIBVIRT_DEFAULT_URI=qemu:///system 8 | export LIBVIRT_DEFAULT_URI=lxc:/// 9 | 10 | 1. Console I/O. 11 | 12 | a. No I/O, with TTY 13 | 14 | virt-sandbox /bin/false 15 | 16 | b. Output only, with TTY 17 | 18 | virt-sandbox /bin/date 19 | 20 | c. Input/output, with TTY 21 | 22 | virt-sandbox /bin/sh 23 | 24 | d. No I/O, without TTY 25 | 26 | virt-sandbox /bin/false < /dev/null > /dev/null 27 | 28 | e. Output only, without TTY 29 | 30 | virt-sandbox /bin/date > date.txt 31 | 32 | f. Input/output, without TTY 33 | 34 | virt-sandbox /bin/cat < src.txt > dst.txt 35 | 36 | 37 | 2. Filesystem config 38 | 39 | a. Host FS only 40 | 41 | b. Host FS + /tmp dir 42 | 43 | c. Host FS + /tmp tempdir 44 | 45 | d. Host FS + /home dir + /tmp tempdir 46 | 47 | e. Host FS + /home file 48 | 49 | f. Host FS + /home block 50 | 51 | g. Host FS + /mnt file + /home bind + /tmp bind 52 | 53 | 54 | 3. File includes 55 | 56 | a. Host FS + /tmp dir + copy file /home/tmp/foo into /tmp/foo 57 | 58 | b. Host FS + /tmp tempdir + copy file /home/tmp/foo into /tmp/foo 59 | 60 | c. Host FS + /tmp dir + copy dir /home/tmp/bar into /tmp/bar 61 | 62 | d. Host FS + /tmp tempdir + copy dir /home/tmp/bar into /tmp/bar 63 | 64 | e. Host FS + /tmp dir + copy filelist /home/tmp/foolist 65 | 66 | f. Host FS + /tmp tempdir + copy filelist /home/tmp/foolist 67 | 68 | 69 | 4. Environment / security 70 | 71 | a. Same UID/GID, same $USER, same $HOME, no capabilities 72 | 73 | b. UID/GID > 0, USER=foo, HOME=/home/foo, no capabilities 74 | 75 | c. UID/GID == 0, USER=root, HOME=/root, no capabilities 76 | 77 | d. UID/GID == 0, USER=root, HOME=/root, all capabilities 78 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | EXTRA_DIST = \ 3 | virt-sandbox.pl \ 4 | virt-sandbox.py \ 5 | virt-sandbox.js \ 6 | virt-sandbox-mkinitrd.py \ 7 | $(NULL) 8 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | Sandbox Examples 2 | ================ 3 | 4 | To run the example programs first set 5 | 6 | export GI_TYPELIB_PATH=/path/to/checkout/libvirt-sandbox: 7 | export LD_LIBRARY_PATH=/path/to/checkout/libvirt-sandbox/.libs 8 | -------------------------------------------------------------------------------- /examples/demo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from gi.repository import LibvirtGObject 4 | from gi.repository import LibvirtSandbox 5 | from gi.repository import GLib 6 | from gi.repository import Gtk 7 | 8 | LibvirtGObject.init_object_check(None) 9 | 10 | config = LibvirtSandbox.Config.new("sandbox") 11 | config.set_tty(True) 12 | net = LibvirtSandbox.ConfigNetwork().new() 13 | net.set_dhcp(True) 14 | config.add_network(net) 15 | config.set_command(["/sbin/httpd", "-some", "-arg"]) 16 | 17 | # Assuming '/tmp/privatestuff' contains a fake /etc for the 18 | # guest 19 | 20 | tmp = LibvirtSandbox.ConfigMount.new("/tmp") 21 | # This is a host path 22 | tmp.set_root("/tmp/privatestuff") 23 | config.add_host_mount(tmp) 24 | 25 | etc = LibvirtSandbox.ConfigMount.new("/etc") 26 | # This is a guest path 27 | etc.set_root("/tmp/etc") 28 | config.add_bind_mount(etc) 29 | 30 | 31 | #conn=LibvirtGObject.Connection.new("qemu:///session") 32 | conn=LibvirtGObject.Connection.new("lxc:///") 33 | conn.open(None) 34 | 35 | context = LibvirtSandbox.Context.new(conn, config) 36 | context.start() 37 | 38 | def closed(obj, error): 39 | Gtk.main_quit() 40 | 41 | 42 | console = context.get_console() 43 | console.connect("closed", closed) 44 | console.attach_stdio() 45 | 46 | Gtk.main() 47 | 48 | try: 49 | console.detach() 50 | except: 51 | pass 52 | try: 53 | context.stop() 54 | except: 55 | pass 56 | -------------------------------------------------------------------------------- /examples/shell.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from gi.repository import LibvirtGObject 4 | from gi.repository import LibvirtSandbox 5 | from gi.repository import GLib 6 | from gi.repository import Gtk 7 | 8 | LibvirtGObject.init_object_check(None) 9 | 10 | config = LibvirtSandbox.Config.new("sandbox") 11 | config.set_tty(True) 12 | 13 | #conn=LibvirtGObject.Connection.new("qemu:///session") 14 | conn=LibvirtGObject.Connection.new("lxc:///") 15 | conn.open(None) 16 | 17 | context = LibvirtSandbox.Context.new(conn, config) 18 | context.attach() 19 | 20 | def closed(obj, error): 21 | Gtk.main_quit() 22 | 23 | console = context.get_shell_console() 24 | console.connect("closed", closed) 25 | console.attach_stdio() 26 | 27 | Gtk.main() 28 | 29 | try: 30 | console.detach() 31 | except: 32 | pass 33 | -------------------------------------------------------------------------------- /examples/virt-sandbox-mkinitrd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from gi.repository import LibvirtGObject 4 | from gi.repository import LibvirtSandbox 5 | 6 | LibvirtGObject.init_object_check(None) 7 | 8 | cfg = LibvirtSandbox.ConfigInitrd.new() 9 | cfg.set_init("/sbin/busybox") 10 | cfg.add_module("virtio-rng.ko") 11 | cfg.add_module("virtio_net.ko") 12 | 13 | bld = LibvirtSandbox.BuilderInitrd.new() 14 | bld.construct(cfg, "/tmp/demo.initrd") 15 | -------------------------------------------------------------------------------- /examples/virt-sandbox.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gjs 2 | 3 | const LibvirtGObject = imports.gi.LibvirtGObject; 4 | const LibvirtSandbox = imports.gi.LibvirtSandbox; 5 | const Gtk = imports.gi.Gtk; 6 | 7 | LibvirtGObject.init_object_check(null, null); 8 | 9 | var cfg = LibvirtSandbox.ConfigInteractive.new("sandbox"); 10 | /* XXX how to set argv & check if stdin is a tty ? */ 11 | cfg.set_tty(true); 12 | 13 | var conn = LibvirtGObject.Connection.new("qemu:///session"); 14 | conn.open(null) 15 | 16 | var ctxt = LibvirtSandbox.ContextInteractive.new(conn, cfg); 17 | ctxt.start(); 18 | 19 | var con = ctxt.get_console() 20 | 21 | var closed = function(error) { 22 | Gtk.main_quit(); 23 | } 24 | 25 | con.connect("closed", closed); 26 | 27 | con.attach_stdio() 28 | 29 | Gtk.main() 30 | 31 | try { 32 | con.detach() 33 | } catch (err) {} 34 | 35 | try { 36 | ctxt.stop(); 37 | } catch (err) {} 38 | -------------------------------------------------------------------------------- /examples/virt-sandbox.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use Glib::Object::Introspection; 6 | 7 | Glib::Object::Introspection->setup(basename => 'GLib', version => '2.0', package => 'GLib'); 8 | Glib::Object::Introspection->setup(basename => 'Gtk', version => '3.0', package => 'Gtk'); 9 | Glib::Object::Introspection->setup(basename => 'LibvirtGObject', version => '1.0', package => 'LibvirtGObject'); 10 | Glib::Object::Introspection->setup(basename => 'LibvirtSandbox', version => '1.0', package => 'LibvirtSandbox'); 11 | 12 | LibvirtGObject::init_object_check(undef); 13 | 14 | my $cfg = LibvirtSandbox::ConfigInteractive->new("sandbox"); 15 | if (int(@ARGV) > 0) { 16 | $cfg->set_command(@ARGV); 17 | } 18 | if (-t STDIN) { 19 | $cfg->set_tty(1); 20 | } 21 | 22 | my $conn = LibvirtGObject::Connection->new("qemu:///session"); 23 | $conn->open(undef); 24 | 25 | my $ctxt = LibvirtSandbox::ContextInteractive->new($conn, $cfg); 26 | $ctxt->start(); 27 | 28 | my $con = $ctxt->get_console(); 29 | 30 | sub closed { 31 | Gtk::main_quit(); 32 | } 33 | 34 | $con->connect("closed", \&closed); 35 | $con->attach_stdio(); 36 | 37 | Gtk::main(); 38 | 39 | eval { 40 | $con->detach(); 41 | }; 42 | eval { 43 | $ctxt->stop(); 44 | }; 45 | -------------------------------------------------------------------------------- /examples/virt-sandbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from gi.repository import LibvirtGObject 4 | from gi.repository import LibvirtSandbox 5 | from gi.repository import GLib 6 | from gi.repository import Gtk 7 | import sys 8 | import os 9 | 10 | args = sys.argv[1:] 11 | 12 | LibvirtGObject.init_object_check(None) 13 | 14 | cfg = LibvirtSandbox.ConfigInteractive.new("sandbox") 15 | if len(args) > 0: 16 | cfg.set_command(args) 17 | if os.isatty(sys.stdin.fileno()): 18 | cfg.set_tty(True) 19 | 20 | conn = LibvirtGObject.Connection.new("qemu:///session") 21 | conn.open(None) 22 | 23 | ctxt = LibvirtSandbox.ContextInteractive.new(conn, cfg) 24 | ctxt.start() 25 | 26 | con = ctxt.get_app_console() 27 | 28 | def closed(obj, error): 29 | Gtk.main_quit() 30 | 31 | con.connect("closed", closed) 32 | con.attach_stdio() 33 | 34 | Gtk.main() 35 | 36 | try: 37 | con.detach() 38 | except: 39 | pass 40 | try: 41 | ctxt.stop() 42 | except: 43 | pass 44 | -------------------------------------------------------------------------------- /libvirt-sandbox-1.0.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libvirt-sandbox 7 | Version: @VERSION@ 8 | Description: libvirt sandbox library 9 | Libs: -L${libdir} -lvirt-sandbox-1.0 @LIBVIRT_GOBJECT_LIBS@ 10 | Cflags: -I${includedir}/libvirt-sandbox-1.0 @LIBVIRT_GOBJECT_CFLAGS@ 11 | -------------------------------------------------------------------------------- /libvirt-sandbox.spec.in: -------------------------------------------------------------------------------- 1 | # -*- rpm-spec -*- 2 | 3 | %define with_qemu 1 4 | 5 | # RHEL does not provide the 9p.ko kernel module 6 | # nor the virtio-9p KVM backend driver. 7 | %if 0%{?rhel} 8 | %define with_qemu 0 9 | %endif 10 | 11 | %define libvirt_version 1.0.2 12 | 13 | Name: @PACKAGE@ 14 | Version: @VERSION@ 15 | Release: 1%{?dist} 16 | Summary: libvirt application sandbox framework 17 | Group: Development/Tools 18 | License: LGPLv2+ 19 | URL: http://libvirt.org/ 20 | Source0: ftp://libvirt.org/libvirt/sandbox/%{name}-%{version}.tar.xz 21 | BuildRequires: libvirt-gobject-devel >= 0.2.1 22 | BuildRequires: gobject-introspection-devel 23 | BuildRequires: glibc-static 24 | BuildRequires: /usr/bin/pod2man 25 | BuildRequires: gettext 26 | BuildRequires: libselinux-devel 27 | BuildRequires: glib2-devel >= 2.32.0 28 | BuildRequires: xz-devel >= 5.0.0, xz-static 29 | BuildRequires: zlib-devel >= 1.2.0, zlib-static 30 | %if 0%{fedora} > 27 31 | BuildRequires: libtirpc-devel 32 | BuildRequires: rpcgen 33 | %endif 34 | Requires: %{name}-libs = %{version}-%{release} 35 | 36 | %package libs 37 | Group: Development/Libraries 38 | Summary: libvirt application sandbox framework libraries 39 | # So we get the full libvirtd daemon, not just client libs 40 | %if %{with_qemu} 41 | %ifarch %{ix86} x86_64 42 | Requires: libvirt-daemon-kvm >= %{libvirt_version} 43 | %else 44 | Requires: libvirt-daemon-qemu >= %{libvirt_version} 45 | %endif 46 | %endif 47 | Requires: libvirt-daemon-lxc >= %{libvirt_version} 48 | 49 | %package devel 50 | Group: Development/Libraries 51 | Summary: libvirt application sandbox framework development files 52 | Requires: %{name}-libs = %{version}-%{release} 53 | 54 | %description 55 | This package provides a command for running applications within 56 | a sandbox using libvirt. 57 | 58 | %description libs 59 | This package provides a framework for building application sandboxes 60 | using libvirt. 61 | 62 | %description devel 63 | This package provides development header files and libraries for 64 | the libvirt sandbox 65 | 66 | %prep 67 | %setup -q 68 | 69 | %build 70 | 71 | %configure --enable-introspection 72 | %__make %{?_smp_mflags} 73 | 74 | 75 | %install 76 | rm -rf $RPM_BUILD_ROOT 77 | chmod a-x examples/*.py examples/*.pl examples/*.js 78 | %__make install DESTDIR=$RPM_BUILD_ROOT 79 | rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt-sandbox-1.0.a 80 | rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt-sandbox-1.0.la 81 | 82 | %find_lang %{name} 83 | 84 | %post libs -p /sbin/ldconfig 85 | %postun libs -p /sbin/ldconfig 86 | 87 | %files 88 | %defattr(-,root,root,-) 89 | %{_bindir}/virt-sandbox 90 | %{_mandir}/man1/virt-sandbox.1* 91 | 92 | %files libs -f %{name}.lang 93 | %defattr(-,root,root,-) 94 | %doc README COPYING AUTHORS ChangeLog NEWS 95 | %dir %{_sysconfdir}/libvirt-sandbox 96 | %dir %{_sysconfdir}/libvirt-sandbox/scratch 97 | %config %{_sysconfdir}/libvirt-sandbox/scratch/README 98 | %{_libexecdir}/libvirt-sandbox-init-common 99 | %{_libexecdir}/libvirt-sandbox-init-lxc 100 | %{_libexecdir}/libvirt-sandbox-init-qemu 101 | %{_libdir}/libvirt-sandbox-1.0.so.* 102 | %{_libdir}/girepository-1.0/LibvirtSandbox-1.0.typelib 103 | 104 | %files devel 105 | %defattr(-,root,root,-) 106 | %doc examples/virt-sandbox.pl 107 | %doc examples/virt-sandbox.py 108 | %doc examples/virt-sandbox.js 109 | %doc examples/virt-sandbox-mkinitrd.py 110 | %{_libdir}/libvirt-sandbox-1.0.so 111 | %{_libdir}/pkgconfig/libvirt-sandbox-1.0.pc 112 | %dir %{_includedir}/libvirt-sandbox-1.0 113 | %dir %{_includedir}/libvirt-sandbox-1.0/libvirt-sandbox 114 | %{_includedir}/libvirt-sandbox-1.0/libvirt-sandbox/libvirt-sandbox.h 115 | %{_includedir}/libvirt-sandbox-1.0/libvirt-sandbox/libvirt-sandbox-*.h 116 | %{_datadir}/gir-1.0/LibvirtSandbox-1.0.gir 117 | %{_datadir}/gtk-doc/html/Libvirt-sandbox 118 | 119 | %changelog 120 | -------------------------------------------------------------------------------- /libvirt-sandbox/README: -------------------------------------------------------------------------------- 1 | This directory must not be deleted, not used for storing any 2 | important files on the host. 3 | 4 | This directory is used as the mount point to which the sandbox 5 | private configuration is attached. 6 | 7 | Without this directory being present, it will be impossible to 8 | start any sandboxes 9 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-builder-container.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-builder-container.h: libvirt sandbox builder for virtual containers 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_BUILDER_CONTAINER_H__ 28 | #define __LIBVIRT_SANDBOX_BUILDER_CONTAINER_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_BUILDER_CONTAINER (gvir_sandbox_builder_container_get_type ()) 33 | #define GVIR_SANDBOX_BUILDER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_BUILDER_CONTAINER, GVirSandboxBuilderContainer)) 34 | #define GVIR_SANDBOX_BUILDER_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_BUILDER_CONTAINER, GVirSandboxBuilderContainerClass)) 35 | #define GVIR_SANDBOX_IS_BUILDER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_BUILDER_CONTAINER)) 36 | #define GVIR_SANDBOX_IS_BUILDER_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_BUILDER_CONTAINER)) 37 | #define GVIR_SANDBOX_BUILDER_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_BUILDER_CONTAINER, GVirSandboxBuilderContainerClass)) 38 | 39 | typedef struct _GVirSandboxBuilderContainer GVirSandboxBuilderContainer; 40 | typedef struct _GVirSandboxBuilderContainerPrivate GVirSandboxBuilderContainerPrivate; 41 | typedef struct _GVirSandboxBuilderContainerClass GVirSandboxBuilderContainerClass; 42 | 43 | struct _GVirSandboxBuilderContainer 44 | { 45 | GVirSandboxBuilder parent; 46 | 47 | GVirSandboxBuilderContainerPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxBuilderContainerClass 53 | { 54 | GVirSandboxBuilderClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_builder_container_get_type(void); 60 | 61 | GVirSandboxBuilderContainer *gvir_sandbox_builder_container_new(GVirConnection *connection); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* __LIBVIRT_SANDBOX_BUILDER_CONTAINER_H__ */ 66 | 67 | /* 68 | * Local variables: 69 | * c-indent-level: 4 70 | * c-basic-offset: 4 71 | * indent-tabs-mode: nil 72 | * tab-width: 8 73 | * End: 74 | */ 75 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-builder-initrd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-builder-initrd.h: libvirt sandbox builder for virtual initrds 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_BUILDER_INITRD_H__ 28 | #define __LIBVIRT_SANDBOX_BUILDER_INITRD_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_BUILDER_INITRD (gvir_sandbox_builder_initrd_get_type ()) 33 | #define GVIR_SANDBOX_BUILDER_INITRD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_BUILDER_INITRD, GVirSandboxBuilderInitrd)) 34 | #define GVIR_SANDBOX_BUILDER_INITRD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_BUILDER_INITRD, GVirSandboxBuilderInitrdClass)) 35 | #define GVIR_SANDBOX_IS_BUILDER_INITRD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_BUILDER_INITRD)) 36 | #define GVIR_SANDBOX_IS_BUILDER_INITRD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_BUILDER_INITRD)) 37 | #define GVIR_SANDBOX_BUILDER_INITRD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_BUILDER_INITRD, GVirSandboxBuilderInitrdClass)) 38 | 39 | typedef struct _GVirSandboxBuilderInitrd GVirSandboxBuilderInitrd; 40 | typedef struct _GVirSandboxBuilderInitrdPrivate GVirSandboxBuilderInitrdPrivate; 41 | typedef struct _GVirSandboxBuilderInitrdClass GVirSandboxBuilderInitrdClass; 42 | 43 | struct _GVirSandboxBuilderInitrd 44 | { 45 | GObject parent; 46 | 47 | GVirSandboxBuilderInitrdPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxBuilderInitrdClass 53 | { 54 | GObjectClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_builder_initrd_get_type(void); 60 | 61 | GVirSandboxBuilderInitrd *gvir_sandbox_builder_initrd_new(void); 62 | 63 | gboolean gvir_sandbox_builder_initrd_construct(GVirSandboxBuilderInitrd *builder, 64 | GVirSandboxConfigInitrd *config, 65 | gchar *outputfile, 66 | GError **error); 67 | 68 | G_END_DECLS 69 | 70 | #endif /* __LIBVIRT_SANDBOX_BUILDER_INITRD_H__ */ 71 | 72 | /* 73 | * Local variables: 74 | * c-indent-level: 4 75 | * c-basic-offset: 4 76 | * indent-tabs-mode: nil 77 | * tab-width: 8 78 | * End: 79 | */ 80 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-builder-machine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-builder-machine.h: libvirt sandbox builder for virtual machines 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_BUILDER_MACHINE_H__ 28 | #define __LIBVIRT_SANDBOX_BUILDER_MACHINE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_BUILDER_MACHINE (gvir_sandbox_builder_machine_get_type ()) 33 | #define GVIR_SANDBOX_BUILDER_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_BUILDER_MACHINE, GVirSandboxBuilderMachine)) 34 | #define GVIR_SANDBOX_BUILDER_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_BUILDER_MACHINE, GVirSandboxBuilderMachineClass)) 35 | #define GVIR_SANDBOX_IS_BUILDER_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_BUILDER_MACHINE)) 36 | #define GVIR_SANDBOX_IS_BUILDER_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_BUILDER_MACHINE)) 37 | #define GVIR_SANDBOX_BUILDER_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_BUILDER_MACHINE, GVirSandboxBuilderMachineClass)) 38 | 39 | typedef struct _GVirSandboxBuilderMachine GVirSandboxBuilderMachine; 40 | typedef struct _GVirSandboxBuilderMachinePrivate GVirSandboxBuilderMachinePrivate; 41 | typedef struct _GVirSandboxBuilderMachineClass GVirSandboxBuilderMachineClass; 42 | 43 | struct _GVirSandboxBuilderMachine 44 | { 45 | GVirSandboxBuilder parent; 46 | 47 | GVirSandboxBuilderMachinePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxBuilderMachineClass 53 | { 54 | GVirSandboxBuilderClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_builder_machine_get_type(void); 60 | 61 | GVirSandboxBuilderMachine *gvir_sandbox_builder_machine_new(GVirConnection *connection); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* __LIBVIRT_SANDBOX_BUILDER_MACHINE_H__ */ 66 | 67 | /* 68 | * Local variables: 69 | * c-indent-level: 4 70 | * c-basic-offset: 4 71 | * indent-tabs-mode: nil 72 | * tab-width: 8 73 | * End: 74 | */ 75 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-builder-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-builder-private.h: libvirt sandbox builder 3 | * 4 | * Copyright (C) 2014 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Christophe Fergeau 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_BUILDER_PRIVATE_H__ 28 | #define __LIBVIRT_SANDBOX_BUILDER_PRIVATE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | void gvir_sandbox_builder_set_filterref(GVirSandboxBuilder *builder, 33 | GVirConfigDomainInterface *iface, 34 | GVirSandboxConfigNetworkFilterref *filterref); 35 | 36 | G_END_DECLS 37 | 38 | #endif /* __LIBVIRT_SANDBOX_BUILDER_PRIVATE_H__ */ 39 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-all.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox.h: libvirt sandbox integration 3 | [ * 4 | * Copyright (C) 2010 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #ifndef __LIBVIRT_SANDBOX_CONFIG_ALL_H__ 24 | #define __LIBVIRT_SANDBOX_CONFIG_ALL_H__ 25 | 26 | /* External include */ 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* Local includes */ 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #endif /* __LIBVIRT_SANDBOX_CONFIG_ALL_H__ */ 54 | 55 | /* 56 | * Local variables: 57 | * c-indent-level: 4 58 | * c-basic-offset: 4 59 | * indent-tabs-mode: nil 60 | * tab-width: 8 61 | * End: 62 | */ 63 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-disk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-diskaccess.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2015 Universitat Politècnica de Catalunya. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Eren Yagdiran 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_DISK_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_DISK_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_DISK (gvir_sandbox_config_disk_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_DISK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_DISK, GVirSandboxConfigDisk)) 34 | #define GVIR_SANDBOX_CONFIG_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_DISK, GVirSandboxConfigDiskClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_DISK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_DISK)) 36 | #define GVIR_SANDBOX_IS_CONFIG_DISK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_DISK)) 37 | #define GVIR_SANDBOX_CONFIG_DISK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_DISK, GVirSandboxConfigDiskClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONFIG_DISK_HANDLE (gvir_sandbox_config_disk_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxConfigDisk GVirSandboxConfigDisk; 42 | typedef struct _GVirSandboxConfigDiskPrivate GVirSandboxConfigDiskPrivate; 43 | typedef struct _GVirSandboxConfigDiskClass GVirSandboxConfigDiskClass; 44 | 45 | struct _GVirSandboxConfigDisk 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxConfigDiskPrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxConfigDiskClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_config_disk_get_type(void); 62 | 63 | const gchar *gvir_sandbox_config_disk_get_tag(GVirSandboxConfigDisk *config); 64 | 65 | const gchar *gvir_sandbox_config_disk_get_source(GVirSandboxConfigDisk *config); 66 | 67 | GVirConfigDomainDiskType gvir_sandbox_config_disk_get_disk_type(GVirSandboxConfigDisk *config); 68 | 69 | GVirConfigDomainDiskFormat gvir_sandbox_config_disk_get_format(GVirSandboxConfigDisk *config); 70 | 71 | G_END_DECLS 72 | 73 | #endif /* __LIBVIRT_SANDBOX_CONFIG_DISK_H__ */ 74 | 75 | /* 76 | * Local variables: 77 | * c-indent-level: 4 78 | * c-basic-offset: 4 79 | * indent-tabs-mode: nil 80 | * tab-width: 8 81 | * End: 82 | */ 83 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-initrd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-initrd.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_INITRD_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_INITRD_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_INITRD (gvir_sandbox_config_initrd_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_INITRD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_INITRD, GVirSandboxConfigInitrd)) 34 | #define GVIR_SANDBOX_CONFIG_INITRD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_INITRD, GVirSandboxConfigInitrdClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_INITRD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_INITRD)) 36 | #define GVIR_SANDBOX_IS_CONFIG_INITRD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_INITRD)) 37 | #define GVIR_SANDBOX_CONFIG_INITRD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_INITRD, GVirSandboxConfigInitrdClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONFIG_INITRD_HANDLE (gvir_sandbox_config_initrd_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxConfigInitrd GVirSandboxConfigInitrd; 42 | typedef struct _GVirSandboxConfigInitrdPrivate GVirSandboxConfigInitrdPrivate; 43 | typedef struct _GVirSandboxConfigInitrdClass GVirSandboxConfigInitrdClass; 44 | 45 | struct _GVirSandboxConfigInitrd 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxConfigInitrdPrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxConfigInitrdClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_config_initrd_get_type(void); 62 | 63 | GVirSandboxConfigInitrd *gvir_sandbox_config_initrd_new(void); 64 | 65 | void gvir_sandbox_config_initrd_set_kver(GVirSandboxConfigInitrd *config, const gchar *version); 66 | const gchar *gvir_sandbox_config_initrd_get_kver(GVirSandboxConfigInitrd *config); 67 | 68 | void gvir_sandbox_config_initrd_set_kmoddir(GVirSandboxConfigInitrd *config, const gchar *kmoddir); 69 | const gchar *gvir_sandbox_config_initrd_get_kmoddir(GVirSandboxConfigInitrd *config); 70 | 71 | void gvir_sandbox_config_initrd_set_init(GVirSandboxConfigInitrd *config, const gchar *hostpath); 72 | const gchar *gvir_sandbox_config_initrd_get_init(GVirSandboxConfigInitrd *config); 73 | 74 | void gvir_sandbox_config_initrd_add_module(GVirSandboxConfigInitrd *config, const gchar *modname); 75 | GList *gvir_sandbox_config_initrd_get_modules(GVirSandboxConfigInitrd *config); 76 | 77 | G_END_DECLS 78 | 79 | #endif /* __LIBVIRT_SANDBOX_CONFIG_INITRD_H__ */ 80 | 81 | /* 82 | * Local variables: 83 | * c-indent-level: 4 84 | * c-basic-offset: 4 85 | * indent-tabs-mode: nil 86 | * tab-width: 8 87 | * End: 88 | */ 89 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-interactive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-interactive.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE (gvir_sandbox_config_interactive_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractive)) 34 | #define GVIR_SANDBOX_CONFIG_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractiveClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE)) 36 | #define GVIR_SANDBOX_IS_CONFIG_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE)) 37 | #define GVIR_SANDBOX_CONFIG_INTERACTIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_INTERACTIVE, GVirSandboxConfigInteractiveClass)) 38 | 39 | typedef struct _GVirSandboxConfigInteractive GVirSandboxConfigInteractive; 40 | typedef struct _GVirSandboxConfigInteractivePrivate GVirSandboxConfigInteractivePrivate; 41 | typedef struct _GVirSandboxConfigInteractiveClass GVirSandboxConfigInteractiveClass; 42 | 43 | struct _GVirSandboxConfigInteractive 44 | { 45 | GVirSandboxConfig parent; 46 | 47 | GVirSandboxConfigInteractivePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigInteractiveClass 53 | { 54 | GVirSandboxConfigClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_interactive_get_type(void); 60 | 61 | GVirSandboxConfigInteractive *gvir_sandbox_config_interactive_new(const gchar *name); 62 | 63 | void gvir_sandbox_config_interactive_set_tty(GVirSandboxConfigInteractive *config, gboolean tty); 64 | gboolean gvir_sandbox_config_interactive_get_tty(GVirSandboxConfigInteractive *config); 65 | 66 | void gvir_sandbox_config_interactive_set_command(GVirSandboxConfigInteractive *config, gchar **argv); 67 | 68 | 69 | G_END_DECLS 70 | 71 | #endif /* __LIBVIRT_SANDBOX_CONFIG_INTERACTIVE_H__ */ 72 | 73 | /* 74 | * Local variables: 75 | * c-indent-level: 4 76 | * c-basic-offset: 4 77 | * indent-tabs-mode: nil 78 | * tab-width: 8 79 | * End: 80 | */ 81 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-file.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_FILE_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_FILE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE (gvir_sandbox_config_mount_file_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE, GVirSandboxConfigMountFile)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE, GVirSandboxConfigMountFileClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE, GVirSandboxConfigMountFileClass)) 38 | 39 | typedef struct _GVirSandboxConfigMountFile GVirSandboxConfigMountFile; 40 | typedef struct _GVirSandboxConfigMountFilePrivate GVirSandboxConfigMountFilePrivate; 41 | typedef struct _GVirSandboxConfigMountFileClass GVirSandboxConfigMountFileClass; 42 | 43 | struct _GVirSandboxConfigMountFile 44 | { 45 | GVirSandboxConfigMount parent; 46 | 47 | GVirSandboxConfigMountFilePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigMountFileClass 53 | { 54 | GVirSandboxConfigMountClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_mount_file_get_type(void); 60 | 61 | void gvir_sandbox_config_mount_file_set_source(GVirSandboxConfigMountFile *config, const gchar *source); 62 | const gchar *gvir_sandbox_config_mount_file_get_source(GVirSandboxConfigMountFile *config); 63 | 64 | G_END_DECLS 65 | 66 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_FILE_H__ */ 67 | 68 | /* 69 | * Local variables: 70 | * c-indent-level: 4 71 | * c-basic-offset: 4 72 | * indent-tabs-mode: nil 73 | * tab-width: 8 74 | * End: 75 | */ 76 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-guest-bind.c: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include "libvirt-sandbox/libvirt-sandbox-config-all.h" 27 | 28 | /** 29 | * SECTION: libvirt-sandbox-config-mount-guest-bind 30 | * @short_description: Bindsystem attachment configuration details 31 | * @include: libvirt-sandbox/libvirt-sandbox.h 32 | * @see_aloso: #GVirSandboxConfig 33 | * 34 | * Provides an object to store information about a bindsystem attachment in the sandbox 35 | * 36 | * The GVirSandboxConfigMount object stores information required to attach 37 | * a guest bindsystem to the application sandbox. The sandbox starts off with 38 | * a complete view of the guest bindsystem. This object allows a specific 39 | * area of the guest bindsystem to be hidden and replaced with alternate 40 | * content. 41 | */ 42 | 43 | #define GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND_GET_PRIVATE(obj) \ 44 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND, GVirSandboxConfigMountGuestBindPrivate)) 45 | 46 | struct _GVirSandboxConfigMountGuestBindPrivate 47 | { 48 | gboolean unused; 49 | }; 50 | 51 | G_DEFINE_TYPE_WITH_PRIVATE(GVirSandboxConfigMountGuestBind, gvir_sandbox_config_mount_guest_bind, GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE); 52 | 53 | 54 | static void gvir_sandbox_config_mount_guest_bind_class_init(GVirSandboxConfigMountGuestBindClass *klass G_GNUC_UNUSED) 55 | { 56 | } 57 | 58 | 59 | static void gvir_sandbox_config_mount_guest_bind_init(GVirSandboxConfigMountGuestBind *config) 60 | { 61 | config->priv = GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND_GET_PRIVATE(config); 62 | } 63 | 64 | 65 | /** 66 | * gvir_sandbox_config_mount_guest_bind_new: 67 | * @targetdir: (transfer none): the target directory 68 | * 69 | * Create a new custom mount mapped to the directory @targetdir 70 | * 71 | * Returns: (transfer full): a new sandbox mount object 72 | */ 73 | GVirSandboxConfigMountGuestBind *gvir_sandbox_config_mount_guest_bind_new(const gchar *source, 74 | const gchar *targetdir) 75 | { 76 | return GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND(g_object_new(GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND, 77 | "source", source, 78 | "target", targetdir, 79 | NULL)); 80 | } 81 | 82 | /* 83 | * Local variables: 84 | * c-indent-level: 4 85 | * c-basic-offset: 4 86 | * indent-tabs-mode: nil 87 | * tab-width: 8 88 | * End: 89 | */ 90 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-guest-bind.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_GUEST_BIND_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_GUEST_BIND_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND (gvir_sandbox_config_mount_guest_bind_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND, GVirSandboxConfigMountGuestBind)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND, GVirSandboxConfigMountGuestBindClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_GUEST_BIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_GUEST_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_GUEST_BIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_GUEST_BIND, GVirSandboxConfigMountGuestBindClass)) 38 | 39 | typedef struct _GVirSandboxConfigMountGuestBind GVirSandboxConfigMountGuestBind; 40 | typedef struct _GVirSandboxConfigMountGuestBindPrivate GVirSandboxConfigMountGuestBindPrivate; 41 | typedef struct _GVirSandboxConfigMountGuestBindClass GVirSandboxConfigMountGuestBindClass; 42 | 43 | struct _GVirSandboxConfigMountGuestBind 44 | { 45 | GVirSandboxConfigMountFile parent; 46 | 47 | GVirSandboxConfigMountGuestBindPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigMountGuestBindClass 53 | { 54 | GVirSandboxConfigMountFileClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_mount_guest_bind_get_type(void); 60 | 61 | GVirSandboxConfigMountGuestBind *gvir_sandbox_config_mount_guest_bind_new(const gchar *source, 62 | const gchar *targetdir); 63 | 64 | G_END_DECLS 65 | 66 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_GUEST_BIND_H__ */ 67 | 68 | /* 69 | * Local variables: 70 | * c-indent-level: 4 71 | * c-basic-offset: 4 72 | * indent-tabs-mode: nil 73 | * tab-width: 8 74 | * End: 75 | */ 76 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-host-bind.c: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include "libvirt-sandbox/libvirt-sandbox-config-all.h" 27 | 28 | /** 29 | * SECTION: libvirt-sandbox-config-mount-host-bind 30 | * @short_description: Bindsystem attachment configuration details 31 | * @include: libvirt-sandbox/libvirt-sandbox.h 32 | * @see_aloso: #GVirSandboxConfig 33 | * 34 | * Provides an object to store information about a bindsystem attachment in the sandbox 35 | * 36 | * The GVirSandboxConfigMount object stores information required to attach 37 | * a host bindsystem to the application sandbox. The sandbox starts off with 38 | * a complete view of the host bindsystem. This object allows a specific 39 | * area of the host bindsystem to be hidden and replaced with alternate 40 | * content. 41 | */ 42 | 43 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND_GET_PRIVATE(obj) \ 44 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND, GVirSandboxConfigMountHostBindPrivate)) 45 | 46 | struct _GVirSandboxConfigMountHostBindPrivate 47 | { 48 | gboolean unused; 49 | }; 50 | 51 | G_DEFINE_TYPE_WITH_PRIVATE(GVirSandboxConfigMountHostBind, gvir_sandbox_config_mount_host_bind, GVIR_SANDBOX_TYPE_CONFIG_MOUNT_FILE); 52 | 53 | 54 | static void gvir_sandbox_config_mount_host_bind_class_init(GVirSandboxConfigMountHostBindClass *klass G_GNUC_UNUSED) 55 | { 56 | } 57 | 58 | 59 | static void gvir_sandbox_config_mount_host_bind_init(GVirSandboxConfigMountHostBind *config) 60 | { 61 | config->priv = GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND_GET_PRIVATE(config); 62 | } 63 | 64 | 65 | /** 66 | * gvir_sandbox_config_mount_host_bind_new: 67 | * @targetdir: (transfer none): the target directory 68 | * 69 | * Create a new custom mount mapped to the directory @targetdir 70 | * 71 | * Returns: (transfer full): a new sandbox mount object 72 | */ 73 | GVirSandboxConfigMountHostBind *gvir_sandbox_config_mount_host_bind_new(const gchar *source, 74 | const gchar *targetdir) 75 | { 76 | return GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND(g_object_new(GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND, 77 | "source", source, 78 | "target", targetdir, 79 | NULL)); 80 | } 81 | 82 | /* 83 | * Local variables: 84 | * c-indent-level: 4 85 | * c-basic-offset: 4 86 | * indent-tabs-mode: nil 87 | * tab-width: 8 88 | * End: 89 | */ 90 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-host-bind.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_BIND_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_BIND_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND (gvir_sandbox_config_mount_host_bind_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND, GVirSandboxConfigMountHostBind)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND, GVirSandboxConfigMountHostBindClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_BIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_BIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_BIND, GVirSandboxConfigMountHostBindClass)) 38 | 39 | typedef struct _GVirSandboxConfigMountHostBind GVirSandboxConfigMountHostBind; 40 | typedef struct _GVirSandboxConfigMountHostBindPrivate GVirSandboxConfigMountHostBindPrivate; 41 | typedef struct _GVirSandboxConfigMountHostBindClass GVirSandboxConfigMountHostBindClass; 42 | 43 | struct _GVirSandboxConfigMountHostBind 44 | { 45 | GVirSandboxConfigMountFile parent; 46 | 47 | GVirSandboxConfigMountHostBindPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigMountHostBindClass 53 | { 54 | GVirSandboxConfigMountFileClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_mount_host_bind_get_type(void); 60 | 61 | GVirSandboxConfigMountHostBind *gvir_sandbox_config_mount_host_bind_new(const gchar *source, 62 | const gchar *targetdir); 63 | 64 | G_END_DECLS 65 | 66 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_BIND_H__ */ 67 | 68 | /* 69 | * Local variables: 70 | * c-indent-level: 4 71 | * c-basic-offset: 4 72 | * indent-tabs-mode: nil 73 | * tab-width: 8 74 | * End: 75 | */ 76 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-host-image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-host-image.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_IMAGE_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_IMAGE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE (gvir_sandbox_config_mount_host_image_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE, GVirSandboxConfigMountHostImage)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE, GVirSandboxConfigMountHostImageClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_HOST_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HOST_IMAGE, GVirSandboxConfigMountHostImageClass)) 38 | 39 | typedef struct _GVirSandboxConfigMountHostImage GVirSandboxConfigMountHostImage; 40 | typedef struct _GVirSandboxConfigMountHostImagePrivate GVirSandboxConfigMountHostImagePrivate; 41 | typedef struct _GVirSandboxConfigMountHostImageClass GVirSandboxConfigMountHostImageClass; 42 | 43 | struct _GVirSandboxConfigMountHostImage 44 | { 45 | GVirSandboxConfigMountFile parent; 46 | 47 | GVirSandboxConfigMountHostImagePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigMountHostImageClass 53 | { 54 | GVirSandboxConfigMountFileClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_mount_host_image_get_type(void); 60 | 61 | GVirSandboxConfigMountHostImage *gvir_sandbox_config_mount_host_image_new(const gchar *source, 62 | const gchar *targetdir, 63 | GVirConfigDomainDiskFormat format); 64 | 65 | GVirConfigDomainDiskFormat gvir_sandbox_config_mount_host_image_get_format(GVirSandboxConfigMountHostImage *config); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_HOST_IMAGE_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount-ram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount-ram.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_RAM_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_RAM_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM (gvir_sandbox_config_mount_ram_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT_RAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM, GVirSandboxConfigMountRam)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_RAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM, GVirSandboxConfigMountRamClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_RAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_RAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_RAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM, GVirSandboxConfigMountRamClass)) 38 | 39 | typedef struct _GVirSandboxConfigMountRam GVirSandboxConfigMountRam; 40 | typedef struct _GVirSandboxConfigMountRamPrivate GVirSandboxConfigMountRamPrivate; 41 | typedef struct _GVirSandboxConfigMountRamClass GVirSandboxConfigMountRamClass; 42 | 43 | struct _GVirSandboxConfigMountRam 44 | { 45 | GVirSandboxConfigMount parent; 46 | 47 | GVirSandboxConfigMountRamPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigMountRamClass 53 | { 54 | GVirSandboxConfigMountClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_mount_ram_get_type(void); 60 | 61 | GVirSandboxConfigMountRam *gvir_sandbox_config_mount_ram_new(const gchar *targetdir, 62 | guint64 usage); 63 | 64 | void gvir_sandbox_config_mount_ram_set_usage(GVirSandboxConfigMountRam *config, guint64 usage); 65 | guint64 gvir_sandbox_config_mount_ram_get_usage(GVirSandboxConfigMountRam *config); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_RAM_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-mount.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-mount.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_MOUNT_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_MOUNT_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT (gvir_sandbox_config_mount_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT, GVirSandboxConfigMount)) 34 | #define GVIR_SANDBOX_CONFIG_MOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT, GVirSandboxConfigMountClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT)) 36 | #define GVIR_SANDBOX_IS_CONFIG_MOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_MOUNT)) 37 | #define GVIR_SANDBOX_CONFIG_MOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_MOUNT, GVirSandboxConfigMountClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONFIG_MOUNT_HANDLE (gvir_sandbox_config_mount_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxConfigMount GVirSandboxConfigMount; 42 | typedef struct _GVirSandboxConfigMountPrivate GVirSandboxConfigMountPrivate; 43 | typedef struct _GVirSandboxConfigMountClass GVirSandboxConfigMountClass; 44 | 45 | struct _GVirSandboxConfigMount 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxConfigMountPrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxConfigMountClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_config_mount_get_type(void); 62 | 63 | const gchar *gvir_sandbox_config_mount_get_target(GVirSandboxConfigMount *config); 64 | 65 | void gvir_sandbox_config_mount_add_include(GVirSandboxConfigMount *config, 66 | const gchar *srcpath, const gchar *dstpath); 67 | 68 | GHashTable *gvir_sandbox_config_mount_get_includes(GVirSandboxConfigMount *config); 69 | 70 | G_END_DECLS 71 | 72 | #endif /* __LIBVIRT_SANDBOX_CONFIG_MOUNT_H__ */ 73 | 74 | /* 75 | * Local variables: 76 | * c-indent-level: 4 77 | * c-basic-offset: 4 78 | * indent-tabs-mode: nil 79 | * tab-width: 8 80 | * End: 81 | */ 82 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-network-address.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-network-address.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_NETWORK_ADDRESS_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_NETWORK_ADDRESS_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS (gvir_sandbox_config_network_address_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_NETWORK_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS, GVirSandboxConfigNetworkAddress)) 34 | #define GVIR_SANDBOX_CONFIG_NETWORK_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS, GVirSandboxConfigNetworkAddressClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS)) 36 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS)) 37 | #define GVIR_SANDBOX_CONFIG_NETWORK_ADDRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS, GVirSandboxConfigNetworkAddressClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ADDRESS_HANDLE (gvir_sandbox_config_network_address_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxConfigNetworkAddress GVirSandboxConfigNetworkAddress; 42 | typedef struct _GVirSandboxConfigNetworkAddressPrivate GVirSandboxConfigNetworkAddressPrivate; 43 | typedef struct _GVirSandboxConfigNetworkAddressClass GVirSandboxConfigNetworkAddressClass; 44 | 45 | struct _GVirSandboxConfigNetworkAddress 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxConfigNetworkAddressPrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxConfigNetworkAddressClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_config_network_address_get_type(void); 62 | 63 | GVirSandboxConfigNetworkAddress *gvir_sandbox_config_network_address_new(GInetAddress *primary, 64 | guint prefix, 65 | GInetAddress *broadcast); 66 | 67 | void gvir_sandbox_config_network_address_set_primary(GVirSandboxConfigNetworkAddress *config, GInetAddress *addr); 68 | GInetAddress *gvir_sandbox_config_network_address_get_primary(GVirSandboxConfigNetworkAddress *config); 69 | 70 | void gvir_sandbox_config_network_address_set_prefix(GVirSandboxConfigNetworkAddress *config, guint prefix); 71 | guint gvir_sandbox_config_network_address_get_prefix(GVirSandboxConfigNetworkAddress *config); 72 | 73 | void gvir_sandbox_config_network_address_set_broadcast(GVirSandboxConfigNetworkAddress *config, GInetAddress *addr); 74 | GInetAddress *gvir_sandbox_config_network_address_get_broadcast(GVirSandboxConfigNetworkAddress *config); 75 | 76 | G_END_DECLS 77 | 78 | #endif /* __LIBVIRT_SANDBOX_CONFIG_NETWORK_ADDRESS_H__ */ 79 | 80 | /* 81 | * Local variables: 82 | * c-indent-level: 4 83 | * c-basic-offset: 4 84 | * indent-tabs-mode: nil 85 | * tab-width: 8 86 | * End: 87 | */ 88 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-network-filterref-parameter.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2014 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Ian Main 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER (gvir_sandbox_config_network_filterref_parameter_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER, GVirSandboxConfigNetworkFilterrefParameter)) 34 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER, GVirSandboxConfigNetworkFilterrefParameterClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_FILTERREF_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER)) 36 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_FILTERREF_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER)) 37 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF_PARAMETER, GVirSandboxConfigNetworkFilterrefParameterClass)) 38 | 39 | typedef struct _GVirSandboxConfigNetworkFilterrefParameter GVirSandboxConfigNetworkFilterrefParameter; 40 | typedef struct _GVirSandboxConfigNetworkFilterrefParameterPrivate GVirSandboxConfigNetworkFilterrefParameterPrivate; 41 | typedef struct _GVirSandboxConfigNetworkFilterrefParameterClass GVirSandboxConfigNetworkFilterrefParameterClass; 42 | 43 | struct _GVirSandboxConfigNetworkFilterrefParameter 44 | { 45 | GObject parent; 46 | 47 | GVirSandboxConfigNetworkFilterrefParameterPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigNetworkFilterrefParameterClass 53 | { 54 | GObjectClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_network_filterref_parameter_get_type(void); 60 | 61 | GVirSandboxConfigNetworkFilterrefParameter *gvir_sandbox_config_network_filterref_parameter_new(void); 62 | 63 | void gvir_sandbox_config_network_filterref_parameter_set_name(GVirSandboxConfigNetworkFilterrefParameter *param, 64 | const gchar *name); 65 | const gchar *gvir_sandbox_config_network_filterref_parameter_get_name(GVirSandboxConfigNetworkFilterrefParameter *param); 66 | 67 | void gvir_sandbox_config_network_filterref_parameter_set_value(GVirSandboxConfigNetworkFilterrefParameter *param, 68 | const gchar *value); 69 | const gchar *gvir_sandbox_config_network_filterref_parameter_get_value(GVirSandboxConfigNetworkFilterrefParameter *param); 70 | 71 | G_END_DECLS 72 | 73 | #endif /* __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_PARAMETER_H__ */ 74 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-network-filterref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-network-filterref.h: libvirt sandbox filter reference 3 | * configuration 4 | * 5 | * Copyright (C) 2014 Red Hat, Inc. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | * Author: Ian Main 22 | */ 23 | 24 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 25 | #error "Only can be included directly." 26 | #endif 27 | 28 | #ifndef __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_H__ 29 | #define __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_H__ 30 | 31 | G_BEGIN_DECLS 32 | 33 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF (gvir_sandbox_config_network_filterref_get_type ()) 34 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF, GVirSandboxConfigNetworkFilterref)) 35 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF, GVirSandboxConfigNetworkFilterrefClass)) 36 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_FILTERREF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF)) 37 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_FILTERREF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF)) 38 | #define GVIR_SANDBOX_CONFIG_NETWORK_FILTERREF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_FILTERREF, GVirSandboxConfigNetworkFilterrefClass)) 39 | 40 | typedef struct _GVirSandboxConfigNetworkFilterref GVirSandboxConfigNetworkFilterref; 41 | typedef struct _GVirSandboxConfigNetworkFilterrefPrivate GVirSandboxConfigNetworkFilterrefPrivate; 42 | typedef struct _GVirSandboxConfigNetworkFilterrefClass GVirSandboxConfigNetworkFilterrefClass; 43 | 44 | struct _GVirSandboxConfigNetworkFilterref 45 | { 46 | GObject parent; 47 | 48 | GVirSandboxConfigNetworkFilterrefPrivate *priv; 49 | 50 | /* Do not add fields to this struct */ 51 | }; 52 | 53 | struct _GVirSandboxConfigNetworkFilterrefClass 54 | { 55 | GObjectClass parent_class; 56 | 57 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 58 | }; 59 | 60 | GType gvir_sandbox_config_network_filterref_get_type(void); 61 | 62 | GVirSandboxConfigNetworkFilterref *gvir_sandbox_config_network_filterref_new(void); 63 | 64 | const gchar *gvir_sandbox_config_network_filterref_get_name(GVirSandboxConfigNetworkFilterref *config); 65 | void gvir_sandbox_config_network_filterref_set_name(GVirSandboxConfigNetworkFilterref *filter, const gchar *name); 66 | 67 | void gvir_sandbox_config_network_filterref_add_parameter(GVirSandboxConfigNetworkFilterref *filter, 68 | GVirSandboxConfigNetworkFilterrefParameter *param); 69 | GList *gvir_sandbox_config_network_filterref_get_parameters(GVirSandboxConfigNetworkFilterref *filter); 70 | 71 | 72 | G_END_DECLS 73 | 74 | #endif /* __LIBVIRT_SANDBOX_CONFIG_NETWORK_FILTERREF_H__ */ 75 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-network-route.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-network-route.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_NETWORK_ROUTE_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_NETWORK_ROUTE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE (gvir_sandbox_config_network_route_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_NETWORK_ROUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE, GVirSandboxConfigNetworkRoute)) 34 | #define GVIR_SANDBOX_CONFIG_NETWORK_ROUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE, GVirSandboxConfigNetworkRouteClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_ROUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE)) 36 | #define GVIR_SANDBOX_IS_CONFIG_NETWORK_ROUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE)) 37 | #define GVIR_SANDBOX_CONFIG_NETWORK_ROUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE, GVirSandboxConfigNetworkRouteClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONFIG_NETWORK_ROUTE_HANDLE (gvir_sandbox_config_network_route_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxConfigNetworkRoute GVirSandboxConfigNetworkRoute; 42 | typedef struct _GVirSandboxConfigNetworkRoutePrivate GVirSandboxConfigNetworkRoutePrivate; 43 | typedef struct _GVirSandboxConfigNetworkRouteClass GVirSandboxConfigNetworkRouteClass; 44 | 45 | struct _GVirSandboxConfigNetworkRoute 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxConfigNetworkRoutePrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxConfigNetworkRouteClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_config_network_route_get_type(void); 62 | 63 | GVirSandboxConfigNetworkRoute *gvir_sandbox_config_network_route_new(GInetAddress *target, 64 | guint prefix, 65 | GInetAddress *gateway); 66 | 67 | void gvir_sandbox_config_network_route_set_prefix(GVirSandboxConfigNetworkRoute *config, guint prefix); 68 | guint gvir_sandbox_config_network_route_get_prefix(GVirSandboxConfigNetworkRoute *config); 69 | 70 | void gvir_sandbox_config_network_route_set_gateway(GVirSandboxConfigNetworkRoute *config, GInetAddress *addr); 71 | GInetAddress *gvir_sandbox_config_network_route_get_gateway(GVirSandboxConfigNetworkRoute *config); 72 | 73 | void gvir_sandbox_config_network_route_set_target(GVirSandboxConfigNetworkRoute *config, GInetAddress *addr); 74 | GInetAddress *gvir_sandbox_config_network_route_get_target(GVirSandboxConfigNetworkRoute *config); 75 | 76 | G_END_DECLS 77 | 78 | #endif /* __LIBVIRT_SANDBOX_CONFIG_NETWORK_ROUTE_H__ */ 79 | 80 | /* 81 | * Local variables: 82 | * c-indent-level: 4 83 | * c-basic-offset: 4 84 | * indent-tabs-mode: nil 85 | * tab-width: 8 86 | * End: 87 | */ 88 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-service-generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-service-generic.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_SERVICE_GENERIC_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_SERVICE_GENERIC_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC (gvir_sandbox_config_service_generic_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_SERVICE_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC, GVirSandboxConfigServiceGeneric)) 34 | #define GVIR_SANDBOX_CONFIG_SERVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC, GVirSandboxConfigServiceGenericClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC)) 36 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC)) 37 | #define GVIR_SANDBOX_CONFIG_SERVICE_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_GENERIC, GVirSandboxConfigServiceGenericClass)) 38 | 39 | typedef struct _GVirSandboxConfigServiceGeneric GVirSandboxConfigServiceGeneric; 40 | typedef struct _GVirSandboxConfigServiceGenericPrivate GVirSandboxConfigServiceGenericPrivate; 41 | typedef struct _GVirSandboxConfigServiceGenericClass GVirSandboxConfigServiceGenericClass; 42 | 43 | struct _GVirSandboxConfigServiceGeneric 44 | { 45 | GVirSandboxConfigService parent; 46 | 47 | GVirSandboxConfigServiceGenericPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigServiceGenericClass 53 | { 54 | GVirSandboxConfigServiceClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_service_generic_get_type(void); 60 | 61 | GVirSandboxConfigServiceGeneric *gvir_sandbox_config_service_generic_new(const gchar *name); 62 | 63 | void gvir_sandbox_config_service_generic_set_command(GVirSandboxConfigServiceGeneric *config, gchar **argv); 64 | 65 | G_END_DECLS 66 | 67 | #endif /* __LIBVIRT_SANDBOX_CONFIG_SERVICE_GENERIC_H__ */ 68 | 69 | /* 70 | * Local variables: 71 | * c-indent-level: 4 72 | * c-basic-offset: 4 73 | * indent-tabs-mode: nil 74 | * tab-width: 8 75 | * End: 76 | */ 77 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-service-systemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-service-systemd.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_SERVICE_SYSTEMD_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_SERVICE_SYSTEMD_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD (gvir_sandbox_config_service_systemd_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_SERVICE_SYSTEMD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD, GVirSandboxConfigServiceSystemd)) 34 | #define GVIR_SANDBOX_CONFIG_SERVICE_SYSTEMD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD, GVirSandboxConfigServiceSystemdClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE_SYSTEMD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD)) 36 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE_SYSTEMD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD)) 37 | #define GVIR_SANDBOX_CONFIG_SERVICE_SYSTEMD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE_SYSTEMD, GVirSandboxConfigServiceSystemdClass)) 38 | 39 | typedef struct _GVirSandboxConfigServiceSystemd GVirSandboxConfigServiceSystemd; 40 | typedef struct _GVirSandboxConfigServiceSystemdPrivate GVirSandboxConfigServiceSystemdPrivate; 41 | typedef struct _GVirSandboxConfigServiceSystemdClass GVirSandboxConfigServiceSystemdClass; 42 | 43 | struct _GVirSandboxConfigServiceSystemd 44 | { 45 | GVirSandboxConfigService parent; 46 | 47 | GVirSandboxConfigServiceSystemdPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigServiceSystemdClass 53 | { 54 | GVirSandboxConfigServiceClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_service_systemd_get_type(void); 60 | 61 | GVirSandboxConfigServiceSystemd *gvir_sandbox_config_service_systemd_new(const gchar *name); 62 | 63 | const gchar *gvir_sandbox_config_service_systemd_get_boot_target(GVirSandboxConfigServiceSystemd *config); 64 | void gvir_sandbox_config_service_systemd_set_boot_target(GVirSandboxConfigServiceSystemd *config, 65 | const gchar *target); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __LIBVIRT_SANDBOX_CONFIG_SERVICE_SYSTEMD_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-service.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-service.c: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include "libvirt-sandbox/libvirt-sandbox-config-all.h" 27 | 28 | /** 29 | * SECTION: libvirt-sandbox-config-service 30 | * @short_description: Service sandbox configuration details 31 | * @include: libvirt-sandbox/libvirt-sandbox.h 32 | * @see_also: #GVirSandboxConfigService 33 | * 34 | * Provides an object to store configuration details for a service config 35 | * 36 | * The GVirSandboxConfigService object extends #GVirSandboxConfig to store 37 | * the extra information required to setup a service sandbox 38 | */ 39 | 40 | #define GVIR_SANDBOX_CONFIG_SERVICE_GET_PRIVATE(obj) \ 41 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServicePrivate)) 42 | 43 | struct _GVirSandboxConfigServicePrivate 44 | { 45 | gboolean unused; 46 | }; 47 | 48 | G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirSandboxConfigService, gvir_sandbox_config_service, GVIR_SANDBOX_TYPE_CONFIG); 49 | 50 | 51 | enum { 52 | LAST_SIGNAL 53 | }; 54 | 55 | //static gint signals[LAST_SIGNAL]; 56 | 57 | #if 0 58 | #define GVIR_SANDBOX_CONFIG_SERVICE_ERROR gvir_sandbox_config_service_error_quark() 59 | 60 | static GQuark 61 | gvir_sandbox_config_service_error_quark(void) 62 | { 63 | return g_quark_from_static_string("gvir-sandbox-config-service"); 64 | } 65 | #endif 66 | 67 | 68 | static void gvir_sandbox_config_service_finalize(GObject *object) 69 | { 70 | 71 | G_OBJECT_CLASS(gvir_sandbox_config_service_parent_class)->finalize(object); 72 | } 73 | 74 | 75 | static void gvir_sandbox_config_service_class_init(GVirSandboxConfigServiceClass *klass) 76 | { 77 | GObjectClass *object_class = G_OBJECT_CLASS(klass); 78 | 79 | object_class->finalize = gvir_sandbox_config_service_finalize; 80 | } 81 | 82 | 83 | static void gvir_sandbox_config_service_init(GVirSandboxConfigService *config) 84 | { 85 | config->priv = GVIR_SANDBOX_CONFIG_SERVICE_GET_PRIVATE(config); 86 | } 87 | 88 | /* 89 | * Local variables: 90 | * c-indent-level: 4 91 | * c-basic-offset: 4 92 | * indent-tabs-mode: nil 93 | * tab-width: 8 94 | * End: 95 | */ 96 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-config-service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-config-service.h: libvirt sandbox configuration 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__ 28 | #define __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONFIG_SERVICE (gvir_sandbox_config_service_get_type ()) 33 | #define GVIR_SANDBOX_CONFIG_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigService)) 34 | #define GVIR_SANDBOX_CONFIG_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServiceClass)) 35 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE)) 36 | #define GVIR_SANDBOX_IS_CONFIG_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONFIG_SERVICE)) 37 | #define GVIR_SANDBOX_CONFIG_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONFIG_SERVICE, GVirSandboxConfigServiceClass)) 38 | 39 | typedef struct _GVirSandboxConfigService GVirSandboxConfigService; 40 | typedef struct _GVirSandboxConfigServicePrivate GVirSandboxConfigServicePrivate; 41 | typedef struct _GVirSandboxConfigServiceClass GVirSandboxConfigServiceClass; 42 | 43 | struct _GVirSandboxConfigService 44 | { 45 | GVirSandboxConfig parent; 46 | 47 | GVirSandboxConfigServicePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConfigServiceClass 53 | { 54 | GVirSandboxConfigClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_config_service_get_type(void); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __LIBVIRT_SANDBOX_CONFIG_SERVICE_H__ */ 64 | 65 | /* 66 | * Local variables: 67 | * c-indent-level: 4 68 | * c-basic-offset: 4 69 | * indent-tabs-mode: nil 70 | * tab-width: 8 71 | * End: 72 | */ 73 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-console-raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-console-raw.h: libvirt sandbox raw console 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONSOLE_RAW_H__ 28 | #define __LIBVIRT_SANDBOX_CONSOLE_RAW_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONSOLE_RAW (gvir_sandbox_console_raw_get_type ()) 33 | #define GVIR_SANDBOX_CONSOLE_RAW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RAW, GVirSandboxConsoleRaw)) 34 | #define GVIR_SANDBOX_CONSOLE_RAW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONSOLE_RAW, GVirSandboxConsoleRawClass)) 35 | #define GVIR_SANDBOX_IS_CONSOLE_RAW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RAW)) 36 | #define GVIR_SANDBOX_IS_CONSOLE_RAW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONSOLE_RAW)) 37 | #define GVIR_SANDBOX_CONSOLE_RAW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RAW, GVirSandboxConsoleRawClass)) 38 | 39 | typedef struct _GVirSandboxConsoleRaw GVirSandboxConsoleRaw; 40 | typedef struct _GVirSandboxConsoleRawPrivate GVirSandboxConsoleRawPrivate; 41 | typedef struct _GVirSandboxConsoleRawClass GVirSandboxConsoleRawClass; 42 | 43 | struct _GVirSandboxConsoleRaw 44 | { 45 | GVirSandboxConsole parent; 46 | 47 | GVirSandboxConsoleRawPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConsoleRawClass 53 | { 54 | GVirSandboxConsoleClass parent_class; 55 | 56 | void (*closed)(GVirSandboxConsoleRaw *console, gboolean err); 57 | 58 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 59 | }; 60 | 61 | GType gvir_sandbox_console_raw_get_type(void); 62 | 63 | GVirSandboxConsoleRaw *gvir_sandbox_console_raw_new(GVirConnection *connection, 64 | GVirDomain *domain, 65 | const char *devname); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __LIBVIRT_SANDBOX_CONSOLE_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-console-rpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-console-rpc.h: libvirt sandbox rpc console 3 | * 4 | * Copyright (C) 2011-2012 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONSOLE_RPC_H__ 28 | #define __LIBVIRT_SANDBOX_CONSOLE_RPC_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONSOLE_RPC (gvir_sandbox_console_rpc_get_type ()) 33 | #define GVIR_SANDBOX_CONSOLE_RPC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RPC, GVirSandboxConsoleRpc)) 34 | #define GVIR_SANDBOX_CONSOLE_RPC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONSOLE_RPC, GVirSandboxConsoleRpcClass)) 35 | #define GVIR_SANDBOX_IS_CONSOLE_RPC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RPC)) 36 | #define GVIR_SANDBOX_IS_CONSOLE_RPC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONSOLE_RPC)) 37 | #define GVIR_SANDBOX_CONSOLE_RPC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONSOLE_RPC, GVirSandboxConsoleRpcClass)) 38 | 39 | typedef struct _GVirSandboxConsoleRpc GVirSandboxConsoleRpc; 40 | typedef struct _GVirSandboxConsoleRpcPrivate GVirSandboxConsoleRpcPrivate; 41 | typedef struct _GVirSandboxConsoleRpcClass GVirSandboxConsoleRpcClass; 42 | 43 | struct _GVirSandboxConsoleRpc 44 | { 45 | GVirSandboxConsole parent; 46 | 47 | GVirSandboxConsoleRpcPrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxConsoleRpcClass 53 | { 54 | GVirSandboxConsoleClass parent_class; 55 | 56 | void (*exited)(GVirSandboxConsoleRpc *console, int status); 57 | void (*closed)(GVirSandboxConsoleRpc *console, gboolean err); 58 | 59 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 60 | }; 61 | 62 | GType gvir_sandbox_console_rpc_get_type(void); 63 | 64 | GVirSandboxConsoleRpc *gvir_sandbox_console_rpc_new(GVirConnection *connection, 65 | GVirDomain *domain, 66 | const char *devname); 67 | 68 | G_END_DECLS 69 | 70 | #endif /* __LIBVIRT_SANDBOX_CONSOLE_H__ */ 71 | 72 | /* 73 | * Local variables: 74 | * c-indent-level: 4 75 | * c-basic-offset: 4 76 | * indent-tabs-mode: nil 77 | * tab-width: 8 78 | * End: 79 | */ 80 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-context-interactive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-context-interactive.h: libvirt sandbox interactive context 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONTEXT_INTERACTIVE_H__ 28 | #define __LIBVIRT_SANDBOX_CONTEXT_INTERACTIVE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE (gvir_sandbox_context_interactive_get_type ()) 33 | #define GVIR_SANDBOX_CONTEXT_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE, GVirSandboxContextInteractive)) 34 | #define GVIR_SANDBOX_CONTEXT_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE, GVirSandboxContextInteractiveClass)) 35 | #define GVIR_SANDBOX_IS_CONTEXT_INTERACTIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE)) 36 | #define GVIR_SANDBOX_IS_CONTEXT_INTERACTIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE)) 37 | #define GVIR_SANDBOX_CONTEXT_INTERACTIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONTEXT_INTERACTIVE, GVirSandboxContextInteractiveClass)) 38 | 39 | typedef struct _GVirSandboxContextInteractive GVirSandboxContextInteractive; 40 | typedef struct _GVirSandboxContextInteractivePrivate GVirSandboxContextInteractivePrivate; 41 | typedef struct _GVirSandboxContextInteractiveClass GVirSandboxContextInteractiveClass; 42 | 43 | struct _GVirSandboxContextInteractive 44 | { 45 | GVirSandboxContext parent; 46 | 47 | GVirSandboxContextInteractivePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxContextInteractiveClass 53 | { 54 | GVirSandboxContextClass parent_class; 55 | 56 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 57 | }; 58 | 59 | GType gvir_sandbox_context_interactive_get_type(void); 60 | 61 | GVirSandboxContextInteractive *gvir_sandbox_context_interactive_new(GVirConnection *connection, 62 | GVirSandboxConfigInteractive *config); 63 | 64 | GVirSandboxConsole *gvir_sandbox_context_interactive_get_app_console(GVirSandboxContextInteractive *ctxt, 65 | GError **error); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __LIBVIRT_SANDBOX_CONTEXT_INTERACTIVE_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-context-service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-context-service.h: libvirt sandbox service context 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONTEXT_SERVICE_H__ 28 | #define __LIBVIRT_SANDBOX_CONTEXT_SERVICE_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONTEXT_SERVICE (gvir_sandbox_context_service_get_type ()) 33 | #define GVIR_SANDBOX_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONTEXT_SERVICE, GVirSandboxContextService)) 34 | #define GVIR_SANDBOX_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONTEXT_SERVICE, GVirSandboxContextServiceClass)) 35 | #define GVIR_SANDBOX_IS_CONTEXT_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONTEXT_SERVICE)) 36 | #define GVIR_SANDBOX_IS_CONTEXT_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONTEXT_SERVICE)) 37 | #define GVIR_SANDBOX_CONTEXT_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONTEXT_SERVICE, GVirSandboxContextServiceClass)) 38 | 39 | typedef struct _GVirSandboxContextService GVirSandboxContextService; 40 | typedef struct _GVirSandboxContextServicePrivate GVirSandboxContextServicePrivate; 41 | typedef struct _GVirSandboxContextServiceClass GVirSandboxContextServiceClass; 42 | 43 | struct _GVirSandboxContextService 44 | { 45 | GVirSandboxContext parent; 46 | 47 | GVirSandboxContextServicePrivate *priv; 48 | 49 | /* Do not add fields to this struct */ 50 | }; 51 | 52 | struct _GVirSandboxContextServiceClass 53 | { 54 | GVirSandboxContextClass parent_class; 55 | 56 | gboolean (*define)(GVirSandboxContextService *ctxt, GError **error); 57 | gboolean (*undefine)(GVirSandboxContextService *ctxt, GError **error); 58 | 59 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 60 | }; 61 | 62 | GType gvir_sandbox_context_service_get_type(void); 63 | 64 | GVirSandboxContextService *gvir_sandbox_context_service_new(GVirConnection *connection, 65 | GVirSandboxConfigService *config); 66 | 67 | gboolean gvir_sandbox_context_service_define(GVirSandboxContextService *ctxt, GError **error); 68 | gboolean gvir_sandbox_context_service_undefine(GVirSandboxContextService *ctxt, GError **error); 69 | 70 | G_END_DECLS 71 | 72 | #endif /* __LIBVIRT_SANDBOX_CONTEXT_SERVICE_H__ */ 73 | 74 | /* 75 | * Local variables: 76 | * c-indent-level: 4 77 | * c-basic-offset: 4 78 | * indent-tabs-mode: nil 79 | * tab-width: 8 80 | * End: 81 | */ 82 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-context.h: libvirt sandbox context 3 | * 4 | * Copyright (C) 2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_CONTEXT_H__ 28 | #define __LIBVIRT_SANDBOX_CONTEXT_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GVIR_SANDBOX_TYPE_CONTEXT (gvir_sandbox_context_get_type ()) 33 | #define GVIR_SANDBOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_SANDBOX_TYPE_CONTEXT, GVirSandboxContext)) 34 | #define GVIR_SANDBOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_SANDBOX_TYPE_CONTEXT, GVirSandboxContextClass)) 35 | #define GVIR_SANDBOX_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_SANDBOX_TYPE_CONTEXT)) 36 | #define GVIR_SANDBOX_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_SANDBOX_TYPE_CONTEXT)) 37 | #define GVIR_SANDBOX_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_SANDBOX_TYPE_CONTEXT, GVirSandboxContextClass)) 38 | 39 | #define GVIR_SANDBOX_TYPE_CONTEXT_HANDLE (gvir_sandbox_context_handle_get_type ()) 40 | 41 | typedef struct _GVirSandboxContext GVirSandboxContext; 42 | typedef struct _GVirSandboxContextPrivate GVirSandboxContextPrivate; 43 | typedef struct _GVirSandboxContextClass GVirSandboxContextClass; 44 | 45 | struct _GVirSandboxContext 46 | { 47 | GObject parent; 48 | 49 | GVirSandboxContextPrivate *priv; 50 | 51 | /* Do not add fields to this struct */ 52 | }; 53 | 54 | struct _GVirSandboxContextClass 55 | { 56 | GObjectClass parent_class; 57 | 58 | /* Class method overrides */ 59 | gboolean (*start)(GVirSandboxContext *ctxt, GError **error); 60 | gboolean (*stop)(GVirSandboxContext *ctxt, GError **error); 61 | gboolean (*attach)(GVirSandboxContext *ctxt, GError **error); 62 | gboolean (*detach)(GVirSandboxContext *ctxt, GError **error); 63 | 64 | gpointer padding[LIBVIRT_SANDBOX_CLASS_PADDING]; 65 | }; 66 | 67 | GType gvir_sandbox_context_get_type(void); 68 | 69 | GVirSandboxConfig *gvir_sandbox_context_get_config(GVirSandboxContext *ctxt); 70 | 71 | gboolean gvir_sandbox_context_start(GVirSandboxContext *ctxt, GError **error); 72 | gboolean gvir_sandbox_context_stop(GVirSandboxContext *ctxt, GError **error); 73 | gboolean gvir_sandbox_context_attach(GVirSandboxContext *ctxt, GError **error); 74 | gboolean gvir_sandbox_context_detach(GVirSandboxContext *ctxt, GError **error); 75 | 76 | gboolean gvir_sandbox_context_is_attached(GVirSandboxContext *ctxt); 77 | 78 | GVirDomain *gvir_sandbox_context_get_domain(GVirSandboxContext *ctxt, 79 | GError **error); 80 | GVirConnection *gvir_sandbox_context_get_connection(GVirSandboxContext *ctxt); 81 | 82 | GVirSandboxConsole *gvir_sandbox_context_get_log_console(GVirSandboxContext *ctxt, 83 | GError **error); 84 | GVirSandboxConsole *gvir_sandbox_context_get_shell_console(GVirSandboxContext *ctxt, 85 | GError **error); 86 | 87 | G_END_DECLS 88 | 89 | #endif /* __LIBVIRT_SANDBOX_CONTEXT_H__ */ 90 | 91 | /* 92 | * Local variables: 93 | * c-indent-level: 4 94 | * c-basic-offset: 4 95 | * indent-tabs-mode: nil 96 | * tab-width: 8 97 | * End: 98 | */ 99 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-enum-types.c.template: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | #include 3 | 4 | /*** END file-header ***/ 5 | 6 | /*** BEGIN file-production ***/ 7 | /* enumerations from "@filename@" */ 8 | /*** END file-production ***/ 9 | 10 | /*** BEGIN value-header ***/ 11 | GType 12 | @enum_name@_get_type (void) 13 | { 14 | static volatile gsize g_define_type_id__volatile = 0; 15 | 16 | if (g_once_init_enter (&g_define_type_id__volatile)) 17 | { 18 | static const G@Type@Value values[] = { 19 | /*** END value-header ***/ 20 | 21 | /*** BEGIN value-production ***/ 22 | { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, 23 | /*** END value-production ***/ 24 | 25 | /*** BEGIN value-tail ***/ 26 | { 0, NULL, NULL } 27 | }; 28 | GType g_define_type_id = 29 | g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); 30 | g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); 31 | } 32 | 33 | return g_define_type_id__volatile; 34 | } 35 | 36 | /*** END value-tail ***/ 37 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-enum-types.h.template: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | #ifndef __LIBVIRT_SANDBOX_ENUM_TYPES_H__ 3 | #define __LIBVIRT_SANDBOX_ENUM_TYPES_H__ 4 | 5 | G_BEGIN_DECLS 6 | /*** END file-header ***/ 7 | 8 | /*** BEGIN file-production ***/ 9 | 10 | /* enumerations from "@filename@" */ 11 | /*** END file-production ***/ 12 | 13 | /*** BEGIN value-header ***/ 14 | GType @enum_name@_get_type (void) G_GNUC_CONST; 15 | #define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) 16 | /*** END value-header ***/ 17 | 18 | /*** BEGIN file-tail ***/ 19 | G_END_DECLS 20 | 21 | #endif /* __LIBVIRT_SANDBOX_ENUM_TYPES_H__ */ 22 | /*** END file-tail ***/ 23 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-main.c: libvirt sandbox integration 3 | * 4 | * Copyright (C) 2008 Daniel P. Berrange 5 | * Copyright (C) 2010-2011 Red Hat, Inc. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | * Author: Daniel P. Berrange 22 | */ 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | /** 35 | * gvir_sandbox_init: 36 | * @argc: (inout): pointer to application's argc 37 | * @argv: (inout) (array length=argc) (allow-none): pointer to application's argv 38 | */ 39 | void gvir_sandbox_init(int *argc, 40 | char ***argv) 41 | { 42 | GError *err = NULL; 43 | if (!gvir_sandbox_init_check(argc, argv, &err)) { 44 | g_error("Could not initialize libvirt-sandbox: %s\n", 45 | err->message); 46 | } 47 | } 48 | 49 | static void gvir_log_handler(const gchar *log_domain G_GNUC_UNUSED, 50 | GLogLevelFlags log_level G_GNUC_UNUSED, 51 | const gchar *message, 52 | gpointer user_data) 53 | { 54 | if (user_data) 55 | fprintf(stderr, "%s\n\r", message); 56 | } 57 | 58 | 59 | /** 60 | * gvir_sandbox_init_check: 61 | * @argc: (inout): pointer to application's argc 62 | * @argv: (inout) (array length=argc) (allow-none): pointer to application's argv 63 | * @err: pointer to a #GError to which a message will be posted on error 64 | */ 65 | gboolean gvir_sandbox_init_check(int *argc, 66 | char ***argv, 67 | GError **err) 68 | { 69 | if (!gvir_init_object_check(argc, argv, err)) 70 | return FALSE; 71 | 72 | if (!bindtextdomain(PACKAGE, LOCALEDIR)) 73 | return FALSE; 74 | 75 | /* GLib >= 2.31.0 debug is off by default, so we need to 76 | * enable it. Older versions are on by default, so we need 77 | * to disable it. 78 | */ 79 | #if GLIB_CHECK_VERSION(2, 31, 0) 80 | if (getenv("LIBVIRT_SANDBOX_DEBUG")) 81 | g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, 82 | gvir_log_handler, (void*)0x1); 83 | #else 84 | if (!getenv("LIBVIRT_SANDBOX_DEBUG")) 85 | g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, 86 | gvir_log_handler, NULL); 87 | #endif 88 | 89 | return TRUE; 90 | } 91 | 92 | /* 93 | * Local variables: 94 | * c-indent-level: 4 95 | * c-basic-offset: 4 96 | * indent-tabs-mode: nil 97 | * tab-width: 8 98 | * End: 99 | */ 100 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-main.h: libvirt sandbox integration 3 | * 4 | * Copyright (C) 2008 Daniel P. Berrange 5 | * Copyright (C) 2010-2011 Red Hat, Inc. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | * Author: Daniel P. Berrange 22 | */ 23 | 24 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 25 | #error "Only can be included directly." 26 | #endif 27 | 28 | #ifndef __LIBVIRT_SANDBOX_MAIN_H__ 29 | #define __LIBVIRT_SANDBOX_MAIN_H__ 30 | 31 | G_BEGIN_DECLS 32 | 33 | void gvir_sandbox_init(int *argc, 34 | char ***argv); 35 | gboolean gvir_sandbox_init_check(int *argc, 36 | char ***argv, 37 | GError **err); 38 | 39 | G_END_DECLS 40 | 41 | #endif /* __LIBVIRT_SANDBOX_MAIN_H__ */ 42 | 43 | /* 44 | * Local variables: 45 | * c-indent-level: 4 46 | * c-basic-offset: 4 47 | * indent-tabs-mode: nil 48 | * tab-width: 8 49 | * End: 50 | */ 51 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-protocol-generator.pl: -------------------------------------------------------------------------------- 1 | # 2 | # Generate code for an XDR protocol, optionally applying 3 | # fixups to the glibc rpcgen code so that it compiles 4 | # with warnings turned on. 5 | # 6 | # This code is evil. Arguably better would be just to compile 7 | # without -Werror. Update: The IXDR_PUT_LONG replacements are 8 | # actually fixes for 64 bit, so this file is necessary. Arguably 9 | # so is the type-punning fix. 10 | # 11 | # Copyright (C) 2007, 2011-2012 Red Hat, Inc. 12 | # 13 | # See COPYING for the license of this software. 14 | # 15 | # Richard Jones 16 | 17 | use strict; 18 | 19 | my $in_function = 0; 20 | my @function = (); 21 | 22 | my $rpcgen = shift; 23 | my $mode = shift; 24 | my $xdrdef = shift; 25 | my $target = shift; 26 | 27 | unlink $target; 28 | 29 | open RPCGEN, "-|", $rpcgen, $mode, $xdrdef 30 | or die "cannot run $rpcgen $mode $xdrdef: $!"; 31 | open TARGET, ">$target" 32 | or die "cannot create $target: $!"; 33 | 34 | my $fixup = $^O eq "linux" || $^O eq "cygwin"; 35 | 36 | if ($mode eq "-c") { 37 | print TARGET "#include \n"; 38 | } 39 | 40 | while () { 41 | # We only want to fixup the GLibc rpcgen output 42 | # So just print data unchanged, if non-Linux 43 | unless ($fixup) { 44 | print TARGET; 45 | next; 46 | } 47 | 48 | if (m/^{/) { 49 | $in_function = 1; 50 | print TARGET; 51 | next; 52 | } 53 | 54 | s/\t/ /g; 55 | 56 | # Fix VPATH builds 57 | s,#include ".*/([^/]+)protocol\.h",#include "${1}protocol.h",; 58 | 59 | if (m,#(ifdef|ifndef|define|endif)\s+,) { 60 | s/-/_/g; 61 | } 62 | 63 | # Portability for Solaris RPC 64 | s/u_quad_t/uint64_t/g; 65 | s/quad_t/int64_t/g; 66 | s/xdr_u_quad_t/xdr_uint64_t/g; 67 | s/xdr_quad_t/xdr_int64_t/g; 68 | s/(?]\bbuf\b/, @function; 77 | @function = grep !/[^.>]\bbuf\b/, @function if @uses == 1; 78 | 79 | # Remove decl of i, if i isn't used in the function. 80 | @uses = grep /[^.>]\bi\b/, @function; 81 | @function = grep !/[^.>]\bi\b/, @function if @uses == 1; 82 | 83 | # (char **)&objp->... gives: 84 | # warning: dereferencing type-punned pointer will break 85 | # strict-aliasing rules 86 | # so rewrite it. 87 | my %uses = (); 88 | my $i = 0; 89 | foreach (@function) { 90 | $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i; 91 | } 92 | if (keys %uses >= 1) { 93 | my $i = 1; 94 | 95 | foreach (keys %uses) { 96 | $i = $uses{$_}; 97 | unshift @function, 98 | (" char **objp_cpp$i = (char **) (void *) &$_;\n"); 99 | $i++; 100 | } 101 | @function = 102 | map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)} 103 | {objp_cpp$uses{$1}}gi; $_ } @function; 104 | } 105 | 106 | # The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two 107 | # ways: Firstly these functions are deprecated and don't 108 | # work on 64 bit platforms. Secondly the return value should 109 | # be ignored. Correct both these mistakes. 110 | @function = 111 | map { s/\bIXDR_PUT_((U_)?)LONG\b/(void)IXDR_PUT_$1INT32/; $_ } 112 | map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ } 113 | @function; 114 | 115 | print TARGET (join ("", @function)); 116 | @function = (); 117 | } 118 | 119 | unless ($in_function) { 120 | print TARGET; 121 | } else { 122 | push @function, $_; 123 | } 124 | } 125 | 126 | close TARGET 127 | or die "cannot save $target: $!"; 128 | close RPCGEN 129 | or die "cannot shutdown $rpcgen: $!"; 130 | 131 | chmod 0444, $target 132 | or die "cannot set $target readonly: $!"; 133 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-protocol.x: -------------------------------------------------------------------------------- 1 | 2 | const GVIR_SANDBOX_PROTOCOL_PACKET_MAX = 262144; 3 | const GVIR_SANDBOX_PROTOCOL_LEN_MAX = 4; 4 | const GVIR_SANDBOX_PROTOCOL_HEADER_MAX = 16; 5 | const GVIR_SANDBOX_PROTOCOL_PAYLOAD_MAX = 262128; 6 | 7 | const GVIR_SANDBOX_PROTOCOL_HANDSHAKE_WAIT = 033; 8 | const GVIR_SANDBOX_PROTOCOL_HANDSHAKE_SYNC = 034; 9 | 10 | enum GVirSandboxProtocolProc { 11 | GVIR_SANDBOX_PROTOCOL_PROC_STDIN = 1, 12 | GVIR_SANDBOX_PROTOCOL_PROC_STDOUT = 2, 13 | GVIR_SANDBOX_PROTOCOL_PROC_STDERR = 3, 14 | GVIR_SANDBOX_PROTOCOL_PROC_EXIT = 4, 15 | GVIR_SANDBOX_PROTOCOL_PROC_QUIT = 5 16 | }; 17 | 18 | enum GVirSandboxProtocolType { 19 | /* Async message */ 20 | GVIR_SANDBOX_PROTOCOL_TYPE_MESSAGE = 0, 21 | /* Async data packet */ 22 | GVIR_SANDBOX_PROTOCOL_TYPE_DATA = 1 23 | }; 24 | 25 | enum GVirSandboxProtocolStatus { 26 | /* Status is always GVIR_SANDBOX_PROTO_OK for calls. 27 | * For replies, indicates no error. 28 | */ 29 | GVIR_SANDBOX_PROTOCOL_STATUS_OK = 0 30 | }; 31 | 32 | struct GVirSandboxProtocolHeader { 33 | GVirSandboxProtocolProc proc; 34 | GVirSandboxProtocolType type; 35 | GVirSandboxProtocolStatus status; 36 | unsigned serial; 37 | }; 38 | 39 | struct GVirSandboxProtocolMessageExit { 40 | int status; 41 | }; 42 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-rpcpacket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-rpcpacket.h: rpc helper APIs 3 | * 4 | * Copyright (C) 2010-2011 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef __LIBVIRT_SANDBOX_RPC_H__ 22 | # define __LIBVIRT_SANDBOX_RPC_H__ 23 | 24 | # include "glib.h" 25 | 26 | # include "libvirt-sandbox-protocol.h" 27 | 28 | typedef struct _GVirSandboxRPCPacket GVirSandboxRPCPacket; 29 | 30 | /* Never allocate this (huge) buffer on the stack. Always 31 | * use GVirSandboxRPCPacketNew() to allocate on the heap 32 | */ 33 | struct _GVirSandboxRPCPacket { 34 | char buffer[GVIR_SANDBOX_PROTOCOL_PACKET_MAX + GVIR_SANDBOX_PROTOCOL_LEN_MAX]; 35 | gsize bufferLength; 36 | gsize bufferOffset; 37 | 38 | GVirSandboxProtocolHeader header; 39 | }; 40 | 41 | 42 | GVirSandboxRPCPacket *gvir_sandbox_rpcpacket_new(gboolean rxready); 43 | 44 | void gvir_sandbox_rpcpacket_free(GVirSandboxRPCPacket *pkt); 45 | 46 | 47 | gboolean gvir_sandbox_rpcpacket_decode_length(GVirSandboxRPCPacket *pkt, 48 | GError **error); 49 | gboolean gvir_sandbox_rpcpacket_decode_header(GVirSandboxRPCPacket *pkt, 50 | GError **error); 51 | gboolean gvir_sandbox_rpcpacket_decode_payload_msg(GVirSandboxRPCPacket *pkt, 52 | xdrproc_t filter, 53 | void *data, 54 | GError **error); 55 | 56 | gboolean gvir_sandbox_rpcpacket_encode_header(GVirSandboxRPCPacket *pkt, 57 | GError **error); 58 | gboolean gvir_sandbox_rpcpacket_encode_payload_msg(GVirSandboxRPCPacket *pkt, 59 | xdrproc_t filter, 60 | void *data, 61 | GError **error); 62 | gboolean gvir_sandbox_rpcpacket_encode_payload_raw(GVirSandboxRPCPacket *msg, 63 | const char *buf, 64 | size_t len, 65 | GError **error); 66 | gboolean gvir_sandbox_rpcpacket_encode_payload_empty(GVirSandboxRPCPacket *msg, 67 | GError **error); 68 | 69 | #endif /* __VIR_NET_MESSAGE_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * c-indent-level: 4 74 | * c-basic-offset: 4 75 | * indent-tabs-mode: nil 76 | * tab-width: 8 77 | * End: 78 | */ 79 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-util.c: libvirt sandbox util functions 3 | * 4 | * Copyright (C) 2015 Universitat Politècnica de Catalunya. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Eren Yagdiran 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libvirt-sandbox/libvirt-sandbox-config-all.h" 29 | 30 | #define GVIR_SANDBOX_UTIL_ERROR gvir_sandbox_util_error_quark() 31 | 32 | static GQuark 33 | gvir_sandbox_util_error_quark(void) 34 | { 35 | return g_quark_from_static_string("gvir-sandbox-util"); 36 | } 37 | 38 | gint gvir_sandbox_util_guess_image_format(const gchar *path, 39 | GError **error) 40 | { 41 | gchar *tmp; 42 | 43 | if ((tmp = g_strrstr(path, ".")) == NULL) { 44 | g_set_error(error, GVIR_SANDBOX_UTIL_ERROR, 0, 45 | _("Cannot identify file extension in '%s'"), path); 46 | return -1; 47 | } 48 | tmp = tmp + 1; 49 | 50 | if (g_str_equal(tmp, "img")) 51 | return GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW; 52 | 53 | return gvir_sandbox_util_disk_format_from_str(tmp, error); 54 | } 55 | 56 | gint gvir_sandbox_util_disk_format_from_str(const gchar *value, 57 | GError **error) 58 | { 59 | GEnumClass *enum_class = g_type_class_ref(GVIR_CONFIG_TYPE_DOMAIN_DISK_FORMAT); 60 | GEnumValue *enum_value; 61 | gint ret = -1; 62 | 63 | if (!(enum_value = g_enum_get_value_by_nick(enum_class, value))) { 64 | g_set_error(error, GVIR_SANDBOX_UTIL_ERROR, 0, 65 | _("Unknown disk format '%s'"), value); 66 | goto cleanup; 67 | } 68 | ret = enum_value->value; 69 | 70 | cleanup: 71 | g_type_class_unref(enum_class); 72 | return ret; 73 | } 74 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox-util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox-util.h: libvirt sandbox utility code 3 | * 4 | * Copyright (C) 2013 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #if !defined(__LIBVIRT_SANDBOX_H__) && !defined(LIBVIRT_SANDBOX_BUILD) 24 | #error "Only can be included directly." 25 | #endif 26 | 27 | #ifndef __LIBVIRT_SANDBOX_UTIL_H__ 28 | #define __LIBVIRT_SANDBOX_UTIL_H__ 29 | 30 | G_BEGIN_DECLS 31 | 32 | gint gvir_sandbox_util_guess_image_format(const gchar *path, GError **error); 33 | 34 | 35 | gint gvir_sandbox_util_disk_format_from_str(const gchar *value, GError **error); 36 | 37 | /** 38 | * LIBVIRT_SANDBOX_CLASS_PADDING: (skip) 39 | */ 40 | #define LIBVIRT_SANDBOX_CLASS_PADDING 20 41 | 42 | G_END_DECLS 43 | 44 | #endif /* __LIBVIRT_SANDBOX_UTIL_H__ */ 45 | 46 | /* 47 | * Local variables: 48 | * c-indent-level: 4 49 | * c-basic-offset: 4 50 | * indent-tabs-mode: nil 51 | * tab-width: 8 52 | * End: 53 | */ 54 | -------------------------------------------------------------------------------- /libvirt-sandbox/libvirt-sandbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libvirt-sandbox.h: libvirt sandbox integration 3 | [ * 4 | * Copyright (C) 2010 Red Hat, Inc. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Author: Daniel P. Berrange 21 | */ 22 | 23 | #ifndef __LIBVIRT_SANDBOX_H__ 24 | #define __LIBVIRT_SANDBOX_H__ 25 | 26 | /* External includes */ 27 | #include 28 | #include 29 | 30 | /* Local includes */ 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | 63 | #endif /* __LIBVIRT_SANDBOX_H__ */ 64 | 65 | /* 66 | * Local variables: 67 | * c-indent-level: 4 68 | * c-basic-offset: 4 69 | * indent-tabs-mode: nil 70 | * tab-width: 8 71 | * End: 72 | */ 73 | -------------------------------------------------------------------------------- /libvirt-sandbox/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | 3 | TESTS = test-config 4 | 5 | check_PROGRAMS = test-config 6 | 7 | test_config_SOURCES = test-config.c 8 | test_config_LDADD = \ 9 | ../libvirt-sandbox-1.0.la \ 10 | $(GIO_UNIX_LIBS) \ 11 | $(LIBVIRT_GLIB_LIBS) \ 12 | $(LIBVIRT_GOBJECT_LIBS) \ 13 | $(CYGWIN_EXTRA_LIBADD) 14 | test_config_CFLAGS = \ 15 | $(COVERAGE_CFLAGS) \ 16 | -I$(top_srcdir) \ 17 | $(GIO_UNIX_CFLAGS) \ 18 | $(LIBVIRT_GLIB_CFLAGS) \ 19 | $(LIBVIRT_GOBJECT_CFLAGS) \ 20 | $(WARN_CFLAGS) 21 | -------------------------------------------------------------------------------- /m4/virt-capng.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_CAPNG], [ 2 | dnl libcap-ng 3 | AC_ARG_WITH([capng], 4 | AC_HELP_STRING([--with-capng], [use libcap-ng to reduce sandbox privileges @<:@default=check@:>@]), 5 | [], 6 | [with_capng=check]) 7 | 8 | dnl 9 | dnl This check looks for 'capng_updatev' since that was 10 | dnl introduced in 0.4.0 release which need as minimum 11 | dnl 12 | CAPNG_CFLAGS= 13 | CAPNG_LIBS= 14 | if test "$with_capng" != "no"; then 15 | old_cflags="$CFLAGS" 16 | old_libs="$LIBS" 17 | if test "$with_capng" = "check"; then 18 | AC_CHECK_HEADER([cap-ng.h],[],[with_capng=no]) 19 | AC_CHECK_LIB([cap-ng], [capng_updatev],[],[with_capng=no]) 20 | if test "$with_capng" != "no"; then 21 | with_capng="yes" 22 | fi 23 | else 24 | fail=0 25 | AC_CHECK_HEADER([cap-ng.h],[],[fail=1]) 26 | AC_CHECK_LIB([cap-ng], [capng_updatev],[],[fail=1]) 27 | test $fail = 1 && 28 | AC_MSG_ERROR([You must install the capng >= 0.4.0 development package in order to compile and run virt-sandbox]) 29 | fi 30 | CFLAGS="$old_cflags" 31 | LIBS="$old_libs" 32 | fi 33 | if test "$with_capng" = "yes"; then 34 | CAPNG_LIBS="-lcap-ng" 35 | AC_DEFINE_UNQUOTED([HAVE_CAPNG], 1, [whether capng is available for privilege reduction]) 36 | fi 37 | AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"]) 38 | AC_SUBST([CAPNG_CFLAGS]) 39 | AC_SUBST([CAPNG_LIBS]) 40 | ]) 41 | -------------------------------------------------------------------------------- /m4/virt-coverage.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_COVERAGE],[ 2 | AC_ARG_ENABLE([test-coverage], 3 | [ --enable-test-coverage turn on code coverage instrumentation], 4 | [case "${enableval}" in 5 | yes|no) ;; 6 | *) AC_MSG_ERROR([bad value ${enableval} for test-coverage option]) ;; 7 | esac], 8 | [enableval=no]) 9 | enable_coverage=$enableval 10 | 11 | if test "${enable_coverage}" = yes; then 12 | save_WARN_CFLAGS=$WARN_CFLAGS 13 | WARN_CFLAGS= 14 | gl_WARN_ADD([-fprofile-arcs]) 15 | gl_WARN_ADD([-ftest-coverage]) 16 | COVERAGE_FLAGS=$WARN_CFLAGS 17 | AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS]) 18 | AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS]) 19 | WARN_CFLAGS=$save_WARN_CFLAGS 20 | fi 21 | ]) 22 | -------------------------------------------------------------------------------- /m4/virt-gtk-misc.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_GTK_MISC],[ 2 | # Setup GLIB_MKENUMS to use glib-mkenums even if GLib is uninstalled. 3 | GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` 4 | AC_SUBST(GLIB_MKENUMS) 5 | ]) 6 | -------------------------------------------------------------------------------- /m4/virt-nls.m4: -------------------------------------------------------------------------------- 1 | dnl gettext utilities 2 | dnl 3 | dnl Copyright (C) 2018 Red Hat, Inc. 4 | dnl 5 | dnl This library is free software; you can redistribute it and/or 6 | dnl modify it under the terms of the GNU Lesser General Public 7 | dnl License as published by the Free Software Foundation; either 8 | dnl version 2.1 of the License, or (at your option) any later version. 9 | dnl 10 | dnl This library is distributed in the hope that it will be useful, 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | dnl Lesser General Public License for more details. 14 | dnl 15 | dnl You should have received a copy of the GNU Lesser General Public 16 | dnl License along with this library. If not, see 17 | dnl . 18 | dnl 19 | 20 | AC_DEFUN([LIBVIRT_SANDBOX_ARG_NLS],[ 21 | m4_divert_text([DEFAULTS], [[enable_nls=yes]]) 22 | AC_ARG_ENABLE([nls], 23 | [AS_HELP_STRING([--enable-nls], 24 | [NLS @<:@default=yes@:>@])]) 25 | ]) 26 | 27 | AC_DEFUN([LIBVIRT_SANDBOX_CHECK_NLS],[ 28 | dnl GNU gettext tools (optional). 29 | AC_CHECK_PROG([XGETTEXT], [xgettext], [xgettext], [no]) 30 | AC_CHECK_PROG([MSGFMT], [msgfmt], [msgfmt], [no]) 31 | AC_CHECK_PROG([MSGMERGE], [msgmerge], [msgmerge], [no]) 32 | 33 | dnl Check they are the GNU gettext tools. 34 | AC_MSG_CHECKING([msgfmt is GNU tool]) 35 | if $MSGFMT --version >/dev/null 2>&1 && $MSGFMT --version | grep -q 'GNU gettext'; then 36 | msgfmt_is_gnu=yes 37 | else 38 | msgfmt_is_gnu=no 39 | fi 40 | AC_MSG_RESULT([$msgfmt_is_gnu]) 41 | AM_CONDITIONAL([ENABLE_NLS], [test "x$enable_nls" = "xyes"]) 42 | AM_CONDITIONAL([HAVE_GNU_GETTEXT_TOOLS], 43 | [test "x$XGETTEXT" != "xno" && test "x$MSGFMT" != "xno" && \ 44 | test "x$MSGMERGE" != "xno" && test "x$msgfmt_is_gnu" != "xno"]) 45 | ]) 46 | -------------------------------------------------------------------------------- /m4/virt-rpcgen.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_RPCGEN], [ 2 | AC_PATH_PROG([PERL], [perl], [no]) 3 | AC_PATH_PROG([RPCGEN], [rpcgen], [no]) 4 | 5 | if test "$ac_cv_path_PERL" = "no" ; then 6 | AC_MSG_ERROR([perl is required to build the libvirt-sandbox]) 7 | fi 8 | if test "$ac_cv_path_RPCGEN" = "no" ; then 9 | AC_MSG_ERROR([rpcgen is required to build the libvirt-sandbox]) 10 | fi 11 | ]) 12 | -------------------------------------------------------------------------------- /m4/virt-selinux.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_SELINUX], [ 2 | fail=0 3 | SELINUX_CFLAGS= 4 | SELINUX_LIBS= 5 | old_LIBS=$LIBS 6 | old_CFLAGS=$CFLAGS 7 | AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1]) 8 | AC_CHECK_LIB([selinux], [fgetfilecon],[SELINUX_LIBS="$SELINUX_LIBS -lselinux"],[fail=1]) 9 | LIBS=$old_LIBS 10 | CFLAGS=$old_CFLAGS 11 | test $fail = 1 && 12 | AC_MSG_ERROR([You must install the libselinux development package in order to compile libvirt-sandbox]) 13 | AC_SUBST([SELINUX_CFLAGS]) 14 | AC_SUBST([SELINUX_LIBS]) 15 | ]) 16 | -------------------------------------------------------------------------------- /m4/virt-static.m4: -------------------------------------------------------------------------------- 1 | # LIBVIRT_SANDBOX_STATIC_LIB(NAME, CFLAGS, LDFLAGS, PROLOG, PROGRAM) 2 | # ------------------------------------------------------------------ 3 | # Check if the program can be linked with static libraries only. 4 | # 5 | AC_DEFUN([LIBVIRT_SANDBOX_STATIC_LIB], [ 6 | AC_MSG_CHECKING([for static $1]) 7 | 8 | SAVED_LDFLAGS=$LDFLAGS 9 | SAVED_CFLAGS=$CFLAGS 10 | CFLAGS="$2" 11 | LDFLAGS="-static $3" 12 | AC_LINK_IFELSE( 13 | [AC_LANG_PROGRAM([$4], 14 | [$5])], 15 | [], 16 | [AC_MSG_RESULT([no])] 17 | [AC_MSG_ERROR([static $1 is required in order to build virt-sandbox-init-qemu])] 18 | ) 19 | LDFLAGS=$SAVED_LDFLAGS 20 | CFLAGS=$SAVED_CFLAGS 21 | 22 | AC_MSG_RESULT([yes]) 23 | ]) 24 | 25 | AC_DEFUN([LIBVIRT_SANDBOX_STATIC_LIBC], [ 26 | LIBVIRT_SANDBOX_STATIC_LIB( 27 | [LIBC], 28 | [], 29 | [], 30 | [#include ], 31 | [printf("bar");]) 32 | ]) 33 | 34 | AC_DEFUN([LIBVIRT_SANDBOX_STATIC_LZMA], [ 35 | old_LIBS="$LIBS" 36 | LIBS="-llzma" 37 | LIBVIRT_SANDBOX_STATIC_LIB( 38 | [LZMA], 39 | [], 40 | [], 41 | [#include 42 | #include ], 43 | [lzma_code(NULL, 0);]) 44 | LIBS="$old_LIBS" 45 | ]) 46 | AC_DEFUN([LIBVIRT_SANDBOX_STATIC_ZLIB], [ 47 | old_LIBS="$LIBS" 48 | LIBS="-lz" 49 | LIBVIRT_SANDBOX_STATIC_LIB( 50 | [ZLIB], 51 | [], 52 | [], 53 | [#include 54 | #include ], 55 | [gzread(NULL, NULL, 0);]) 56 | LIBS="$old_LIBS" 57 | ]) 58 | -------------------------------------------------------------------------------- /m4/virt-win32.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_WIN32],[ 2 | dnl Extra link-time flags for Cygwin. 3 | dnl Copied from libxml2 configure.in, but I removed mingw changes 4 | dnl for now since I'm not supporting mingw at present. - RWMJ 5 | CYGWIN_EXTRA_LDFLAGS= 6 | CYGWIN_EXTRA_LIBADD= 7 | MINGW_EXTRA_LDFLAGS= 8 | case "$host" in 9 | *-*-cygwin*) 10 | CYGWIN_EXTRA_LDFLAGS="-no-undefined" 11 | CYGWIN_EXTRA_LIBADD="${INTLLIBS}" 12 | ;; 13 | *-*-mingw*) 14 | MINGW_EXTRA_LDFLAGS="-no-undefined" 15 | ;; 16 | esac 17 | AC_SUBST([CYGWIN_EXTRA_LDFLAGS]) 18 | AC_SUBST([CYGWIN_EXTRA_LIBADD]) 19 | AC_SUBST([MINGW_EXTRA_LDFLAGS]) 20 | ]) 21 | -------------------------------------------------------------------------------- /m4/virt-xdr.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([LIBVIRT_SANDBOX_XDR], [ 2 | old_LIBS="$LIBS" 3 | XDR_LIBS= 4 | AC_SEARCH_LIBS([xdrmem_create], [portablexdr rpc xdr nsl tirpc], [ 5 | if test "$ac_cv_search_xdrmem_create" != "none required" 6 | then 7 | XDR_LIBS="$ac_cv_search_xdrmem_create" 8 | fi 9 | ],[ 10 | AC_MSG_ERROR([Cannot find a XDR library]) 11 | ]) 12 | LIBS="$old_LIBS" 13 | 14 | AC_CACHE_CHECK([where to find ], [lv_cv_xdr_cflags], [ 15 | for add_CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do 16 | if test x"$add_CFLAGS" = xmissing; then 17 | lv_cv_xdr_cflags=missing; break 18 | fi 19 | CFLAGS="$old_CFLAGS $add_CFLAGS" 20 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include 21 | ]])], [lv_cv_xdr_cflags=${add_CFLAGS:-none}; break]) 22 | done 23 | ]) 24 | CFLAGS=$old_CFLAGS 25 | case $lv_cv_xdr_cflags in 26 | none) XDR_CFLAGS= ;; 27 | missing) AC_MSG_ERROR([Unable to find ]) ;; 28 | *) XDR_CFLAGS=$lv_cv_xdr_cflags ;; 29 | esac 30 | 31 | AC_SUBST([XDR_LIBS]) 32 | AC_SUBST([XDR_CFLAGS]) 33 | ]) 34 | -------------------------------------------------------------------------------- /m4/warnings.m4: -------------------------------------------------------------------------------- 1 | # warnings.m4 serial 11 2 | dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Simon Josefsson 8 | 9 | # gl_AS_VAR_APPEND(VAR, VALUE) 10 | # ---------------------------- 11 | # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. 12 | m4_ifdef([AS_VAR_APPEND], 13 | [m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], 14 | [m4_define([gl_AS_VAR_APPEND], 15 | [AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) 16 | 17 | 18 | # gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED], 19 | # [PROGRAM = AC_LANG_PROGRAM()]) 20 | # ----------------------------------------------------------------- 21 | # Check if the compiler supports OPTION when compiling PROGRAM. 22 | # 23 | # FIXME: gl_Warn must be used unquoted until we can assume Autoconf 24 | # 2.64 or newer. 25 | AC_DEFUN([gl_COMPILER_OPTION_IF], 26 | [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl 27 | AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl 28 | AS_LITERAL_IF([$1], 29 | [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))], 30 | [gl_positive="$1" 31 | case $gl_positive in 32 | -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;; 33 | esac 34 | m4_pushdef([gl_Positive], [$gl_positive])])dnl 35 | AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ 36 | gl_save_compiler_FLAGS="$gl_Flags" 37 | gl_AS_VAR_APPEND(m4_defn([gl_Flags]), 38 | [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["]) 39 | AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], 40 | [AS_VAR_SET(gl_Warn, [yes])], 41 | [AS_VAR_SET(gl_Warn, [no])]) 42 | gl_Flags="$gl_save_compiler_FLAGS" 43 | ]) 44 | AS_VAR_IF(gl_Warn, [yes], [$2], [$3]) 45 | m4_popdef([gl_Positive])dnl 46 | AS_VAR_POPDEF([gl_Flags])dnl 47 | AS_VAR_POPDEF([gl_Warn])dnl 48 | ]) 49 | 50 | # gl_UNKNOWN_WARNINGS_ARE_ERRORS 51 | # ------------------------------ 52 | # Clang doesn't complain about unknown warning options unless one also 53 | # specifies -Wunknown-warning-option -Werror. Detect this. 54 | AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS], 55 | [gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option], 56 | [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'], 57 | [gl_unknown_warnings_are_errors=])]) 58 | 59 | # gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS], 60 | # [PROGRAM = AC_LANG_PROGRAM()]) 61 | # --------------------------------------------- 62 | # Adds parameter to WARN_CFLAGS if the compiler supports it when 63 | # compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]). 64 | # 65 | # If VARIABLE is a variable name, AC_SUBST it. 66 | AC_DEFUN([gl_WARN_ADD], 67 | [AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS]) 68 | gl_COMPILER_OPTION_IF([$1], 69 | [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])], 70 | [], 71 | [$3]) 72 | m4_ifval([$2], 73 | [AS_LITERAL_IF([$2], [AC_SUBST([$2])])], 74 | [AC_SUBST([WARN_CFLAGS])])dnl 75 | ]) 76 | 77 | # Local Variables: 78 | # mode: autoconf 79 | # End: 80 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | ca 2 | cs 3 | de 4 | es 5 | fi 6 | fr 7 | ja 8 | pl 9 | pt_BR 10 | uk 11 | id 12 | si 13 | ko 14 | sv 15 | ka 16 | ro 17 | nl 18 | -------------------------------------------------------------------------------- /po/Makefile.am: -------------------------------------------------------------------------------- 1 | DOMAIN = $(PACKAGE_NAME) 2 | COPYRIGHT_HOLDER = The Libvirt authors 3 | MSGID_BUGS_ADDRESS = https://libvirt.org/bugs.html 4 | 5 | LANGS := $(shell cat $(srcdir)/LINGUAS) 6 | 7 | POTFILE := $(srcdir)/$(DOMAIN).pot 8 | POFILES := $(LANGS:%=%.po) 9 | GMOFILES := $(LANGS:%=%.gmo) 10 | 11 | CLEANFILES = $(GMOFILES) 12 | 13 | EXTRA_DIST = \ 14 | LINGUAS \ 15 | POTFILES \ 16 | $(POTFILE) \ 17 | $(POFILES) 18 | 19 | if HAVE_GNU_GETTEXT_TOOLS 20 | 21 | XGETTEXT_ARGS = \ 22 | --default-domain=$(DOMAIN) \ 23 | --from-code=utf-8 \ 24 | --add-comments=TRANSLATORS: \ 25 | --keyword=_ --keyword=N_ \ 26 | --copyright-holder='$(COPYRIGHT_HOLDER)' \ 27 | --package-name="$(PACKAGE_NAME)" \ 28 | --package-version="$(PACKAGE_VERSION)" \ 29 | --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \ 30 | --directory=$(top_srcdir) \ 31 | --sort-output \ 32 | $(NULL) 33 | 34 | SED_PO_FIXUP_ARGS = \ 35 | -e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \ 36 | -e "s|SOME DESCRIPTIVE TITLE|Libvirt package strings|g" \ 37 | -e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \ 38 | $(NULL) 39 | 40 | libvirt-sandbox-pot: 41 | $(XGETTEXT) -o $(POTFILE)-t $(XGETTEXT_ARGS) \ 42 | --files-from=$(abs_srcdir)/POTFILES 43 | $(SED) $(SED_PO_FIXUP_ARGS) < $(POTFILE)-t > $(POTFILE) 44 | rm -f $(POTFILE)-t 45 | 46 | %.gmo: %.po 47 | rm -f $@ $@-t 48 | $(MSGFMT) -c -o $@-t $< 49 | mv $@-t $@ 50 | 51 | endif HAVE_GNU_GETTEXT_TOOLS 52 | 53 | if ENABLE_NLS 54 | 55 | # Cannot use 'localedir' since this conflicts with autoconf. 56 | langinstdir = $(datadir)/locale 57 | 58 | install-data-hook: $(GMOFILES) 59 | mkdir -p $(DESTDIR)$(langinstdir) 60 | for lang in $(LANGS); do \ 61 | d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \ 62 | mkdir -p $$d; \ 63 | install -m 0644 $$lang.gmo $$d/$(DOMAIN).mo; \ 64 | done 65 | 66 | uninstall-hook: 67 | for lang in $(LANGS); do \ 68 | d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \ 69 | rm -f $$d/$(DOMAIN).mo; \ 70 | done 71 | 72 | endif ENABLE_NLS 73 | -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | bin/virt-sandbox.c 2 | libvirt-sandbox/libvirt-sandbox-builder-initrd.c 3 | libvirt-sandbox/libvirt-sandbox-builder-machine.c 4 | libvirt-sandbox/libvirt-sandbox-config.c 5 | libvirt-sandbox/libvirt-sandbox-console.c 6 | libvirt-sandbox/libvirt-sandbox-console-raw.c 7 | libvirt-sandbox/libvirt-sandbox-console-rpc.c 8 | libvirt-sandbox/libvirt-sandbox-context.c 9 | libvirt-sandbox/libvirt-sandbox-context-interactive.c 10 | libvirt-sandbox/libvirt-sandbox-init-common.c 11 | libvirt-sandbox/libvirt-sandbox-rpcpacket.c 12 | libvirt-sandbox/libvirt-sandbox-util.c 13 | -------------------------------------------------------------------------------- /po/README.md: -------------------------------------------------------------------------------- 1 | Libvirt-Sandbox Message Translation 2 | ================================ 3 | 4 | Libvirt-Sandbox translatable messages are maintained using the GNU Gettext tools 5 | and file formats, in combination with the Zanata web service. 6 | 7 | Source repository 8 | ================= 9 | 10 | The libvirt-sandbox GIT repository does NOT store the master 11 | "libvirt-sandbox.pot" file, nor does it store full "po" files for translations. 12 | The master "libvirt-sandbox.pot" file can be generated at any time using 13 | 14 | make libvirt-sandbox.pot 15 | 16 | The translations are kept in minimized files that are the same file format 17 | as normal po files but with all redundant information stripped and messages 18 | re-ordered. The key differences between the ".mini.po" files in GIT and the 19 | full ".po" files are 20 | 21 | - msgids with no current translation are omitted 22 | - msgids are sorted in alphabetical order not source file order 23 | - msgids with a msgstr marked "fuzzy" are discarded 24 | - source file locations are omitted 25 | 26 | The full po files can be created at any time using 27 | 28 | make update-po 29 | 30 | This merges the "libvirt-sandbox.pot" with the "$LANG.mini.po" for each 31 | language, to create the "$LANG.po" files. These are included in the release 32 | archives created by "make dist". 33 | 34 | When a full po file is updated, changes can be propagated back into the 35 | minimized po files using 36 | 37 | make update-mini-po 38 | 39 | Note, however, that this is generally not something that should be run by 40 | developers normally, as it is triggered by 'make pull-po' when refreshing 41 | content from Zanata. 42 | 43 | 44 | Zanata web service 45 | ================== 46 | 47 | The translation of libvirt-sandbox messages has been outsourced to the Fedora 48 | translation team using the Zanata web service: 49 | 50 | https://fedora.zanata.org/project/view/libvirt-sandbox 51 | 52 | As such, changes to translations will generally NOT be accepted as patches 53 | directly to libvirt-sandbox GIT. Any changes made to "$LANG.mini.po" files in 54 | libvirt-sandbox GIT will be overwritten and lost the next time content is 55 | imported from Zanata. 56 | 57 | The master "libvirt-sandbox.pot" file is periodically pushed to Zanata to 58 | provide the translation team with content changes, using 59 | 60 | make push-pot 61 | 62 | New translated text is then periodically pulled down from Zanata to update the 63 | minimized po files, using 64 | 65 | make pull-po 66 | 67 | Sometimes the translators make mistakes, most commonly with handling printf 68 | format specifiers. The "pull-po" command re-generates the .gmo files to try to 69 | identify such mistakes. If a mistake is made, the broken msgstr should be 70 | deleted in the local "$LANG.mini.po" file, and the Zanata web interface used 71 | to reject the translation so that the broken msgstr isn't pulled down next time. 72 | 73 | After pulling down new content the diff should be examined to look for any 74 | obvious mistakes that are not caught automatically. There have been bugs in 75 | Zanata tools which caused messges to go missing, so pay particular attention to 76 | diffs showing deletions where the msgid still exists in libvirt-sandbox.pot 77 | -------------------------------------------------------------------------------- /prepare-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -v 5 | 6 | # Make things clean. 7 | test -n "$1" && RESULTS=$1 || RESULTS=results.log 8 | 9 | test -f Makefile && make -k distclean || : 10 | 11 | rm -rf build 12 | mkdir build 13 | cd build 14 | 15 | ../autogen.sh --prefix=$HOME/builder \ 16 | --enable-gtk-doc 17 | 18 | make 19 | make install 20 | 21 | # set -o pipefail is a bashism; this use of exec is the POSIX alternative 22 | exec 3>&1 23 | st=$( 24 | exec 4>&1 >&3 25 | { make check syntax-check 2>&1 3>&- 4>&-; echo $? >&4; } | tee "$RESULTS" 26 | ) 27 | exec 3>&- 28 | test "$st" = 0 29 | 30 | rm -f *.tar.xz 31 | make dist 32 | 33 | if [ -f /usr/bin/rpmbuild ]; then 34 | rpmbuild --nodeps \ 35 | --define "_sourcedir `pwd`" \ 36 | -ba --clean libvirt-sandbox.spec 37 | fi 38 | 39 | exit 0 40 | --------------------------------------------------------------------------------