aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README-AGL.md4
-rw-r--r--README.md1
-rw-r--r--meta-agl-bsp/ROCKO.FIXMEs18
-rw-r--r--meta-agl-bsp/classes/image-vm.bbclass181
-rw-r--r--meta-agl-bsp/classes/image.bbclass624
-rw-r--r--meta-agl-bsp/classes/sdcard_image-rpi.bbclass184
-rw-r--r--meta-agl-bsp/conf/include/agl_dra7xx-evm.inc4
-rw-r--r--meta-agl-bsp/conf/include/agl_h3ulcb.inc13
-rw-r--r--meta-agl-bsp/conf/include/agl_m3ulcb.inc11
-rw-r--r--meta-agl-bsp/conf/include/agl_qemux86-64.inc3
-rw-r--r--meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary/0001-6x_bootscript-Make-bootscript-compatible-with-WIC-an.patch73
-rw-r--r--meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary_git.bbappend6
-rw-r--r--meta-agl-bsp/meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend1
-rw-r--r--meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend2
-rw-r--r--meta-agl-bsp/meta-intel/recipes-kernel/linux-firmware/linux-firmware_git.bbappend5
-rw-r--r--meta-agl-bsp/meta-intel/recipes-kernel/linux/files/net-devices.cfg1
-rw-r--r--meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.9%.bbappend4
-rw-r--r--meta-agl-bsp/meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend1
-rw-r--r--meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.11.bb (renamed from meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.7.bb)9
-rw-r--r--meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.14.bbappend (renamed from meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.9.bbappend)1
-rw-r--r--meta-agl-bsp/meta-qcom/recipes-kernel/most/most.bbappend5
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/files/0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch42
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Add-error-signal-emission-for-missing-plugins.patch252
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Fix-pause-play.patch107
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/filechooser.patch54
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gst-player.desktop10
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gtk2.patch71
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player_git.bb39
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-plugins-package.inc56
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav.inc46
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/0001-Disable-yasm-for-libav-when-disable-yasm.patch33
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/workaround-to-build-gst-libav-for-i586-with-gcc.patch26
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_1.6.3.bb20
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_git.bb38
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-meta-base.bb68
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx.inc43
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch30
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_1.2.0.bb11
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_git.bb25
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad.inc148
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch57
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-glimagesink-Downrank-to-marginal.patch32
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch27
-rwxr-xr-xmeta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0002-glplugin-glwindow-fix-memory-leak-of-navigation-thre.patch35
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/avoid-including-sys-poll.h-directly.patch30
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/configure-allow-to-disable-libssh2.patch64
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/ensure-valid-sentinels-for-gst_structure_get-etc.patch86
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/fix-maybe-uninitialized-warnings-when-compiling-with-Os.patch28
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_1.6.3.bb28
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_git.bb65
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base.inc50
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch168
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0002-Makefile.am-prefix-calls-to-pkg-config-with-PKG_CONF.patch298
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-riff-add-missing-include-directories-when-calling-in.patch28
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-ssaparse-enhance-SSA-text-lines-parsing.patch225
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-rtsp-drop-incorrect-reference-to-gstreamer-sdp-in-Ma.patch27
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-subparse-set-need_segment-after-sink-pad-received-GS.patch69
-rwxr-xr-xmeta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0005-convertframe-Support-video-crop-when-convert-frame.patch143
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch32
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/get-caps-from-src-pad-when-query-caps.patch44
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/make-gio_unix_2_0-dependency-configurable.patch47
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_1.6.3.bb25
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_git.bb27
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good.inc53
-rwxr-xr-xmeta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/0001-gstrtpmp4gpay-set-dafault-value-for-MPEG4-without-co.patch62
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/avoid-including-sys-poll.h-directly.patch44
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/ensure-valid-sentinel-for-gst_structure_get.patch40
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_1.6.3.bb15
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_git.bb28
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly.inc31
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_1.6.3.bb13
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_git.bb41
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins.inc40
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server.inc24
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server/0001-Don-t-hardcode-libtool-name-when-using-introspection.patch27
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server_1.6.2.bb6
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0.inc58
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0/0001-Fix-crash-with-gst-inspect.patch28
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_1.6.3.bb14
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_git.bb30
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend4
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-fix-arm-trusted-firmware-build-for-gcc6.patch26
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-Remove-the-file-generation-and-directly-copy-the-fil.patch41
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.c1033
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.h10
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.c1024
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.h10
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bbappend23
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc7.patch (renamed from meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc6.patch)12
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2015.04.bbappend2
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0001-mm-larger-stack-guard-gap-between-vmas.patch935
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0002-Allow-stack-to-grow-up-to-address-space-limit.patch51
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch52
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend1
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.9.bbappend9
-rw-r--r--meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh4
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/0001-Autoload-uEnv.txt-on-boot.patch27
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch101
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-rcar-sdhi-DMA-support.patch650
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Add-Hibernation-swsusp-command-support.patch909
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch95
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch1058
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch91
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0004-Add-porter-board-Hibernation-code.patch1352
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend13
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf.bbappend4
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf/lvds-off.cfg3
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module.bbappend7
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module/hibernation/0001-Add-gles-hibernation-code-for-M2W-only.patch38
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend45
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0001-media-r820t-do-not-double-free-fe-tuner_priv-in-r820.patch30
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0002-media-r820t-remove-redundant-initializations-in-r820.patch52
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0003-media-r820t-avoid-potential-memcpy-buffer-overflow-i.patch33
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/cfg_mac_80211.cfg2
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/disable_delay_printk.patch17
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hciattach.cfg9
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-Hibernation-kernel-base-code.patch853
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch110
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Add-Hibernation-arch-code-Only-R-CAR-M2W.patch1529
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch88
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch32
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-sata-hibernation-code.patch56
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0004-Add-firmware-hibernation-code.patch25
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0005-Add-rcar-dma-hibernation-code.patch113
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0006-Add-rcar-du-hibernation-code.patch127
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0007-Add-rcar-i2c-hibernation-code.patch69
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0008-Add-rcar-mmc-hibernation-code.patch414
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0009-Add-hibernation-store-area.patch62
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0010-Add-rcar-eth-hibernation-code.patch238
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0011-Add-rcar-pci-hibernation-code.patch375
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0012-Add-rcar-gpio-hibernation-code.patch230
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0013-Add-rcar-spi-hibernation-code.patch168
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0014-Add-rcar-sci-hibernation-code.patch41
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0015-Add-rcar-usbphy-hibernation-code.patch83
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg10
-rwxr-xr-xmeta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/pppd-rcar.cfg6
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/ra2x00.cfg2
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/files/0001-Fix-for-memory-corruption-during-hibernate.patch155
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/mmngr-kernel-module.bbappend4
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch101
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend4
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/files/0001-Fix-Wformat-security-issue-in-named-open.patch26
-rw-r--r--meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/libuiomux_git.bbappend2
-rw-r--r--meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend29
-rw-r--r--meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend5
-rw-r--r--meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend2
-rw-r--r--meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota/0002-fixup-build-with-gcc7.patch101
-rw-r--r--meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb1
-rw-r--r--meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend (renamed from meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.1.bbappend)0
-rw-r--r--meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch25
-rw-r--r--meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend4
-rw-r--r--meta-agl-bsp/recipes-graphics/wayland/libva_%.bbappend (renamed from meta-agl-bsp/meta-intel/recipes-graphics/wayland/libva_%.bbappend)0
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/kernel-devsrc.bbappend6
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-agl-4.9.inc2
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-agl.inc2
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-yocto/0001-fanotify-fix-notification-of-groups-with-inode-mount.patch206
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch900
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch51
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch52
-rw-r--r--meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend14
-rw-r--r--meta-agl-bsp/recipes-support/open-vm-tools/files/tools.conf2
-rw-r--r--meta-agl-bsp/recipes-support/open-vm-tools/files/vmtoolsd.service11
-rw-r--r--meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch41
-rw-r--r--meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0002-add-include-sys-sysmacros.h.patch33
-rw-r--r--meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb84
-rw-r--r--meta-agl-distro/conf/distro/poky-agl.conf23
-rw-r--r--meta-agl/conf/include/agl-devel.inc2
-rw-r--r--meta-agl/conf/include/agl-gplv2.inc8
-rw-r--r--meta-agl/files/group2
-rw-r--r--meta-agl/files/passwd2
-rw-r--r--meta-agl/recipes-connectivity/bluez5/bluez5/cve-2017-1000250.patch34
-rw-r--r--meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend3
-rw-r--r--meta-agl/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch3
-rw-r--r--meta-agl/recipes-connectivity/rygel/files/0001-Add-LightMediaScanner-plugin.patch2541
-rw-r--r--meta-agl/recipes-connectivity/rygel/files/0002-lms-add-C-source-files.patch9455
-rw-r--r--meta-agl/recipes-connectivity/rygel/rygel_%.bbappend37
-rw-r--r--meta-agl/recipes-core/glibc/glibc/arm/local-arm-futex.diff1
-rw-r--r--meta-agl/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch52
-rw-r--r--meta-agl/recipes-core/systemd/systemd/backport-v234-e266c06.patch315
-rw-r--r--meta-agl/recipes-core/systemd/systemd_%.bbappend8
-rw-r--r--meta-agl/recipes-core/systemd/systemd_234.bbappend6
-rw-r--r--meta-agl/recipes-core/xmlsec1/xmlsec1_1.2.20.bb40
-rw-r--r--meta-agl/recipes-devtools/autogen/autogen-native_5.18.12.bbappend2
-rw-r--r--meta-agl/recipes-devtools/autogen/files/0003-autoopts-mk-tpl-config.sh-fix-shell-path.patch29
-rw-r--r--meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts.service1
-rw-r--r--meta-agl/recipes-devtools/run-postinsts/run-postinsts_%.bbappend5
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/files/0001-Define-comparison_fn_t-for-non-glibc-systems.patch33
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/files/id3-plugin-support-out-of-tree-build.patch11
-rw-r--r--meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_0.5.1.bb63
-rw-r--r--meta-agl/recipes-navigation/geoclue/geoclue_%.bbappend1
-rw-r--r--meta-app-framework/conf/include/agl-appfw-smack.inc6
-rw-r--r--meta-app-framework/recipes-core/af-main/af-main_1.0.bb8
-rw-r--r--meta-app-framework/recipes-core/base-files/base-files_%.bbappend8
-rw-r--r--meta-app-framework/recipes-core/packagegroups/packagegroup-agl-core-security.bbappend1
-rw-r--r--meta-app-framework/recipes-core/security-manager/security-manager/0001-gcc-7-requires-include-functional-for-std-function.patch51
-rw-r--r--meta-app-framework/recipes-core/security-manager/security-manager_%.bbappend3
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux-%.bbappend2
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend12
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend11
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch62
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch43
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch39
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch49
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch65
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch43
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch39
-rw-r--r--meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch49
-rw-r--r--meta-app-framework/recipes-security/cynara/cynara/0001-gcc-7-requires-include-functional-for-std-function.patch38
-rw-r--r--meta-app-framework/recipes-security/cynara/cynara_git.bbappend39
-rw-r--r--meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend4
-rw-r--r--meta-app-framework/recipes-support/libcap/libcap_%.bbappend3
-rw-r--r--meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.55.bb25
-rw-r--r--meta-app-framework/recipes-support/xmlsec1/xmlsec1/Only-require-libxslt-in-.pc-files-when-necessary.patch115
-rw-r--r--meta-app-framework/recipes-support/xmlsec1/xmlsec1_1.%.bbappend6
-rw-r--r--meta-ivi-common/recipes-test/freetype/freetype_2.8.bbappend (renamed from meta-ivi-common/recipes-test/freetype/freetype_2.7.1.bbappend)4
-rw-r--r--meta-ivi-common/recipes-test/packagegroups/packagegroup-ivi-common-test.bb3
-rw-r--r--meta-ivi-common/recipes-test/wayland/wayland-fits_%.bbappend5
-rw-r--r--meta-ivi-common/recipes-test/wayland/wayland-fits_git.bbappend2
-rw-r--r--meta-netboot/classes/netboot.bbclass5
-rw-r--r--meta-security/COPYING.MIT17
-rw-r--r--meta-security/README.md31
-rw-r--r--meta-security/conf/layer.conf12
-rw-r--r--meta-security/recipes-connectivity/bluez5/bluez5_%.bbappend55
-rw-r--r--meta-security/recipes-connectivity/connman/connman_%.bbappend32
-rw-r--r--meta-security/recipes-core/base-files/base-files_%.bbappend73
-rw-r--r--meta-security/recipes-core/coreutils/coreutils_%.bbappend7
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0001-Fix-memleak-in-GetConnectionCredentials-handler.patch32
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0002-New-a-sv-helper-for-using-byte-arrays-as-the-variant.patch97
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0003-Add-LSM-agnostic-support-for-LinuxSecurityLabel-cred.patch515
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0004-Integration-of-Cynara-asynchronous-security-checks.patch2253
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0005-Disable-message-dispatching-when-send-rule-result-is.patch941
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0006-Handle-unavailability-of-policy-results-for-broadcas.patch1071
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0007-Add-own-rule-result-unavailability-handling.patch1142
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/0008-Add-GetConnectionSmackContext-D-Bus-daemon-method.patch99
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus-cynara/Perform-Cynara-runtime-policy-checks-by-default.patch116
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus/0001-Integration-of-Cynara-asynchronous-security-checks.patch2261
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus/0002-Disable-message-dispatching-when-send-rule-result-is.patch962
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus/0003-Handle-unavailability-of-policy-results-for-broadcas.patch1090
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus/0004-Add-own-rule-result-unavailability-handling.patch1345
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus/0005-Perform-Cynara-runtime-policy-checks-by-default.patch123
-rw-r--r--meta-security/recipes-core/dbus-cynara/dbus_1.10.20.bbappend13
-rw-r--r--meta-security/recipes-core/packagegroups/packagegroup-security-framework.bb22
-rw-r--r--meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch49
-rw-r--r--meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch50
-rw-r--r--meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev-v216.patch82
-rw-r--r--meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev.patch68
-rw-r--r--meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v216.patch107
-rw-r--r--meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v225.patch191
-rw-r--r--meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v228.patch179
-rw-r--r--meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network.patch106
-rw-r--r--meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with-v216.patch41
-rw-r--r--meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with.patch37
-rw-r--r--meta-security/recipes-core/systemd/systemd/mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch58
-rw-r--r--meta-security/recipes-core/systemd/systemd/udev-smack-default.rules23
-rw-r--r--meta-security/recipes-core/systemd/systemd_%.bbappend120
-rw-r--r--meta-security/recipes-core/util-linux/util-linux_%.bbappend8
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs.inc27
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/acinclude.m4135
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/mkdir.patch18
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/ptest.patch67
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch19
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/remove.ldconfig.call.patch44
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs/run-ptest11
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend14
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/e2fsprogs_git.bb106
-rw-r--r--meta-security/recipes-devtools/e2fsprogs/files/ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch51
-rw-r--r--meta-security/recipes-kernel/linux/linux-%.bbappend17
-rw-r--r--meta-security/recipes-kernel/linux/linux/audit.cfg2
-rw-r--r--meta-security/recipes-kernel/linux/linux/smack-default-lsm.cfg2
-rw-r--r--meta-security/recipes-kernel/linux/linux/smack.cfg8
-rw-r--r--meta-security/recipes-security/audit/audit/add-system-call-table-for-ARM.patch46
-rw-r--r--meta-security/recipes-security/audit/audit/audit-for-cross-compiling.patch2938
-rw-r--r--meta-security/recipes-security/audit/audit/audit-python-configure.patch27
-rw-r--r--meta-security/recipes-security/audit/audit/audit-python.patch31
-rw-r--r--meta-security/recipes-security/audit/audit/audit-volatile.conf1
-rwxr-xr-xmeta-security/recipes-security/audit/audit/auditd153
-rw-r--r--meta-security/recipes-security/audit/audit/auditd.service20
-rw-r--r--meta-security/recipes-security/audit/audit/disable-ldap.patch59
-rw-r--r--meta-security/recipes-security/audit/audit/fix-swig-host-contamination.patch48
-rw-r--r--meta-security/recipes-security/audit/audit_2.3.2.bb102
-rw-r--r--meta-security/recipes-security/cynara/cynara/0001-Add-fallthrough-tags.patch59
-rw-r--r--meta-security/recipes-security/cynara/cynara/0002-gcc-7-requires-include-functional-for-std-function.patch38
-rw-r--r--meta-security/recipes-security/cynara/cynara/0003-Avoid-warning-when-compiling-without-smack.patch45
-rw-r--r--meta-security/recipes-security/cynara/cynara/0004-Fix-mode-of-sockets.patch44
-rw-r--r--meta-security/recipes-security/cynara/cynara/0005-Allow-to-tune-sockets.patch127
-rw-r--r--meta-security/recipes-security/cynara/cynara/0006-Install-socket-activation-by-default.patch80
-rw-r--r--meta-security/recipes-security/cynara/cynara/cynara-db-migration-abort-on-errors.patch31
-rwxr-xr-xmeta-security/recipes-security/cynara/cynara/run-ptest4
-rw-r--r--meta-security/recipes-security/cynara/cynara_0.14.10.bb163
-rw-r--r--meta-security/recipes-security/keyutils/keyutils/keyutils-arm-remove-m32-m64.patch19
-rw-r--r--meta-security/recipes-security/keyutils/keyutils/keyutils_fix_library_install.patch30
-rw-r--r--meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86-64_cflags.patch13
-rw-r--r--meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86_cflags.patch13
-rw-r--r--meta-security/recipes-security/keyutils/keyutils_1.5.8.bb44
-rw-r--r--meta-security/recipes-security/libcap-ng/libcap-ng/CVE-2014-3215.patch79
-rw-r--r--meta-security/recipes-security/libcap-ng/libcap-ng/python.patch39
-rw-r--r--meta-security/recipes-security/libcap-ng/libcap-ng_0.7.3.bb39
-rw-r--r--meta-security/recipes-security/security-manager/security-manager.inc98
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/0001-Smack-rules-create-two-new-functions.patch116
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/0002-app-install-implement-multiple-set-of-smack-rules.patch34
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/Removing-tizen-platform-config.patch196
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/c-11-replace-depracated-auto_ptr.patch32
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/include-linux-xattr.patch24
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/libcap-without-pkgconfig.patch32
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/removes-dependency-to-libslp-db-utils.patch78
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/security-manager-policy-reload-do-not-depend-on-GNU-.patch35
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/socket-manager-removes-tizen-specific-call.patch47
-rw-r--r--meta-security/recipes-security/security-manager/security-manager/systemd-stop-using-compat-libs.patch47
-rw-r--r--meta-security/recipes-security/security-manager/security-manager_git.bb34
-rw-r--r--meta-security/recipes-security/smacknet/files/smacknet184
-rw-r--r--meta-security/recipes-security/smacknet/files/smacknet.service11
-rw-r--r--meta-security/recipes-security/smacknet/smacknet.bb29
-rw-r--r--templates/base/00_local.conf.agl.inc3
-rw-r--r--templates/base/bblayers.conf.sample1
-rw-r--r--templates/feature/agl-appfw-smack/50_bblayers.conf.inc5
-rw-r--r--templates/feature/agl-gplv2/50_bblayers.conf.inc1
-rw-r--r--templates/feature/agl-gplv2/50_local.conf.inc2
-rw-r--r--templates/feature/agl-sota/50_bblayers.conf.inc2
-rw-r--r--templates/machine/dragonboard-410c/50_setup.sh1
-rw-r--r--templates/machine/porter-nogfx/50_bblayers.conf.inc5
-rw-r--r--templates/machine/porter-nogfx/50_local.conf.inc3
-rw-r--r--templates/machine/porter/50_bblayers.conf.inc5
-rw-r--r--templates/machine/porter/50_local.conf.inc3
-rw-r--r--templates/machine/porter/50_setup.sh14
324 files changed, 19746 insertions, 31680 deletions
diff --git a/README-AGL.md b/README-AGL.md
index bb6e8aa63..146d6ff16 100644
--- a/README-AGL.md
+++ b/README-AGL.md
@@ -173,7 +173,7 @@ To build an image from 'meta-agl'
> $ bitbake agl-demo-platform
- If you want to run QEMU directly as VM in Virtual Box or your other favorite VM software then add this line to your "conf/local.conf" file.
- > IMAGE_FSTYPES += "vmdk"
+ > IMAGE_FSTYPES += "wic.vmdk"
5. Run in the emulator
> $ runqemu agl-image-ivi qemux86-64
@@ -194,7 +194,7 @@ To build an image from 'meta-agl'
> $ runqemu agl-image-ivi qemux86-64 bootparams="uvesafb.mode_option=1280x720-32" serial
**Or use the virtual disk in Virtual Box from this location:**
- > tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.vmdk
+ > tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.wic.vmdk
6. Some weston samples are available from weston terminal (click top left icon).
Check the folder `/opt/AGL/ALS2016`.
diff --git a/README.md b/README.md
index fc6a06967..8c98edab0 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,6 @@ See README-AGL.md
Specifically out of meta-openembedded these sub-layers are used:
* meta-openembedded/meta-oe
* meta-openembedded/meta-multimedia
- * meta-openembedded/meta-efl
* meta-openembedded/meta-networking
* meta-openembedded/meta-python
diff --git a/meta-agl-bsp/ROCKO.FIXMEs b/meta-agl-bsp/ROCKO.FIXMEs
new file mode 100644
index 000000000..c21e2ec3d
--- /dev/null
+++ b/meta-agl-bsp/ROCKO.FIXMEs
@@ -0,0 +1,18 @@
+FIXME:
+
+- ti:
+ - gst and ducati:
+ modified: conf/include/agl_dra7xx-evm.inc
+ modified: meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
+
+- i.mx:
+ Thus remove old bsp adaptations.
+ deleted: meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend
+
+- meta-oe:
+ - change is upstream
+ deleted: meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend
+
+- meta-intel:
+ - move libva patch to parent folder (generalize)
+
diff --git a/meta-agl-bsp/classes/image-vm.bbclass b/meta-agl-bsp/classes/image-vm.bbclass
deleted file mode 100644
index ec8f0cb8f..000000000
--- a/meta-agl-bsp/classes/image-vm.bbclass
+++ /dev/null
@@ -1,181 +0,0 @@
-# image-vm.bbclass
-# (loosly based off image-live.bbclass Copyright (C) 2004, Advanced Micro Devices, Inc.)
-#
-# Create an image which can be placed directly onto a harddisk using dd and then
-# booted.
-#
-# This uses syslinux. extlinux would have been nice but required the ext2/3
-# partition to be mounted. grub requires to run itself as part of the install
-# process.
-#
-# The end result is a 512 boot sector populated with an MBR and partition table
-# followed by an msdos fat16 partition containing syslinux and a linux kernel
-# completed by the ext2/3 rootfs.
-#
-# We have to push the msdos parition table size > 16MB so fat 16 is used as parted
-# won't touch fat12 partitions.
-
-inherit live-vm-common
-
-do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \
- virtual/kernel:do_deploy \
- syslinux:do_populate_sysroot \
- syslinux-native:do_populate_sysroot \
- parted-native:do_populate_sysroot \
- mtools-native:do_populate_sysroot \
- ${PN}:do_image_${VM_ROOTFS_TYPE} \
- "
-
-IMAGE_TYPEDEP_vmdk = "${VM_ROOTFS_TYPE}"
-IMAGE_TYPEDEP_vmdk.xz = "${VM_ROOTFS_TYPE}"
-IMAGE_TYPEDEP_vdi = "${VM_ROOTFS_TYPE}"
-IMAGE_TYPEDEP_qcow2 = "${VM_ROOTFS_TYPE}"
-IMAGE_TYPEDEP_hdddirect = "${VM_ROOTFS_TYPE}"
-IMAGE_TYPES_MASKED += "vmdk vmdk.xz vdi qcow2 hdddirect"
-
-VM_ROOTFS_TYPE ?= "ext4"
-ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${VM_ROOTFS_TYPE}"
-
-# Used by bootloader
-LABELS_VM ?= "boot"
-ROOT_VM ?= "root=/dev/sda2"
-# Using an initramfs is optional. Enable it by setting INITRD_IMAGE_VM.
-INITRD_IMAGE_VM ?= ""
-INITRD_VM ?= "${@'${IMGDEPLOYDIR}/${INITRD_IMAGE_VM}-${MACHINE}.cpio.gz' if '${INITRD_IMAGE_VM}' else ''}"
-do_bootdirectdisk[depends] += "${@'${INITRD_IMAGE_VM}:do_image_complete' if '${INITRD_IMAGE_VM}' else ''}"
-
-BOOTDD_VOLUME_ID ?= "boot"
-BOOTDD_EXTRA_SPACE ?= "16384"
-
-DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
-DISK_SIGNATURE[vardepsexclude] = "DISK_SIGNATURE_GENERATED"
-
-build_boot_dd() {
- HDDDIR="${S}/hdd/boot"
- HDDIMG="${S}/hdd.image"
- IMAGE=${IMGDEPLOYDIR}/${IMAGE_NAME}.hdddirect
-
- populate_kernel $HDDDIR
-
- if [ "${PCBIOS}" = "1" ]; then
- syslinux_hddimg_populate $HDDDIR
- fi
- if [ "${EFI}" = "1" ]; then
- efi_hddimg_populate $HDDDIR
- fi
-
- BLOCKS=`du -bks $HDDDIR | cut -f 1`
- BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
-
- # Remove it since mkdosfs would fail when it exists
- rm -f $HDDIMG
- mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS
- mcopy -i $HDDIMG -s $HDDDIR/* ::/
-
- if [ "${PCBIOS}" = "1" ]; then
- syslinux_hdddirect_install $HDDIMG
- fi
- chmod 644 $HDDIMG
-
- ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1`
- TOTALSIZE=`expr $BLOCKS + $ROOTFSBLOCKS`
- END1=`expr $BLOCKS \* 1024`
- END2=`expr $END1 + 512`
- END3=`expr \( $ROOTFSBLOCKS \* 1024 \) + $END1`
-
- echo $ROOTFSBLOCKS $TOTALSIZE $END1 $END2 $END3
- rm -rf $IMAGE
- dd if=/dev/zero of=$IMAGE bs=1024 seek=$TOTALSIZE count=1
-
- parted $IMAGE mklabel msdos
- parted $IMAGE mkpart primary fat16 0 ${END1}B
- parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
- parted $IMAGE set 1 boot on
-
- parted $IMAGE print
-
- awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | sed 's/\(..\)\(..\)\(..\)\(..\)/\\x\4\\x\3\\x\2\\x\1/')\" }" | \
- dd of=$IMAGE bs=1 seek=440 conv=notrunc
-
- OFFSET=`expr $END2 / 512`
- if [ "${PCBIOS}" = "1" ]; then
- dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
- fi
-
- dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
- dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
-
- cd ${IMGDEPLOYDIR}
-
- ln -sf ${IMAGE_NAME}.hdddirect ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.hdddirect
-}
-
-python do_bootdirectdisk() {
- validate_disk_signature(d)
- set_live_vm_vars(d, 'VM')
- if d.getVar("PCBIOS") == "1":
- bb.build.exec_func('build_syslinux_cfg', d)
- if d.getVar("EFI") == "1":
- bb.build.exec_func('build_efi_cfg', d)
- bb.build.exec_func('build_boot_dd', d)
-}
-
-def generate_disk_signature():
- import uuid
-
- signature = str(uuid.uuid4())[:8]
-
- if signature != '00000000':
- return signature
- else:
- return 'ffffffff'
-
-def validate_disk_signature(d):
- import re
-
- disk_signature = d.getVar("DISK_SIGNATURE")
-
- if not re.match(r'^[0-9a-fA-F]{8}$', disk_signature):
- bb.fatal("DISK_SIGNATURE '%s' must be an 8 digit hex string" % disk_signature)
-
-DISK_SIGNATURE_GENERATED := "${@generate_disk_signature()}"
-
-run_qemu_img (){
- type="$1"
- qemu-img convert -O $type ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.hdddirect ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type
-
- ln -sf ${IMAGE_NAME}.$type ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type
-}
-create_vmdk_image () {
- run_qemu_img vmdk
-}
-
-create_vmdkxz_image () {
- run_qemu_img vmdk
- xz -f ${XZ_COMPRESSION_LEVEL} ${XZ_THREADS} --check=${XZ_INTEGRITY_CHECK} ${IMGDEPLOYDIR}/${IMAGE_NAME}.vmdk
- ln -sf ${IMAGE_NAME}.vmdk.xz ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vmdk.xz
- rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vmdk
-}
-
-create_vdi_image () {
- run_qemu_img vdi
-}
-
-create_qcow2_image () {
- run_qemu_img qcow2
-}
-
-python do_vmimg() {
- if bb.utils.contains('IMAGE_FSTYPES', 'vmdk.xz', True, False, d):
- bb.build.exec_func('create_vmdkxz_image', d)
- if bb.utils.contains('IMAGE_FSTYPES', 'vmdk', True, False, d):
- bb.build.exec_func('create_vmdk_image', d)
- if 'vdi' in d.getVar('IMAGE_FSTYPES', True):
- bb.build.exec_func('create_vdi_image', d)
- if 'qcow2' in d.getVar('IMAGE_FSTYPES', True):
- bb.build.exec_func('create_qcow2_image', d)
-}
-
-addtask bootdirectdisk before do_vmimg
-addtask vmimg after do_bootdirectdisk before do_image_complete
-do_vmimg[depends] += "qemu-native:do_populate_sysroot"
diff --git a/meta-agl-bsp/classes/image.bbclass b/meta-agl-bsp/classes/image.bbclass
deleted file mode 100644
index ccaffce60..000000000
--- a/meta-agl-bsp/classes/image.bbclass
+++ /dev/null
@@ -1,624 +0,0 @@
-inherit rootfs_${IMAGE_PKGTYPE}
-
-# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
-# in the non-Linux SDK_OS case, such as mingw32
-SDKEXTCLASS ?= "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
-inherit ${SDKEXTCLASS}
-
-TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
-TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_sysroot_relativelinks; "
-
-LICENSE = "MIT"
-PACKAGES = ""
-DEPENDS += "${MLPREFIX}qemuwrapper-cross depmodwrapper-cross"
-RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL}"
-RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-TESTIMAGECLASS = "${@base_conditional('TEST_IMAGE', '1', 'testimage-auto', '', d)}"
-inherit ${TESTIMAGECLASS}
-
-# IMAGE_FEATURES may contain any available package group
-IMAGE_FEATURES ?= ""
-IMAGE_FEATURES[type] = "list"
-IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password post-install-logging"
-
-# Generate companion debugfs?
-IMAGE_GEN_DEBUGFS ?= "0"
-
-# rootfs bootstrap install
-ROOTFS_BOOTSTRAP_INSTALL = "run-postinsts"
-
-# These packages will be removed from a read-only rootfs after all other
-# packages have been installed
-ROOTFS_RO_UNNEEDED = "update-rc.d base-passwd shadow ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
-
-# packages to install from features
-FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL[vardepvalue] = "${FEATURE_INSTALL}"
-FEATURE_INSTALL_OPTIONAL = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
-FEATURE_INSTALL_OPTIONAL[vardepvalue] = "${FEATURE_INSTALL_OPTIONAL}"
-
-# Define some very basic feature package groups
-FEATURE_PACKAGES_package-management = "${ROOTFS_PKGMANAGE}"
-SPLASH ?= "psplash"
-FEATURE_PACKAGES_splash = "${SPLASH}"
-
-IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
-
-def check_image_features(d):
- valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems') or "").split()
- valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys()
- for var in d:
- if var.startswith("PACKAGE_GROUP_"):
- bb.warn("PACKAGE_GROUP is deprecated, please use FEATURE_PACKAGES instead")
- valid_features.append(var[14:])
- elif var.startswith("FEATURE_PACKAGES_"):
- valid_features.append(var[17:])
- valid_features.sort()
-
- features = set(oe.data.typed_value('IMAGE_FEATURES', d))
- for feature in features:
- if feature not in valid_features:
- if bb.utils.contains('EXTRA_IMAGE_FEATURES', feature, True, False, d):
- raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES (added via EXTRA_IMAGE_FEATURES) is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
- else:
- raise bb.parse.SkipRecipe("'%s' in IMAGE_FEATURES is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
-
-IMAGE_INSTALL ?= ""
-IMAGE_INSTALL[type] = "list"
-export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL} ${FEATURE_INSTALL}"
-PACKAGE_INSTALL_ATTEMPTONLY ?= "${FEATURE_INSTALL_OPTIONAL}"
-
-IMGDEPLOYDIR = "${WORKDIR}/deploy-${PN}-image-complete"
-
-# Images are generally built explicitly, do not need to be part of world.
-EXCLUDE_FROM_WORLD = "1"
-
-USE_DEVFS ?= "1"
-USE_DEPMOD ?= "1"
-
-PID = "${@os.getpid()}"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-LDCONFIGDEPEND ?= "ldconfig-native:do_populate_sysroot"
-LDCONFIGDEPEND_libc-uclibc = ""
-LDCONFIGDEPEND_libc-musl = ""
-
-# This is needed to have depmod data in PKGDATA_DIR,
-# but if you're building small initramfs image
-# e.g. to include it in your kernel, you probably
-# don't want this dependency, which is causing dependency loop
-KERNELDEPMODDEPEND ?= "virtual/kernel:do_packagedata"
-
-do_rootfs[depends] += " \
- makedevs-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot ${LDCONFIGDEPEND} \
- virtual/update-alternatives-native:do_populate_sysroot update-rc.d-native:do_populate_sysroot \
- ${KERNELDEPMODDEPEND} \
-"
-do_rootfs[recrdeptask] += "do_packagedata"
-
-def rootfs_command_variables(d):
- return ['ROOTFS_POSTPROCESS_COMMAND','ROOTFS_PREPROCESS_COMMAND','ROOTFS_POSTINSTALL_COMMAND','ROOTFS_POSTUNINSTALL_COMMAND','OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','IMAGE_POSTPROCESS_COMMAND',
- 'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS']
-
-python () {
- variables = rootfs_command_variables(d) + sdk_command_variables(d)
- for var in variables:
- if d.getVar(var, False):
- d.setVarFlag(var, 'func', '1')
-}
-
-def rootfs_variables(d):
- from oe.rootfs import variable_depends
- variables = ['IMAGE_DEVICE_TABLE','IMAGE_DEVICE_TABLES','BUILD_IMAGES_FROM_FEEDS','IMAGE_TYPES_MASKED','IMAGE_ROOTFS_ALIGNMENT','IMAGE_OVERHEAD_FACTOR','IMAGE_ROOTFS_SIZE','IMAGE_ROOTFS_EXTRA_SPACE',
- 'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS',
- 'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
- 'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
- 'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY']
- variables.extend(rootfs_command_variables(d))
- variables.extend(variable_depends(d))
- return " ".join(variables)
-
-do_rootfs[vardeps] += "${@rootfs_variables(d)}"
-
-do_build[depends] += "virtual/kernel:do_deploy"
-
-def build_live(d):
- if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg
- d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d))
- d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
- if d.getVar('NOISO') == "0" or d.getVar('NOHDD') == "0":
- return "image-live"
- return ""
- return "image-live"
-
-IMAGE_TYPE_live = "${@build_live(d)}"
-inherit ${IMAGE_TYPE_live}
-
-IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vmdk.xz", "vdi", "qcow2", "hdddirect"], "image-vm", "", d)}'
-
-inherit ${IMAGE_TYPE_vm}
-
-IMAGE_TYPE_container = '${@bb.utils.contains("IMAGE_FSTYPES", "container", "image-container", "", d)}'
-inherit ${IMAGE_TYPE_container}
-
-def build_uboot(d):
- if 'u-boot' in (d.getVar('IMAGE_FSTYPES') or ''):
- return "image_types_uboot"
- else:
- return ""
-
-IMAGE_TYPE_uboot = "${@build_uboot(d)}"
-inherit ${IMAGE_TYPE_uboot}
-
-IMAGE_TYPE_wic = "image_types_wic"
-inherit ${IMAGE_TYPE_wic}
-
-python () {
- def extraimage_getdepends(task):
- deps = ""
- for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
- deps += " %s:%s" % (dep, task)
- return deps
-
- d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_lic'))
- d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot'))
-
- deps = " " + imagetypes_getdepends(d)
- d.appendVarFlag('do_rootfs', 'depends', deps)
-
- #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
- #Check for replaces image features
- features = set(oe.data.typed_value('IMAGE_FEATURES', d))
- remain_features = features.copy()
- for feature in features:
- replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split())
- remain_features -= replaces
-
- #Check for conflict image features
- for feature in remain_features:
- conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split())
- temp = conflicts & remain_features
- if temp:
- bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp))))
-
- d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features))))
-
- check_image_features(d)
- initramfs_image = d.getVar('INITRAMFS_IMAGE') or ""
- if initramfs_image != "":
- d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN'))
- d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image)
-}
-
-IMAGE_CLASSES += "image_types"
-inherit ${IMAGE_CLASSES}
-
-IMAGE_POSTPROCESS_COMMAND ?= ""
-
-# some default locales
-IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
-
-LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
-
-# Prefer image, but use the fallback files for lookups if the image ones
-# aren't yet available.
-PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
-
-inherit rootfs-postcommands
-
-PACKAGE_EXCLUDE ??= ""
-PACKAGE_EXCLUDE[type] = "list"
-
-fakeroot python do_rootfs () {
- from oe.rootfs import create_rootfs
- from oe.manifest import create_manifest
- import logging
-
- logger = d.getVar('BB_TASK_LOGGER', False)
- if logger:
- logcatcher = bb.utils.LogCatcher()
- logger.addHandler(logcatcher)
- else:
- logcatcher = None
-
- # NOTE: if you add, remove or significantly refactor the stages of this
- # process then you should recalculate the weightings here. This is quite
- # easy to do - just change the MultiStageProgressReporter line temporarily
- # to pass debug=True as the last parameter and you'll get a printout of
- # the weightings as well as a map to the lines where next_stage() was
- # called. Of course this isn't critical, but it helps to keep the progress
- # reporting accurate.
- stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
- progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
- progress_reporter.next_stage()
-
- # Handle package exclusions
- excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
- inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
- inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
-
- d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
- d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
-
- for pkg in excl_pkgs:
- if pkg in inst_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_pkgs.remove(pkg)
-
- if pkg in inst_attempt_pkgs:
- bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
- inst_attempt_pkgs.remove(pkg)
-
- d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
- d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
-
- # Ensure we handle package name remapping
- # We have to delay the runtime_mapping_rename until just before rootfs runs
- # otherwise, the multilib renaming could step in and squash any fixups that
- # may have occurred.
- pn = d.getVar('PN')
- runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
- runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
- runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
-
- # Generate the initial manifest
- create_manifest(d)
-
- progress_reporter.next_stage()
-
- # generate rootfs
- create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
-
- progress_reporter.finish()
-}
-do_rootfs[dirs] = "${TOPDIR}"
-do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
-do_rootfs[umask] = "022"
-addtask rootfs before do_build after do_prepare_recipe_sysroot
-
-fakeroot python do_image () {
- from oe.utils import execute_pre_post_process
-
- pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
-
- execute_pre_post_process(d, pre_process_cmds)
-}
-do_image[dirs] = "${TOPDIR}"
-do_image[umask] = "022"
-addtask do_image after do_rootfs before do_build
-
-fakeroot python do_image_complete () {
- from oe.utils import execute_pre_post_process
-
- post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")
-
- execute_pre_post_process(d, post_process_cmds)
-}
-do_image_complete[dirs] = "${TOPDIR}"
-do_image_complete[umask] = "022"
-SSTATETASKS += "do_image_complete"
-SSTATE_SKIP_CREATION_task-image-complete = '1'
-do_image_complete[sstate-inputdirs] = "${IMGDEPLOYDIR}"
-do_image_complete[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
-do_image_complete[stamp-extra-info] = "${MACHINE}"
-addtask do_image_complete after do_image before do_build
-
-# Add image-level QA/sanity checks to IMAGE_QA_COMMANDS
-#
-# IMAGE_QA_COMMANDS += " \
-# image_check_everything_ok \
-# "
-# This task runs all functions in IMAGE_QA_COMMANDS after the image
-# construction has completed in order to validate the resulting image.
-fakeroot python do_image_qa () {
- from oe.utils import ImageQAFailed
-
- qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split()
- qamsg = ""
-
- for cmd in qa_cmds:
- try:
- bb.build.exec_func(cmd, d)
- except oe.utils.ImageQAFailed as e:
- qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
- except bb.build.FuncFailed as e:
- qamsg = qamsg + '\tImage QA function %s failed' % e.name
- if e.logfile:
- qamsg = qamsg + ' (log file is located at %s)' % e.logfile
- qamsg = qamsg + '\n'
-
- if qamsg:
- imgname = d.getVar('IMAGE_NAME')
- bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg))
-}
-addtask do_image_qa after do_image_complete before do_build
-
-def setup_debugfs_variables(d):
- d.appendVar('IMAGE_ROOTFS', '-dbg')
- d.appendVar('IMAGE_LINK_NAME', '-dbg')
- d.appendVar('IMAGE_NAME','-dbg')
- d.setVar('IMAGE_BUILDING_DEBUGFS', 'true')
- debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS')
- if debugfs_image_fstypes:
- d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes)
-
-python setup_debugfs () {
- setup_debugfs_variables(d)
-}
-
-python () {
- vardeps = set()
- # We allow CONVERSIONTYPES to have duplicates. That avoids breaking
- # derived distros when OE-core or some other layer independently adds
- # the same type. There is still only one command for each type, but
- # presumably the commands will do the same when the type is the same,
- # even when added in different places.
- #
- # Without de-duplication, gen_conversion_cmds() below
- # would create the same compression command multiple times.
- ctypes = set(d.getVar('CONVERSIONTYPES').split())
- old_overrides = d.getVar('OVERRIDES', False)
-
- def _image_base_type(type):
- basetype = type
- for ctype in ctypes:
- if type.endswith("." + ctype):
- basetype = type[:-len("." + ctype)]
- break
-
- if basetype != type:
- # New base type itself might be generated by a conversion command.
- basetype = _image_base_type(basetype)
-
- return basetype
-
- basetypes = {}
- alltypes = d.getVar('IMAGE_FSTYPES').split()
- typedeps = {}
-
- if d.getVar('IMAGE_GEN_DEBUGFS') == "1":
- debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split()
- for t in debugfs_fstypes:
- alltypes.append("debugfs_" + t)
-
- def _add_type(t):
- baset = _image_base_type(t)
- input_t = t
- if baset not in basetypes:
- basetypes[baset]= []
- if t not in basetypes[baset]:
- basetypes[baset].append(t)
- debug = ""
- if t.startswith("debugfs_"):
- t = t[8:]
- debug = "debugfs_"
- deps = (d.getVar('IMAGE_TYPEDEP_' + t) or "").split()
- vardeps.add('IMAGE_TYPEDEP_' + t)
- if baset not in typedeps:
- typedeps[baset] = set()
- deps = [debug + dep for dep in deps]
- for dep in deps:
- if dep not in alltypes:
- alltypes.append(dep)
- _add_type(dep)
- basedep = _image_base_type(dep)
- typedeps[baset].add(basedep)
-
- if baset != input_t:
- _add_type(baset)
-
- for t in alltypes[:]:
- _add_type(t)
-
- d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps))
-
- maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split()
- maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")]
-
- for t in basetypes:
- vardeps = set()
- cmds = []
- subimages = []
- realt = t
-
- if t in maskedtypes:
- continue
-
- localdata = bb.data.createCopy(d)
- debug = ""
- if t.startswith("debugfs_"):
- setup_debugfs_variables(localdata)
- debug = "setup_debugfs "
- realt = t[8:]
- localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides))
- localdata.setVar('type', realt)
- # Delete DATETIME so we don't expand any references to it now
- # This means the task's hash can be stable rather than having hardcoded
- # date/time values. It will get expanded at execution time.
- # Similarly TMPDIR since otherwise we see QA stamp comparision problems
- localdata.delVar('DATETIME')
- localdata.delVar('TMPDIR')
-
- image_cmd = localdata.getVar("IMAGE_CMD")
- vardeps.add('IMAGE_CMD_' + realt)
- if image_cmd:
- cmds.append("\t" + image_cmd)
- else:
- bb.fatal("No IMAGE_CMD defined for IMAGE_FSTYPES entry '%s' - possibly invalid type name or missing support class" % t)
- cmds.append(localdata.expand("\tcd ${IMGDEPLOYDIR}"))
-
- # Since a copy of IMAGE_CMD_xxx will be inlined within do_image_xxx,
- # prevent a redundant copy of IMAGE_CMD_xxx being emitted as a function.
- d.delVarFlag('IMAGE_CMD_' + realt, 'func')
-
- rm_tmp_images = set()
- def gen_conversion_cmds(bt):
- for ctype in sorted(ctypes):
- if bt.endswith("." + ctype):
- type = bt[0:-len(ctype) - 1]
- if type.startswith("debugfs_"):
- type = type[8:]
- # Create input image first.
- gen_conversion_cmds(type)
- localdata.setVar('type', type)
- cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype) or localdata.getVar("COMPRESS_CMD_" + ctype))
- if cmd not in cmds:
- cmds.append(cmd)
- vardeps.add('CONVERSION_CMD_' + ctype)
- vardeps.add('COMPRESS_CMD_' + ctype)
- subimage = type + "." + ctype
- if subimage not in subimages:
- subimages.append(subimage)
- if type not in alltypes:
- rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
-
- for bt in basetypes[t]:
- gen_conversion_cmds(bt)
-
- localdata.setVar('type', realt)
- if t not in alltypes:
- rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
- else:
- subimages.append(realt)
-
- # Clean up after applying all conversion commands. Some of them might
- # use the same input, therefore we cannot delete sooner without applying
- # some complex dependency analysis.
- for image in sorted(rm_tmp_images):
- cmds.append("\trm " + image)
-
- after = 'do_image'
- for dep in typedeps[t]:
- after += ' do_image_%s' % dep.replace("-", "_").replace(".", "_")
-
- t = t.replace("-", "_").replace(".", "_")
-
- d.setVar('do_image_%s' % t, '\n'.join(cmds))
- d.setVarFlag('do_image_%s' % t, 'func', '1')
- d.setVarFlag('do_image_%s' % t, 'fakeroot', '1')
- d.setVarFlag('do_image_%s' % t, 'prefuncs', debug + 'set_image_size')
- d.setVarFlag('do_image_%s' % t, 'postfuncs', 'create_symlinks')
- d.setVarFlag('do_image_%s' % t, 'subimages', ' '.join(subimages))
- d.appendVarFlag('do_image_%s' % t, 'vardeps', ' '.join(vardeps))
- d.appendVarFlag('do_image_%s' % t, 'vardepsexclude', 'DATETIME')
-
- bb.debug(2, "Adding type %s before %s, after %s" % (t, 'do_image_complete', after))
- bb.build.addtask('do_image_%s' % t, 'do_image_complete', after, d)
-}
-
-#
-# Compute the rootfs size
-#
-def get_rootfs_size(d):
- import subprocess
-
- rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
- overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
- rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
- rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
- rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
- image_fstypes = d.getVar('IMAGE_FSTYPES') or ''
- initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or ''
- initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE')
-
- output = subprocess.check_output(['du', '-ks',
- d.getVar('IMAGE_ROOTFS')])
- size_kb = int(output.split()[0])
- base_size = size_kb * overhead_factor
- base_size = max(base_size, rootfs_req_size) + rootfs_extra_space
-
- if base_size != int(base_size):
- base_size = int(base_size + 1)
- else:
- base_size = int(base_size)
-
- base_size += rootfs_alignment - 1
- base_size -= base_size % rootfs_alignment
-
- # Do not check image size of the debugfs image. This is not supposed
- # to be deployed, etc. so it doesn't make sense to limit the size
- # of the debug.
- if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true":
- return base_size
-
- # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
- if rootfs_maxsize:
- rootfs_maxsize_int = int(rootfs_maxsize)
- if base_size > rootfs_maxsize_int:
- bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
- (base_size, rootfs_maxsize_int))
-
- # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
- if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
- initramfs_maxsize_int = int(initramfs_maxsize)
- if base_size > initramfs_maxsize_int:
- bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \
- (base_size, initramfs_maxsize_int))
- bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
- bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
- return base_size
-
-python set_image_size () {
- rootfs_size = get_rootfs_size(d)
- d.setVar('ROOTFS_SIZE', str(rootfs_size))
- d.setVarFlag('ROOTFS_SIZE', 'export', '1')
-}
-
-#
-# Create symlinks to the newly created image
-#
-python create_symlinks() {
-
- deploy_dir = d.getVar('IMGDEPLOYDIR')
- img_name = d.getVar('IMAGE_NAME')
- link_name = d.getVar('IMAGE_LINK_NAME')
- manifest_name = d.getVar('IMAGE_MANIFEST')
- taskname = d.getVar("BB_CURRENTTASK")
- subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
- imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.")
-
- if not link_name:
- return
- for type in subimages:
- dst = os.path.join(deploy_dir, link_name + "." + type)
- src = img_name + imgsuffix + type
- if os.path.exists(os.path.join(deploy_dir, src)):
- bb.note("Creating symlink: %s -> %s" % (dst, src))
- if os.path.islink(dst):
- os.remove(dst)
- os.symlink(src, dst)
- else:
- bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
-}
-
-MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"
-MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
-MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
-
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
-deltask do_populate_sysroot
-do_package[noexec] = "1"
-deltask do_package_qa
-do_packagedata[noexec] = "1"
-do_package_write_ipk[noexec] = "1"
-do_package_write_deb[noexec] = "1"
-do_package_write_rpm[noexec] = "1"
-
-# Allow the kernel to be repacked with the initramfs and boot image file as a single file
-do_bundle_initramfs[depends] += "virtual/kernel:do_bundle_initramfs"
-do_bundle_initramfs[nostamp] = "1"
-do_bundle_initramfs[noexec] = "1"
-do_bundle_initramfs () {
- :
-}
-addtask bundle_initramfs after do_image_complete
diff --git a/meta-agl-bsp/classes/sdcard_image-rpi.bbclass b/meta-agl-bsp/classes/sdcard_image-rpi.bbclass
deleted file mode 100644
index c22a6f880..000000000
--- a/meta-agl-bsp/classes/sdcard_image-rpi.bbclass
+++ /dev/null
@@ -1,184 +0,0 @@
-inherit image_types
-inherit linux-raspberrypi-base
-
-#
-# Create an image that can by written onto a SD card using dd.
-#
-# The disk layout used is:
-#
-# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved for other data
-# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - bootloader and kernel
-# BOOT_SPACE -> SDIMG_SIZE - rootfs
-#
-
-# Default Free space = 1.3x
-# Use IMAGE_OVERHEAD_FACTOR to add more space
-# <--------->
-# 4MiB 40MiB SDIMG_ROOTFS
-# <-----------------------> <----------> <---------------------->
-# ------------------------ ------------ ------------------------
-# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE |
-# ------------------------ ------------ ------------------------
-# ^ ^ ^ ^
-# | | | |
-# 0 4MiB 4MiB + 40MiB 4MiB + 40Mib + SDIMG_ROOTFS
-
-# This image depends on the rootfs image
-IMAGE_TYPEDEP_rpi-sdimg = "${SDIMG_ROOTFS_TYPE}"
-
-# Set kernel and boot loader
-IMAGE_BOOTLOADER ?= "bcm2835-bootfiles"
-
-# Set initramfs extension
-KERNEL_INITRAMFS ?= ""
-
-# Kernel image name
-SDIMG_KERNELIMAGE_raspberrypi ?= "kernel.img"
-SDIMG_KERNELIMAGE_raspberrypi2 ?= "kernel7.img"
-SDIMG_KERNELIMAGE_raspberrypi3-64 ?= "kernel8.img"
-
-# Boot partition volume id
-BOOTDD_VOLUME_ID ?= "${MACHINE}"
-
-# Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT)
-BOOT_SPACE ?= "40960"
-
-# Set alignment to 4MB [in KiB]
-IMAGE_ROOTFS_ALIGNMENT = "4096"
-
-# Use an uncompressed ext3 by default as rootfs
-SDIMG_ROOTFS_TYPE ?= "ext3"
-SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.${SDIMG_ROOTFS_TYPE}"
-
-IMAGE_DEPENDS_rpi-sdimg = " \
- parted-native \
- mtools-native \
- dosfstools-native \
- virtual/kernel:do_deploy \
- ${IMAGE_BOOTLOADER} \
- ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot', '',d)} \
- "
-
-# SD card image name
-SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
-
-# Compression method to apply to SDIMG after it has been created. Supported
-# compression formats are "gzip", "bzip2" or "xz". The original .rpi-sdimg file
-# is kept and a new compressed file is created if one of these compression
-# formats is chosen. If SDIMG_COMPRESSION is set to any other value it is
-# silently ignored.
-#SDIMG_COMPRESSION ?= ""
-
-# Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
-FATPAYLOAD ?= ""
-
-IMAGE_CMD_rpi-sdimg () {
-
- # Align partitions
- BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1)
- BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
- SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE)
-
- echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
-
- # Check if we are building with device tree support
- DTS="${@get_dts(d)}"
-
- # Initialize sdcard image file
- dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
-
- # Create partition table
- parted -s ${SDIMG} mklabel msdos
- # Create boot partition and mark it as bootable
- parted -s ${SDIMG} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT})
- parted -s ${SDIMG} set 1 boot on
- # Create rootfs partition to the end of disk
- parted -s ${SDIMG} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s
- parted ${SDIMG} print
-
- # Create a vfat image with boot files
- BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
- rm -f ${WORKDIR}/boot.img
- mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/
- if test -n "${DTS}"; then
- # Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' (4.1.x) or by '.dtbo' (4.4.9+) string and will be put in a dedicated folder
- DT_OVERLAYS="${@split_overlays(d, 0)}"
- DT_ROOT="${@split_overlays(d, 1)}"
-
- # Copy board device trees to root folder
- for DTB in ${DT_ROOT}; do
- DTB_BASE_NAME=`basename ${DTB} .dtb`
-
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::${DTB_BASE_NAME}.dtb
- done
-
- # Copy device tree overlays to dedicated folder
- mmd -i ${WORKDIR}/boot.img overlays
- for DTB in ${DT_OVERLAYS}; do
- DTB_EXT=${DTB##*.}
- DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
-
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
- done
- fi
- case "${KERNEL_IMAGETYPE}" in
- "uImage")
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage
- mcopy -o -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
- ;;
- *)
- mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
- ;;
- esac
-
- if [ -n ${FATPAYLOAD} ] ; then
- echo "Copying payload into VFAT"
- for entry in ${FATPAYLOAD} ; do
- # add the || true to stop aborting on vfat issues like not supporting .~lock files
- mcopy -i ${WORKDIR}/boot.img -s -v ${IMAGE_ROOTFS}$entry :: || true
- done
- fi
-
- # Add stamp file
- echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info
- mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
-
- # Burn Partitions
- dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
- # If SDIMG_ROOTFS_TYPE is a .xz file use xzcat
- if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz"
- then
- xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
- else
- dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
- fi
-
- # Optionally apply compression
- case "${SDIMG_COMPRESSION}" in
- "gzip")
- gzip -k9 "${SDIMG}"
- ;;
- "bzip2")
- bzip2 -k9 "${SDIMG}"
- ;;
- "xz")
- xz -k "${SDIMG}"
- ;;
- esac
-}
-
-ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; "
-
-rpi_generate_sysctl_config() {
- # systemd sysctl config
- test -d ${IMAGE_ROOTFS}${sysconfdir}/sysctl.d && \
- echo "vm.min_free_kbytes = 8192" > ${IMAGE_ROOTFS}${sysconfdir}/sysctl.d/rpi-vm.conf
-
- # sysv sysctl config
- IMAGE_SYSCTL_CONF="${IMAGE_ROOTFS}${sysconfdir}/sysctl.conf"
- test -e ${IMAGE_ROOTFS}${sysconfdir}/sysctl.conf && \
- sed -e "/vm.min_free_kbytes/d" -i ${IMAGE_SYSCTL_CONF}
- echo "" >> ${IMAGE_SYSCTL_CONF} && echo "vm.min_free_kbytes = 8192" >> ${IMAGE_SYSCTL_CONF}
-}
diff --git a/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc b/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc
index f5e85100d..02ddb6c9d 100644
--- a/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc
+++ b/meta-agl-bsp/conf/include/agl_dra7xx-evm.inc
@@ -24,7 +24,9 @@ PREFERRED_VERSION_libgbm = "10.0.0"
## Multimedia section ##
#-------------------------------------------------
-GSTREAMER_PLUGINS = " \
+# FIXME
+GSTREAMER_PLUGINS = ""
+DISABLED_ROCKO_GSTREAMER_PLUGINS = " \
gstreamer1.0-plugins-bad-meta \
gstreamer1.0-plugins-ducati \
gstreamer1.0-plugins-vpe \
diff --git a/meta-agl-bsp/conf/include/agl_h3ulcb.inc b/meta-agl-bsp/conf/include/agl_h3ulcb.inc
index e38cdc70f..e2ebd85c6 100644
--- a/meta-agl-bsp/conf/include/agl_h3ulcb.inc
+++ b/meta-agl-bsp/conf/include/agl_h3ulcb.inc
@@ -1,5 +1,8 @@
SOC_FAMILY = "r8a7795"
+# Enable AGL virtualization features
+MACHINE_FEATURES_append = " agl-egvirt"
+
# for Wayland/Weston weston-laucher
DISTRO_FEATURES_append = " pam"
@@ -16,19 +19,14 @@ PREFERRED_PROVIDER_virtual/mesa = "mesa"
PREFERRED_PROVIDER_libgbm = "libgbm"
PREFERRED_RPROVIDER_libgbm-dev = "libgbm"
+PREFERRED_RPROVIDER_libomxil = "omx-user-module"
+
# Mask the gstreamer recipe for MMP
BBMASK = "meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer"
# Add for gstreamer plugins ugly
LICENSE_FLAGS_WHITELIST = "commercial"
-PREFERRED_VERSION_gstreamer1.0 = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-libav = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-base = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-bad = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-good = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-ugly = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-vspfilter = "1.0%"
MACHINE_FEATURES_append = " multimedia"
@@ -48,7 +46,6 @@ IMAGE_INSTALL_append_rcar-gen3 = " \
omx-user-module \
"
-BBMASK .= "|meta-renesas-rcar-gen3/meta-rcar-gen3/recipes-forward-port/"
OSTREE_BOOTLOADER ?= "u-boot"
WKS_FILE = "singlepart-noloader.wks"
diff --git a/meta-agl-bsp/conf/include/agl_m3ulcb.inc b/meta-agl-bsp/conf/include/agl_m3ulcb.inc
index 808f74e3b..cce7dbd5e 100644
--- a/meta-agl-bsp/conf/include/agl_m3ulcb.inc
+++ b/meta-agl-bsp/conf/include/agl_m3ulcb.inc
@@ -19,19 +19,14 @@ PREFERRED_PROVIDER_virtual/mesa = "mesa"
PREFERRED_PROVIDER_libgbm = "libgbm"
PREFERRED_RPROVIDER_libgbm-dev = "libgbm"
+PREFERRED_RPROVIDER_libomxil = "omx-user-module"
+
# Mask the gstreamer recipe for MMP
BBMASK = "meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer"
# Add for gstreamer plugins ugly
LICENSE_FLAGS_WHITELIST = "commercial"
-PREFERRED_VERSION_gstreamer1.0 = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-libav = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-base = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-bad = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-good = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-ugly = "1.6.3"
-PREFERRED_VERSION_gstreamer1.0-plugins-vspfilter = "1.0%"
MACHINE_FEATURES_append = " multimedia"
@@ -51,8 +46,6 @@ IMAGE_INSTALL_append_rcar-gen3 = " \
omx-user-module \
"
-BBMASK .= "|meta-renesas-rcar-gen3/meta-rcar-gen3/recipes-forward-port/"
-
DISTRO_FEATURES_append = " sota"
OSTREE_KERNEL = "Image"
IMAGE_BOOT_FILES_sota = "m3ulcb-ota-bootfiles/* Image-r8a7796-m3ulcb.dtb"
diff --git a/meta-agl-bsp/conf/include/agl_qemux86-64.inc b/meta-agl-bsp/conf/include/agl_qemux86-64.inc
index 3ad9c513f..165deae41 100644
--- a/meta-agl-bsp/conf/include/agl_qemux86-64.inc
+++ b/meta-agl-bsp/conf/include/agl_qemux86-64.inc
@@ -21,7 +21,8 @@ APPEND += "quiet"
DISTRO_FEATURES_append = " sota"
# Image support
-AGL_EXTRA_IMAGE_FSTYPES = "vmdk.xz"
+AGL_EXTRA_IMAGE_FSTYPES = "wic.vmdk"
+IMAGE_BOOT_FILES_sota = "u-boot-qemux86-64.rom"
# Root device
ROOT_VM = "root=PARTUUID=${DISK_SIGNATURE}-02"
diff --git a/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary/0001-6x_bootscript-Make-bootscript-compatible-with-WIC-an.patch b/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary/0001-6x_bootscript-Make-bootscript-compatible-with-WIC-an.patch
deleted file mode 100644
index 9eba21a88..000000000
--- a/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary/0001-6x_bootscript-Make-bootscript-compatible-with-WIC-an.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From f1c5c08ea5606b358b30b459c74aa932796ded3c Mon Sep 17 00:00:00 2001
-From: Mihail Grigorov <michael.grigorov@konsulko.com>
-Date: Wed, 10 Jan 2018 10:30:14 +0200
-Subject: [PATCH] 6x_bootscript: Make bootscript compatible with WIC and SDCARD
- images
-
-a) Get partition 2 UUID,
-in case of error, points the boot directory to /boot
-otherwise /
-
-b) Modify DTB/hdmi to use 1920x1080
-
-Signed-off-by: Mihail Grigorov <michael.grigorov@konsulko.com>
----
- .../nitrogen6x/6x_bootscript-yocto-3.14.txt | 21 +++++++++++++++++----
- 1 file changed, 17 insertions(+), 4 deletions(-)
-
-diff --git a/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt b/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt
-index f6bf2f5289..250310e37f 100644
---- a/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt
-+++ b/board/boundary/nitrogen6x/6x_bootscript-yocto-3.14.txt
-@@ -48,6 +48,17 @@ if itest.s "x" == "x${dtbname}" ; then
- fi
- fi
-
-+setenv cmd_hdmi 'fdt set fb_hdmi status okay;fdt set fb_hdmi mode_str 1920x1080M@60;'
-+
-+setenv p2uuid 'x'
-+part uuid ${dtype} ${disk}:2 p2uuid
-+
-+if itest.s ${p2uuid} == 'x'; then
-+ bpart=1;
-+else
-+ bpart=2;
-+fi
-+
- if itest.s x${bootpart} == x ; then
- bootpart=1
- fi
-@@ -58,7 +69,11 @@ fi
- setenv bootargs ${bootargs} console=${console},115200 vmalloc=400M consoleblank=0 rootwait fixrtc cpu=${cpu} board=${board}
-
- if itest.s x == x${bootdir} ; then
-- bootdir=/
-+ bootdir=/;
-+fi
-+
-+if itest.s ${bpart} == '1'; then
-+ bootdir=/boot/;
- fi
-
- if load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname} ; then
-@@ -116,8 +131,6 @@ if itest.s "x" == "x${cmd_xxx_present}" ; then
- echo "!!!!!!!!!!!!!!!!"
- fi
-
--bpart=2
--
- if test "sata" = "${dtype}" ; then
- setenv bootargs "${bootargs} root=/dev/sda${bpart}" ;
- elif test "usb" = "${dtype}" ; then
-@@ -167,7 +180,7 @@ if itest.s "x" != "x${show_env}" ; then
- printenv
- fi
-
--if load ${dtype} ${disk}:${bootpart} ${a_zImage} /zImage ; then
-+if load ${dtype} ${disk}:${bootpart} ${a_zImage} ${bootdir}/zImage ; then
- bootz ${a_zImage} - ${a_fdt}
- fi
- echo "Error loading kernel image"
---
-2.11.0
-
diff --git a/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary_git.bbappend b/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary_git.bbappend
deleted file mode 100644
index ca9cb4f94..000000000
--- a/meta-agl-bsp/meta-boundary/recipes-bsp/u-boot/u-boot-script-boundary_git.bbappend
+++ /dev/null
@@ -1,6 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
-
-SRC_URI += " \
- file://0001-6x_bootscript-Make-bootscript-compatible-with-WIC-an.patch \
-"
-
diff --git a/meta-agl-bsp/meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend b/meta-agl-bsp/meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend
deleted file mode 100644
index 88ac94b15..000000000
--- a/meta-agl-bsp/meta-boundary/recipes-kernel/linux/linux-boundary_4.1.15.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-require recipes-kernel/linux/linux-agl.inc
diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend
index 5d5549f0a..3da7180e6 100644
--- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend
+++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend
@@ -13,6 +13,6 @@ KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cgroup.cfg"
#-------------------------------------------------------------------------
# smack patches for handling bluetooth
-SRC_URI_append_smack = "\
+SRC_URI_append_with-lsm-smack = "\
file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \
"
diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux-firmware/linux-firmware_git.bbappend b/meta-agl-bsp/meta-intel/recipes-kernel/linux-firmware/linux-firmware_git.bbappend
index a34159cad..824f39359 100644
--- a/meta-agl-bsp/meta-intel/recipes-kernel/linux-firmware/linux-firmware_git.bbappend
+++ b/meta-agl-bsp/meta-intel/recipes-kernel/linux-firmware/linux-firmware_git.bbappend
@@ -1,8 +1,3 @@
-LICENSE_${PN}-ibt-license = "Firmware-ibt_firmware"
-LICENSE_${PN}-ibt-11-5 = "Firmware-ibt_firmware"
-FILES_${PN}-ibt-license = "/lib/firmware/LICENCE.ibt_firmware"
FILES_${PN}-ibt = "/lib/firmware/intel"
RDEPENDS_${PN}-ibt += "${PN}-ibt-license"
-
-PACKAGES =+ " ${PN}-ibt-license ${PN}-ibt "
diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/net-devices.cfg b/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/net-devices.cfg
new file mode 100644
index 000000000..9d5329a8f
--- /dev/null
+++ b/meta-agl-bsp/meta-intel/recipes-kernel/linux/files/net-devices.cfg
@@ -0,0 +1 @@
+CONFIG_IGB=y
diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.9%.bbappend b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.9%.bbappend
index 361abad32..7f249f207 100644
--- a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.9%.bbappend
+++ b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-intel_4.9%.bbappend
@@ -10,6 +10,10 @@ KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/usb-devices.cfg"
SRC_URI_append = " file://extra-graphic-devices.cfg"
KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/extra-graphic-devices.cfg"
+# adding internal network in kernel for network boot
+SRC_URI_append = " file://net-devices.cfg"
+KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/net-devices.cfg"
+
# Ensure we have a startup.nsh file
SRC_URI_append = " file://startup.nsh"
diff --git a/meta-agl-bsp/meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend b/meta-agl-bsp/meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend
deleted file mode 100644
index 2a590838b..000000000
--- a/meta-agl-bsp/meta-openembedded-layer/recipes-devtools/lua/lua_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-BBCLASSEXTEND += "nativesdk"
diff --git a/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.7.bb b/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.11.bb
index 36a983198..5c3583526 100644
--- a/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.7.bb
+++ b/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.11.bb
@@ -5,16 +5,18 @@ SECTION = "devel"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
-SRCREV = "193f355823d9dc38f370759153ac950a2833b0e2"
+SRCREV = "395b5994a5fa52f9db10f480fce74e9acdbe3318"
SRC_URI = "git://github.com/96boards/96boards-tools;branch=master;protocol=https"
S = "${WORKDIR}/git"
-inherit systemd allarch
+inherit systemd allarch update-rc.d
do_install () {
install -d ${D}${sysconfdir}/udev/rules.d
install -m 0755 ${S}/*.rules ${D}${sysconfdir}/udev/rules.d/
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${S}/resize-disk ${D}${sysconfdir}/init.d/
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${S}/resize-helper.service ${D}${systemd_unitdir}/system
@@ -23,5 +25,8 @@ do_install () {
install -m 0755 ${S}/resize-helper ${D}${sbindir}
}
+INITSCRIPT_NAME = "resize-disk"
+INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
+
SYSTEMD_SERVICE_${PN} = "resize-helper.service"
RDEPENDS_${PN} += "e2fsprogs-resize2fs gptfdisk parted util-linux udev"
diff --git a/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.9.bbappend b/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.14.bbappend
index 17c8f3f0d..0b2b99d4d 100644
--- a/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.9.bbappend
+++ b/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_4.14.bbappend
@@ -1,4 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
require recipes-kernel/linux/linux-agl.inc
-require recipes-kernel/linux/linux-agl-4.9.inc
diff --git a/meta-agl-bsp/meta-qcom/recipes-kernel/most/most.bbappend b/meta-agl-bsp/meta-qcom/recipes-kernel/most/most.bbappend
new file mode 100644
index 000000000..6b4444a4e
--- /dev/null
+++ b/meta-agl-bsp/meta-qcom/recipes-kernel/most/most.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_remove = " \
+ file://0001-src-most-net-add-skb_put_data-function.patch \
+ "
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/files/0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/files/0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch
deleted file mode 100644
index 2cab87f9e..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/files/0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 90916f96262fa7b27a0a99788c69f9fd6df11000 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Tue, 24 Nov 2015 16:46:27 +0200
-Subject: [PATCH] introspection.m4: prefix pkgconfig paths with
- PKG_CONFIG_SYSROOT_DIR
-
-We can't use our tweaked introspection.m4 from gobject-introspection tarball
-because gstreamer also defines INTROSPECTION_INIT in its introspection.m4, which
-is later supplied to g-ir-scanner.
-
-Upstream-Status: Pending [review on oe-core list]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- common/m4/introspection.m4 | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/common/m4/introspection.m4 b/common/m4/introspection.m4
-index 162be57..217a6ae 100644
---- a/common/m4/introspection.m4
-+++ b/common/m4/introspection.m4
-@@ -54,14 +54,14 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
- INTROSPECTION_GIRDIR=
- INTROSPECTION_TYPELIBDIR=
- if test "x$found_introspection" = "xyes"; then
-- INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-- INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-- INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
-+ INTROSPECTION_SCANNER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-+ INTROSPECTION_COMPILER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-+ INTROSPECTION_GENERATE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
- INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
- INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
- INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
- INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
-- INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
-+ INTROSPECTION_MAKEFILE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
- INTROSPECTION_INIT="extern void gst_init(gint*,gchar**); gst_init(NULL,NULL);"
- fi
- AC_SUBST(INTROSPECTION_SCANNER)
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Add-error-signal-emission-for-missing-plugins.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Add-error-signal-emission-for-missing-plugins.patch
deleted file mode 100644
index 712d46daa..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Add-error-signal-emission-for-missing-plugins.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-From d64c7edb66f4a64ff49c4306cf77fd269b7079ab Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Mon, 16 Mar 2015 13:45:30 +0200
-Subject: [PATCH] Add error signal emission for missing plugins
-
-Add a missing plugins error signal to gst-player. Note that this error
-does not necessarily mean the playback has completely failed, but in
-practice the user experience will be bad (think, e.g. of a mp4 file
-where H.264 codec is missing: AAC playback still works...).
-
-Use the signal in gtk-play to show a infobar if plugins are missing.
-
-Submitted upstream at https://github.com/sdroege/gst-player/pull/11
-
-Upstream-Status: Submitted
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
----
- configure.ac | 2 +-
- gtk/gtk-play.c | 54 +++++++++++++++++++++++++++++++++++++++++++++-
- lib/gst/player/gstplayer.c | 22 +++++++++++++++++++
- lib/gst/player/gstplayer.h | 3 ++-
- 4 files changed, 78 insertions(+), 3 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 90ab74c..6cdb4eb 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -53,7 +53,7 @@ AC_SUBST(LT_AGE)
- PKG_PROG_PKG_CONFIG
-
- PKG_CHECK_MODULES(GLIB, [glib-2.0 gobject-2.0])
--PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0 >= 1.4 gstreamer-video-1.0 >= 1.4])
-+PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0 >= 1.4 gstreamer-video-1.0 >= 1.4 gstreamer-pbutils-1.0])
-
- GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
- AC_SUBST(GLIB_PREFIX)
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index b92773b..e2b605a 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -30,6 +30,8 @@ typedef struct
- GtkWidget *prev_button, *next_button;
- GtkWidget *seekbar;
- GtkWidget *video_area;
-+ GtkWidget *info_label;
-+ GtkWidget *info_bar;
- GtkWidget *volume_button;
- gulong seekbar_value_changed_signal_id;
- gboolean playing;
-@@ -141,6 +143,13 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
- }
-
- static void
-+clear_missing_plugins (GtkPlay * play)
-+{
-+ gtk_label_set_text (GTK_LABEL (play->info_label), "");
-+ gtk_widget_hide (play->info_bar);
-+}
-+
-+static void
- skip_prev_clicked_cb (GtkButton * button, GtkPlay * play)
- {
- GList *prev;
-@@ -155,6 +164,7 @@ skip_prev_clicked_cb (GtkButton * button, GtkPlay * play)
-
- gtk_widget_set_sensitive (play->next_button, TRUE);
- gst_player_set_uri (play->player, prev->data);
-+ clear_missing_plugins (play);
- gst_player_play (play->player);
- set_title (play, prev->data);
- gtk_widget_set_sensitive (play->prev_button, g_list_previous (prev) != NULL);
-@@ -175,6 +185,7 @@ skip_next_clicked_cb (GtkButton * button, GtkPlay * play)
-
- gtk_widget_set_sensitive (play->prev_button, TRUE);
- gst_player_set_uri (play->player, next->data);
-+ clear_missing_plugins (play);
- gst_player_play (play->player);
- set_title (play, next->data);
- gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
-@@ -193,10 +204,16 @@ volume_changed_cb (GtkScaleButton * button, gdouble value, GtkPlay * play)
- gst_player_set_volume (play->player, value);
- }
-
-+void
-+info_bar_response_cb (GtkInfoBar * bar, gint response, GtkPlay * play)
-+{
-+ gtk_widget_hide (GTK_WIDGET (bar));
-+}
-+
- static void
- create_ui (GtkPlay * play)
- {
-- GtkWidget *controls, *main_hbox, *main_vbox;
-+ GtkWidget *controls, *main_hbox, *main_vbox, *info_bar, *content_area;
-
- play->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (play->window), "delete-event",
-@@ -208,6 +225,20 @@ create_ui (GtkPlay * play)
- g_signal_connect (play->video_area, "realize",
- G_CALLBACK (video_area_realize_cb), play);
-
-+ play->info_bar = gtk_info_bar_new ();
-+ gtk_info_bar_set_message_type (GTK_INFO_BAR (play->info_bar),
-+ GTK_MESSAGE_WARNING);
-+ //gtk_info_bar_set_show_close_button (GTK_INFO_BAR (play->info_bar),
-+ // TRUE);
-+ gtk_widget_set_no_show_all (play->info_bar, TRUE);
-+ g_signal_connect (play->info_bar, "response",
-+ G_CALLBACK (info_bar_response_cb), play);
-+
-+ content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (play->info_bar));
-+ play->info_label = gtk_label_new ("");
-+ gtk_container_add (GTK_CONTAINER (content_area), play->info_label);
-+ gtk_widget_show (play->info_label);
-+
- /* Unified play/pause button */
- play->play_pause_button =
- gtk_button_new_from_icon_name ("media-playback-pause",
-@@ -258,6 +289,7 @@ create_ui (GtkPlay * play)
-
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, TRUE, 0);
-+ gtk_box_pack_start (GTK_BOX (main_vbox), play->info_bar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (main_vbox), controls, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (play->window), main_vbox);
-
-@@ -322,6 +354,7 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
- gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
-
- gst_player_set_uri (play->player, next->data);
-+ clear_missing_plugins (play);
- gst_player_play (play->player);
- set_title (play, next->data);
- } else {
-@@ -330,6 +363,24 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
- }
- }
-
-+static void
-+error_cb (GstPlayer * player, GError * err, GtkPlay * play)
-+{
-+ char *message;
-+
-+ if (g_error_matches (err, gst_player_error_quark (),
-+ GST_PLAYER_ERROR_MISSING_PLUGIN)) {
-+ // add message to end of any existing message: there may be
-+ // multiple missing plugins.
-+ message = g_strdup_printf ("%s%s. ",
-+ gtk_label_get_text (GTK_LABEL (play->info_label)), err->message);
-+ gtk_label_set_text (GTK_LABEL (play->info_label), message);
-+ g_free (message);
-+
-+ gtk_widget_show (play->info_bar);
-+ }
-+}
-+
- int
- main (gint argc, gchar ** argv)
- {
-@@ -422,6 +473,7 @@ main (gint argc, gchar ** argv)
- g_signal_connect (play.player, "video-dimensions-changed",
- G_CALLBACK (video_dimensions_changed_cb), &play);
- g_signal_connect (play.player, "end-of-stream", G_CALLBACK (eos_cb), &play);
-+ g_signal_connect (play.player, "error", G_CALLBACK (error_cb), &play);
-
- /* We have file(s) that need playing. */
- set_title (&play, g_list_first (play.uris)->data);
-diff --git a/lib/gst/player/gstplayer.c b/lib/gst/player/gstplayer.c
-index bd682d9..78e7ba1 100644
---- a/lib/gst/player/gstplayer.c
-+++ b/lib/gst/player/gstplayer.c
-@@ -47,6 +47,7 @@
-
- #include <gst/gst.h>
- #include <gst/video/video.h>
-+#include <gst/pbutils/missing-plugins.h>
-
- GST_DEBUG_CATEGORY_STATIC (gst_player_debug);
- #define GST_CAT_DEFAULT gst_player_debug
-@@ -238,6 +239,7 @@ gst_player_class_init (GstPlayerClass * klass)
- g_signal_new ("video-dimensions-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-+
- }
-
- static void
-@@ -619,6 +621,21 @@ error_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
- g_mutex_unlock (&self->priv->lock);
- }
-
-+static void
-+element_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
-+{
-+ GstPlayer *self = GST_PLAYER (user_data);
-+
-+ if (gst_is_missing_plugin_message (msg)) {
-+ gchar *desc;
-+
-+ desc = gst_missing_plugin_message_get_description (msg);
-+ emit_error (self, g_error_new (GST_PLAYER_ERROR,
-+ GST_PLAYER_ERROR_MISSING_PLUGIN, "Missing plugin '%s'", desc));
-+ g_free (desc);
-+ }
-+}
-+
- static gboolean
- eos_dispatch (gpointer user_data)
- {
-@@ -1059,6 +1076,8 @@ gst_player_main (gpointer data)
- NULL, NULL);
- g_source_attach (bus_source, self->priv->context);
-
-+ g_signal_connect (G_OBJECT (bus), "message::element",
-+ G_CALLBACK (element_cb), self);
- g_signal_connect (G_OBJECT (bus), "message::error", G_CALLBACK (error_cb),
- self);
- g_signal_connect (G_OBJECT (bus), "message::eos", G_CALLBACK (eos_cb), self);
-@@ -1560,6 +1579,7 @@ gst_player_error_get_type (void)
- static gsize id = 0;
- static const GEnumValue values[] = {
- {C_ENUM (GST_PLAYER_ERROR_FAILED), "GST_PLAYER_ERROR_FAILED", "failed"},
-+ {C_ENUM (GST_PLAYER_ERROR_MISSING_PLUGIN), "GST_PLAYER_ERROR_MISSING_PLUGIN", "missing-plugin"},
- {0, NULL, NULL}
- };
-
-@@ -1577,6 +1597,8 @@ gst_player_error_get_name (GstPlayerError error)
- switch (error) {
- case GST_PLAYER_ERROR_FAILED:
- return "failed";
-+ case GST_PLAYER_ERROR_MISSING_PLUGIN:
-+ return "missing-plugin";
- }
-
- g_assert_not_reached ();
-diff --git a/lib/gst/player/gstplayer.h b/lib/gst/player/gstplayer.h
-index c438513..35fb5bb 100644
---- a/lib/gst/player/gstplayer.h
-+++ b/lib/gst/player/gstplayer.h
-@@ -44,7 +44,8 @@ GType gst_player_error_get_type (void);
- #define GST_TYPE_PLAYER_ERROR (gst_player_error_get_type ())
-
- typedef enum {
-- GST_PLAYER_ERROR_FAILED = 0
-+ GST_PLAYER_ERROR_FAILED = 0,
-+ GST_PLAYER_ERROR_MISSING_PLUGIN
- } GstPlayerError;
-
- const gchar *gst_player_error_get_name (GstPlayerError error);
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Fix-pause-play.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Fix-pause-play.patch
deleted file mode 100644
index 783c42ad7..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/Fix-pause-play.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Fix pause/play
-
-The current player state is now notified via the state-changed signal,
-and in the GTK UI it was only used to keep track of the desired state.
-
-This is a backport of upstream commit 738479c7a0.
-
-Upstream-Status: Backport
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
-
----
- gtk/gtk-play.c | 8 ++++++--
- lib/gst/player/gstplayer.c | 12 ------------
- lib/gst/player/gstplayer.h | 2 --
- 3 files changed, 6 insertions(+), 16 deletions(-)
-
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index 6e7a098..e2b605a 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -34,6 +34,7 @@ typedef struct
- GtkWidget *info_bar;
- GtkWidget *volume_button;
- gulong seekbar_value_changed_signal_id;
-+ gboolean playing;
- } GtkPlay;
-
- /* Compat stubs */
-@@ -118,12 +119,13 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
- {
- GtkWidget *image;
-
-- if (gst_player_is_playing (play->player)) {
-+ if (play->playing) {
- gst_player_pause (play->player);
- image =
- gtk_image_new_from_icon_name ("media-playback-start",
- GTK_ICON_SIZE_BUTTON);
- gtk_button_set_image (GTK_BUTTON (play->play_pause_button), image);
-+ play->playing = FALSE;
- } else {
- gchar *title;
-
-@@ -136,6 +138,7 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
- title = gst_player_get_uri (play->player);
- set_title (play, title);
- g_free (title);
-+ play->playing = TRUE;
- }
- }
-
-@@ -335,7 +338,7 @@ video_dimensions_changed_cb (GstPlayer * unused, gint width, gint height,
- static void
- eos_cb (GstPlayer * unused, GtkPlay * play)
- {
-- if (gst_player_is_playing (play->player)) {
-+ if (play->playing) {
- GList *next = NULL;
- gchar *uri;
-
-@@ -452,6 +455,7 @@ main (gint argc, gchar ** argv)
- }
-
- play.player = gst_player_new ();
-+ play.playing = TRUE;
-
- g_object_set (play.player, "dispatch-to-main-context", TRUE, NULL);
-
-diff --git a/lib/gst/player/gstplayer.c b/lib/gst/player/gstplayer.c
-index 069b284..78e7ba1 100644
---- a/lib/gst/player/gstplayer.c
-+++ b/lib/gst/player/gstplayer.c
-@@ -1422,18 +1422,6 @@ gst_player_set_uri (GstPlayer * self, const gchar * val)
- g_object_set (self, "uri", val, NULL);
- }
-
--gboolean
--gst_player_is_playing (GstPlayer * self)
--{
-- gboolean val;
--
-- g_return_val_if_fail (GST_IS_PLAYER (self), FALSE);
--
-- g_object_get (self, "is-playing", &val, NULL);
--
-- return val;
--}
--
- GstClockTime
- gst_player_get_position (GstPlayer * self)
- {
-diff --git a/lib/gst/player/gstplayer.h b/lib/gst/player/gstplayer.h
-index 6933dd7..35fb5bb 100644
---- a/lib/gst/player/gstplayer.h
-+++ b/lib/gst/player/gstplayer.h
-@@ -93,8 +93,6 @@ gchar * gst_player_get_uri (GstPlayer * player);
- void gst_player_set_uri (GstPlayer * player,
- const gchar * uri);
-
--gboolean gst_player_is_playing (GstPlayer * player);
--
- GstClockTime gst_player_get_position (GstPlayer * player);
- GstClockTime gst_player_get_duration (GstPlayer * player);
-
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/filechooser.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/filechooser.patch
deleted file mode 100644
index 7bf1b034b..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/filechooser.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From 43d4b19ab611d844156e26c4840cc54ddb73ae03 Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@intel.com>
-Date: Thu, 26 Feb 2015 17:17:05 +0000
-Subject: [PATCH] gtk-play: show a file chooser if no URIs were passed
-
----
- gtk/gtk-play.c | 28 ++++++++++++++++++++++++++--
- 1 file changed, 26 insertions(+), 2 deletions(-)
-
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index f015077..9766a72 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -319,8 +319,32 @@ main (gint argc, gchar ** argv)
- // FIXME: Add support for playlists and stuff
- /* Parse the list of the file names we have to play. */
- if (!file_names) {
-- g_print ("Usage: %s FILE(s)|URI(s)\n", APP_NAME);
-- return 1;
-+ GtkWidget *chooser;
-+ int res;
-+
-+ chooser = gtk_file_chooser_dialog_new ("Select files to play", NULL,
-+ GTK_FILE_CHOOSER_ACTION_OPEN,
-+ "_Cancel", GTK_RESPONSE_CANCEL,
-+ "_Open", GTK_RESPONSE_ACCEPT,
-+ NULL);
-+ g_object_set (chooser,
-+ "local-only", FALSE,
-+ "select-multiple", TRUE,
-+ NULL);
-+
-+ res = gtk_dialog_run (GTK_DIALOG (chooser));
-+ if (res == GTK_RESPONSE_ACCEPT) {
-+ GSList *l;
-+
-+ l = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (chooser));
-+ while (l) {
-+ play.uris = g_list_append (play.uris, l->data);
-+ l = g_slist_delete_link (l, l);
-+ }
-+ } else {
-+ return 0;
-+ }
-+ gtk_widget_destroy (chooser);
- } else {
- guint i;
-
---
-1.7.10.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gst-player.desktop b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gst-player.desktop
deleted file mode 100644
index 9fd207b38..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gst-player.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Name=Media Player
-Comment=Basic media player
-Icon=audio-player
-TryExec=gtk-play
-Exec=gtk-play
-StartupNotify=true
-Terminal=false
-Type=Application
-Categories=GTK;AudioVideo;
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gtk2.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gtk2.patch
deleted file mode 100644
index 2cd18bbc9..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player/gtk2.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-As the rest of Sato is GTK+ 2, patch gtk-play to use GTK+ 2. When the rest of
-Sato has been ported to GTK+ 3 this patch can be dropped.
-
-Upstream-Status: Inappropriate
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-
-diff --git a/configure.ac b/configure.ac
-index b8af13b..90ab74c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -60,7 +60,7 @@ AC_SUBST(GLIB_PREFIX)
- GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-1.0`"
- AC_SUBST(GST_PREFIX)
-
--PKG_CHECK_MODULES(GTK, [gtk+-3.0], [have_gtk="yes"], [have_gtk="no"])
-+PKG_CHECK_MODULES(GTK, [gtk+-2.0], [have_gtk="yes"], [have_gtk="no"])
- AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" != "xno")
-
- GOBJECT_INTROSPECTION_CHECK([1.31.1])
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index f015077..954d6fb 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -34,6 +34,46 @@ typedef struct
- gulong seekbar_value_changed_signal_id;
- } GtkPlay;
-
-+/* Compat stubs */
-+GtkWidget *
-+gtk_box_new (GtkOrientation orientation,
-+ gint spacing)
-+{
-+ switch (orientation) {
-+ case GTK_ORIENTATION_HORIZONTAL:
-+ return gtk_hbox_new (FALSE, spacing);
-+ case GTK_ORIENTATION_VERTICAL:
-+ return gtk_vbox_new (FALSE, spacing);
-+ }
-+}
-+
-+GtkWidget*
-+gtk_button_new_from_icon_name (const gchar *icon_name,
-+ GtkIconSize size)
-+{
-+ GtkWidget *button;
-+ GtkWidget *image;
-+
-+ image = gtk_image_new_from_icon_name (icon_name, size);
-+ button = g_object_new (GTK_TYPE_BUTTON,
-+ "image", image,
-+ NULL);
-+ return button;
-+}
-+
-+GtkWidget *
-+gtk_scale_new_with_range (GtkOrientation orientation,
-+ gdouble min,
-+ gdouble max,
-+ gdouble step)
-+{
-+ switch (orientation) {
-+ case GTK_ORIENTATION_HORIZONTAL:
-+ return gtk_hscale_new_with_range (min, max, step);
-+ case GTK_ORIENTATION_VERTICAL:
-+ return gtk_vscale_new_with_range (min, max, step);
-+ }
-+}
-
- static void
- set_title (GtkPlay * play, const gchar * title)
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player_git.bb
deleted file mode 100644
index 8129169c5..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-player_git.bb
+++ /dev/null
@@ -1,39 +0,0 @@
-SUMMARY = "GStreamer playback helper library and examples"
-LICENSE = "LGPL-2.0+"
-LIC_FILES_CHKSUM = "file://lib/gst/player/gstplayer.c;beginline=1;endline=19;md5=03aeca9d8295f811817909075a15ff65"
-
-DEPENDS = "glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base gtk+"
-
-SRC_URI = "git://github.com/sdroege/gst-player.git \
- file://filechooser.patch \
- file://gtk2.patch \
- file://Fix-pause-play.patch \
- file://Add-error-signal-emission-for-missing-plugins.patch \
- file://gst-player.desktop"
-
-SRCREV = "5386c5b984d40ef5434673ed62204e69aaf52645"
-
-S = "${WORKDIR}/git"
-
-inherit autotools gtk-doc lib_package pkgconfig distro_features_check gobject-introspection
-
-ANY_OF_DISTRO_FEATURES = "${GTK2DISTROFEATURES}"
-
-do_configure_prepend() {
- touch ${S}/ChangeLog
-}
-
-EXTRA_OECONF += "ac_cv_path_VALGRIND=no ac_cv_path_GDB=no"
-
-do_install_append() {
- install -m 0644 -D ${WORKDIR}/gst-player.desktop ${D}${datadir}/applications/gst-player.desktop
-}
-
-FILES_${PN}-bin += "${datadir}/applications/*.desktop"
-
-RDEPENDS_${PN}-bin = "gstreamer1.0-plugins-base-playback"
-RRECOMMENDS_${PN}-bin = "gstreamer1.0-plugins-base-meta \
- gstreamer1.0-plugins-good-meta \
- gstreamer1.0-plugins-bad-meta \
- ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "gstreamer1.0-libav", "", d)} \
- ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "gstreamer1.0-plugins-ugly-meta", "", d)}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-plugins-package.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-plugins-package.inc
deleted file mode 100644
index c24493e1e..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gst-plugins-package.inc
+++ /dev/null
@@ -1,56 +0,0 @@
-PACKAGESPLITFUNCS_prepend = " split_gstreamer10_packages "
-PACKAGESPLITFUNCS_append = " set_metapkg_rdepends "
-
-python split_gstreamer10_packages () {
- gst_libdir = d.expand('${libdir}/gstreamer-${LIBV}')
- postinst = d.getVar('plugin_postinst', True)
- glibdir = d.getVar('libdir', True)
-
- do_split_packages(d, glibdir, '^lib(.*)\.so\.*', 'lib%s', 'gstreamer %s library', extra_depends='', allow_links=True)
- do_split_packages(d, gst_libdir, 'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer plugin for %s', postinst=postinst, extra_depends='')
- do_split_packages(d, glibdir+'/girepository-1.0', 'Gst(.*)-1.0\.typelib$', d.expand('${PN}-%s-typelib'), 'GStreamer typelib file for %s', postinst=postinst, extra_depends='')
- do_split_packages(d, gst_libdir, 'libgst(.*)\.la$', d.expand('${PN}-%s-dev'), 'GStreamer plugin for %s (development files)', extra_depends='${PN}-dev')
- do_split_packages(d, gst_libdir, 'libgst(.*)\.a$', d.expand('${PN}-%s-staticdev'), 'GStreamer plugin for %s (static development files)', extra_depends='${PN}-staticdev')
-}
-
-python set_metapkg_rdepends () {
- import os
-
- pn = d.getVar('PN', True)
- metapkg = pn + '-meta'
- d.setVar('ALLOW_EMPTY_' + metapkg, "1")
- d.setVar('FILES_' + metapkg, "")
- blacklist = [ pn, pn + '-locale', pn + '-dev', pn + '-dbg', pn + '-doc', pn + '-meta' ]
- metapkg_rdepends = []
- packages = d.getVar('PACKAGES', True).split()
- pkgdest = d.getVar('PKGDEST', True)
- for pkg in packages[1:]:
- if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.count('locale') and not pkg.count('-staticdev'):
- # See if the package is empty by looking at the contents of its PKGDEST subdirectory.
- # If this subdirectory is empty, then the package is.
- # Empty packages do not get added to the meta package's RDEPENDS
- pkgdir = os.path.join(pkgdest, pkg)
- if os.path.exists(pkgdir):
- dir_contents = os.listdir(pkgdir) or []
- else:
- dir_contents = []
- is_empty = len(dir_contents) == 0
- if not is_empty:
- metapkg_rdepends.append(pkg)
- d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
- d.setVar('DESCRIPTION_' + metapkg, pn + ' meta package')
-}
-
-# each plugin-dev depends on PN-dev, plugin-staticdev on PN-staticdev
-# so we need them even when empty (like in gst-plugins-good case)
-ALLOW_EMPTY_${PN} = "1"
-ALLOW_EMPTY_${PN}-dev = "1"
-ALLOW_EMPTY_${PN}-staticdev = "1"
-
-PACKAGES += "${PN}-apps ${PN}-meta ${PN}-glib"
-
-FILES_${PN} = ""
-FILES_${PN}-apps = "${bindir}"
-FILES_${PN}-glib = "${datadir}/glib-2.0"
-
-RRECOMMENDS_${PN} += "${PN}-meta"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav.inc
deleted file mode 100644
index 363101e1a..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav.inc
+++ /dev/null
@@ -1,46 +0,0 @@
-SUMMARY = "Libav-based GStreamer 1.x plugin"
-HOMEPAGE = "http://gstreamer.freedesktop.org/"
-SECTION = "multimedia"
-
-LICENSE = "GPLv2+ & LGPLv2+ & ( (GPLv2+ & LGPLv2.1+) | (GPLv3+ & LGPLv3+) )"
-LICENSE_FLAGS = "commercial"
-
-DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base zlib bzip2 xz"
-
-inherit autotools pkgconfig upstream-version-is-even
-
-# CAUTION: Using the system libav is not recommended. Since the libav API is changing all the time,
-# compilation errors (and other, more subtle bugs) can happen. It is usually better to rely on the
-# libav copy included in the gst-libav package.
-PACKAGECONFIG ??= "orc yasm"
-
-PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl,"
-PACKAGECONFIG[libav] = "--with-system-libav,,libav"
-PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc"
-PACKAGECONFIG[yasm] = "--enable-yasm,--disable-yasm,yasm-native"
-
-GSTREAMER_1_0_DEBUG ?= "--disable-debug"
-
-LIBAV_EXTRA_CONFIGURE = "--with-libav-extra-configure"
-
-LIBAV_EXTRA_CONFIGURE_COMMON_ARG = "--target-os=linux \
- --cc='${CC}' --as='${CC}' --ld='${CC}' --nm='${NM}' --ar='${AR}' \
- --ranlib='${RANLIB}' \
- ${GSTREAMER_1_0_DEBUG} \
- --cross-prefix='${HOST_PREFIX}'"
-
-LIBAV_EXTRA_CONFIGURE_COMMON = \
-'${LIBAV_EXTRA_CONFIGURE}="${LIBAV_EXTRA_CONFIGURE_COMMON_ARG}"'
-
-EXTRA_OECONF = "${LIBAV_EXTRA_CONFIGURE_COMMON}"
-
-FILES_${PN} += "${libdir}/gstreamer-1.0/*.so"
-FILES_${PN}-dev += "${libdir}/gstreamer-1.0/*.la"
-FILES_${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a"
-
-# http://errors.yoctoproject.org/Errors/Details/20493/
-ARM_INSTRUCTION_SET_armv4 = "arm"
-ARM_INSTRUCTION_SET_armv5 = "arm"
-
-# ffmpeg/libav disables PIC on some platforms (e.g. x86-32)
-INSANE_SKIP_${PN} = "textrel"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/0001-Disable-yasm-for-libav-when-disable-yasm.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/0001-Disable-yasm-for-libav-when-disable-yasm.patch
deleted file mode 100644
index 1d99ad125..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/0001-Disable-yasm-for-libav-when-disable-yasm.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 54bba228ea52d01fd84941d97be23c03f9862b64 Mon Sep 17 00:00:00 2001
-From: Carlos Rafael Giani <dv@pseudoterminal.org>
-Date: Sat, 6 Apr 2013 01:22:22 +0200
-Subject: [PATCH] Disable yasm for libav when --disable-yasm
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Shane Wang <shane.wang@intel.com>
-Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
----
- configure.ac | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 22ede88..ef3c050 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -305,6 +305,12 @@ else
- emblibav_configure_args="$emblibav_configure_args --enable-gpl"
- fi
-
-+ AC_ARG_ENABLE(yasm,
-+ [AC_HELP_STRING([--disable-yasm], [disable use of yasm assembler])])
-+ if test "x$enable_yasm" = "xno"; then
-+ emblibav_configure_args="$emblibav_configure_args --disable-yasm"
-+ fi
-+
- # if we are cross-compiling, tell libav so
- case $host in
- *android*)
---
-1.8.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/workaround-to-build-gst-libav-for-i586-with-gcc.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/workaround-to-build-gst-libav-for-i586-with-gcc.patch
deleted file mode 100644
index 36abf8607..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav/workaround-to-build-gst-libav-for-i586-with-gcc.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Description: Workaround to build libav for i586 with gcc 4.9.2 by avoiding memset
-Author: Bernhard belacker <bernhardu@vr-web.de>
-
----
-Bug-Debian: https://bugs.debian.org/783082
-Last-Update: 2015-04-28
-
-Upstream-Status: Backport [debian]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-
---- gst-libav-1.4.5.orig/gst-libs/ext/libav/libavcodec/h264_cabac.c
-+++ gst-libav-1.4.5/gst-libs/ext/libav/libavcodec/h264_cabac.c
-@@ -2020,7 +2020,11 @@ decode_intra_mb:
- // In deblocking, the quantizer is 0
- h->cur_pic.qscale_table[mb_xy] = 0;
- // All coeffs are present
-- memset(h->non_zero_count[mb_xy], 16, 48);
-+ /*memset(h->non_zero_count[mb_xy], 16, 48);*/
-+ /* avoiding this memset because it leads at least with gcc4.9.2 to error: 'asm' operand has impossible constraints */
-+ for (size_t i = 0; i < 48; i++) {
-+ ( (unsigned char*)(h->non_zero_count[mb_xy]) ) [i] = 16;
-+ }
- h->cur_pic.mb_type[mb_xy] = mb_type;
- sl->last_qscale_diff = 0;
- return 0;
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_1.6.3.bb
deleted file mode 100644
index 687230a8f..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_1.6.3.bb
+++ /dev/null
@@ -1,20 +0,0 @@
-include gstreamer1.0-libav.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
- file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \
- file://gst-libs/ext/libav/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://gst-libs/ext/libav/COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
- file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
- file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \
- file://0001-Disable-yasm-for-libav-when-disable-yasm.patch \
- file://workaround-to-build-gst-libav-for-i586-with-gcc.patch \
-"
-
-SRC_URI[md5sum] = "cfe9a06913d4fd4067e9e47f6e05fac2"
-SRC_URI[sha256sum] = "857b9c060a0337de38c6d26238c47352433c02eabf26c2f860c854dbc35bd4ab"
-
-S = "${WORKDIR}/gst-libav-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_git.bb
deleted file mode 100644
index ebc8a5ef2..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-libav_git.bb
+++ /dev/null
@@ -1,38 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-libav.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
- file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \
- file://gst-libs/ext/libav/LICENSE.md;md5=acda96fe91ccaabc9cd9d541806a0d37 \
- file://gst-libs/ext/libav/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://gst-libs/ext/libav/COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
- file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
- file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
-
-# To build using the system libav/ffmpeg, append "libav" to PACKAGECONFIG
-# and remove the ffmpeg sources from SRC_URI below. However, first note the
-# warnings in gstreamer1.0-libav.inc
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-libav;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
- git://source.ffmpeg.org/ffmpeg;destsuffix=git/gst-libs/ext/libav;name=ffmpeg;branch=release/3.0 \
- file://0001-Disable-yasm-for-libav-when-disable-yasm.patch \
- file://workaround-to-build-gst-libav-for-i586-with-gcc.patch \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "6c4878b6abc916b7f6f25b8926c4859119acf1ec"
-SRCREV_common = "b64f03f6090245624608beb5d2fff335e23a01c0"
-SRCREV_ffmpeg = "c40983a6f631d22fede713d535bb9c31d5c9740c"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-meta-base.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-meta-base.bb
deleted file mode 100644
index c542b13f0..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-meta-base.bb
+++ /dev/null
@@ -1,68 +0,0 @@
-SUMMARY = "Gstreamer1.0 package groups"
-LICENSE = "MIT"
-
-# Due to use of COMBINED_FEATURES
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-inherit packagegroup
-
-COMMERCIAL_PLUGINS = "${COMMERCIAL_AUDIO_PLUGINS} ${COMMERCIAL_VIDEO_PLUGINS}"
-DEPENDS_UGLY="${@'gstreamer1.0-plugins-ugly' if 'ugly' in COMMERCIAL_PLUGINS.split('-') else ''}"
-DEPENDS_BAD="${@'gstreamer1.0-plugins-bad' if 'bad' in COMMERCIAL_PLUGINS.split('-') else ''}"
-DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good ${DEPENDS_UGLY} ${DEPENDS_BAD}"
-
-PACKAGES = "\
- gstreamer1.0-meta-base \
- gstreamer1.0-meta-x11-base \
- gstreamer1.0-meta-audio \
- gstreamer1.0-meta-debug \
- gstreamer1.0-meta-video"
-
-ALLOW_EMPTY_gstreamer1.0-meta-base = "1"
-ALLOW_EMPTY_gstreamer1.0-meta-x11-base = "1"
-ALLOW_EMPTY_gstreamer1.0-meta-audio = "1"
-ALLOW_EMPTY_gstreamer1.0-meta-debug = "1"
-ALLOW_EMPTY_gstreamer1.0-meta-video = "1"
-
-RDEPENDS_gstreamer1.0-meta-base = "\
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'gstreamer1.0-meta-x11-base', '', d)} \
- gstreamer1.0 \
- gstreamer1.0-plugins-base-playback \
- gstreamer1.0-plugins-base-gio \
- ${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'gstreamer1.0-plugins-base-alsa', '',d)} \
- gstreamer1.0-plugins-base-volume \
- gstreamer1.0-plugins-base-audioconvert \
- gstreamer1.0-plugins-base-audioresample \
- gstreamer1.0-plugins-base-typefindfunctions \
- gstreamer1.0-plugins-base-videoscale \
- gstreamer1.0-plugins-base-videoconvert \
- gstreamer1.0-plugins-good-autodetect \
- gstreamer1.0-plugins-good-souphttpsrc"
-
-RRECOMMENDS_gstreamer1.0-meta-x11-base = "\
- gstreamer1.0-plugins-base-ximagesink \
- gstreamer1.0-plugins-base-xvimagesink"
-
-RDEPENDS_gstreamer1.0-meta-audio = "\
- gstreamer1.0-meta-base \
- gstreamer1.0-plugins-base-vorbis \
- gstreamer1.0-plugins-base-ogg \
- gstreamer1.0-plugins-good-wavparse \
- gstreamer1.0-plugins-good-flac \
- ${COMMERCIAL_AUDIO_PLUGINS}"
-
-RDEPENDS_gstreamer1.0-meta-debug = "\
- gstreamer1.0-meta-base \
- gstreamer1.0-plugins-good-debug \
- gstreamer1.0-plugins-base-audiotestsrc \
- gstreamer1.0-plugins-base-videotestsrc"
-
-RDEPENDS_gstreamer1.0-meta-video = "\
- gstreamer1.0-meta-base \
- gstreamer1.0-plugins-good-avi \
- gstreamer1.0-plugins-good-matroska \
- gstreamer1.0-plugins-base-theora \
- ${COMMERCIAL_VIDEO_PLUGINS}"
-
-RRECOMMENDS_gstreamer1.0-meta-video = "\
- gstreamer1.0-meta-audio"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx.inc
deleted file mode 100644
index 0fff612ee..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx.inc
+++ /dev/null
@@ -1,43 +0,0 @@
-SUMMARY = "OpenMAX IL plugins for GStreamer"
-HOMEPAGE = "http://gstreamer.freedesktop.org/"
-SECTION = "multimedia"
-
-LICENSE = "LGPLv2.1"
-LICENSE_FLAGS = "commercial"
-
-DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad"
-
-inherit autotools pkgconfig gettext
-
-acpaths = "-I ${S}/common/m4 -I ${S}/m4"
-
-PR = "r1"
-
-GSTREAMER_1_0_OMX_TARGET ?= "bellagio"
-GSTREAMER_1_0_OMX_CORE_NAME ?= "${libdir}/libomxil-bellagio.so.0"
-
-EXTRA_OECONF += "--disable-valgrind --with-omx-target=${GSTREAMER_1_0_OMX_TARGET}"
-
-python __anonymous () {
- omx_target = d.getVar("GSTREAMER_1_0_OMX_TARGET", True)
- if omx_target in ['generic', 'bellagio']:
- # Bellagio headers are incomplete (they are missing the OMX_VERSION_MAJOR,#
- # OMX_VERSION_MINOR, OMX_VERSION_REVISION, and OMX_VERSION_STEP macros);
- # appending a directory path to gst-omx' internal OpenMAX IL headers fixes this
- d.appendVar("CFLAGS", " -I${S}/omx/openmax")
- elif omx_target == "rpi":
- # Dedicated Raspberry Pi OpenMAX IL support makes this package machine specific
- d.setVar("PACKAGE_ARCH", d.getVar("MACHINE_ARCH", True))
-}
-
-set_omx_core_name() {
- sed -i -e "s;^core-name=.*;core-name=${GSTREAMER_1_0_OMX_CORE_NAME};" "${D}${sysconfdir}/xdg/gstomx.conf"
-}
-
-do_install[postfuncs] += " set_omx_core_name "
-
-FILES_${PN} += "${libdir}/gstreamer-1.0/*.so"
-FILES_${PN}-dev += "${libdir}/gstreamer-1.0/*.la"
-FILES_${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a"
-
-RDEPENDS_${PN} = "libomxil"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch
deleted file mode 100644
index a428ac9c9..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f629e041e9f678fcd86ad764a15117dff63c271c Mon Sep 17 00:00:00 2001
-From: Carlos Rafael Giani <dv@pseudoterminal.org>
-Date: Sat, 27 Apr 2013 02:50:25 +0200
-Subject: [PATCH] omx: fixed type error in printf call
-
-%zu expects size_t
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=699008]
-
-Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
----
- omx/gstomx.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/omx/gstomx.c b/omx/gstomx.c
-index a2945ed..1eca7cc 100644
---- a/omx/gstomx.c
-+++ b/omx/gstomx.c
-@@ -1630,7 +1630,7 @@ gst_omx_port_allocate_buffers_unlocked (GstOMXPort * port,
-
- GST_INFO_OBJECT (comp->parent,
- "Allocating %d buffers of size %zu for %s port %u", n,
-- port->port_def.nBufferSize, comp->name, (guint) port->index);
-+ (size_t) (port->port_def.nBufferSize), comp->name, (guint) port->index);
-
- if (!port->buffers)
- port->buffers = g_ptr_array_sized_new (n);
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_1.2.0.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_1.2.0.bb
deleted file mode 100644
index 74358a724..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_1.2.0.bb
+++ /dev/null
@@ -1,11 +0,0 @@
-include gstreamer1.0-omx.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
- file://omx/gstomx.h;beginline=1;endline=21;md5=5c8e1fca32704488e76d2ba9ddfa935f"
-
-SRC_URI = "http://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz"
-
-SRC_URI[md5sum] = "d24e8c0153c35dfefee3e26b1c2c35f8"
-SRC_URI[sha256sum] = "0b4874961e6488ad9e5808114bd486ea981c540907262caab1419355fd82d745"
-
-S = "${WORKDIR}/gst-omx-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_git.bb
deleted file mode 100644
index 970554352..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-omx_git.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-omx.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
- file://omx/gstomx.h;beginline=1;endline=21;md5=5c8e1fca32704488e76d2ba9ddfa935f"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-omx;branch=master;name=gst-omx \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;branch=master;name=common \
- file://0001-omx-fixed-type-error-in-printf-call.patch \
-"
-
-SRCREV_gst-omx = "a2db76b048db278ef0aa798e106b7594264e06c0"
-SRCREV_common = "5edcd857b2107cd8b78c16232dd10877513ec157"
-
-SRCREV_FORMAT = "gst-omx"
-
-S = "${WORKDIR}/git"
-
-do_configure_prepend() {
- cd ${S}
- ./autogen.sh --noconfigure
- cd ${B}
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad.inc
deleted file mode 100644
index 9e2b94ede..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad.inc
+++ /dev/null
@@ -1,148 +0,0 @@
-require gstreamer1.0-plugins.inc
-
-LICENSE = "GPLv2+ & LGPLv2+ & LGPLv2.1+"
-
-DEPENDS += "gstreamer1.0-plugins-base libpng jpeg"
-
-inherit gettext bluetooth
-
-SRC_URI_append = " \
- file://0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch \
-"
-
-# opengl packageconfig factored out to make it easy for distros
-# and BSP layers to pick either (desktop) opengl, gles2, or no GL
-PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2', '', d)}"
-
-# gtk is not in the PACKAGECONFIG variable by default until
-# the transition to gtk+3 is finished
-PACKAGECONFIG ??= " \
- ${GSTREAMER_ORC} \
- ${PACKAGECONFIG_GL} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'directfb', 'directfb', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)} \
- bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp \
-"
-
-PACKAGECONFIG[assrender] = "--enable-assrender,--disable-assrender,libass"
-PACKAGECONFIG[bluez] = "--enable-bluez,--disable-bluez,${BLUEZ}"
-PACKAGECONFIG[bz2] = "--enable-bz2,--disable-bz2,bzip2"
-PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl"
-PACKAGECONFIG[dash] = "--enable-dash,--disable-dash,libxml2"
-PACKAGECONFIG[directfb] = "--enable-directfb,--disable-directfb,directfb"
-PACKAGECONFIG[dtls] = "--enable-dtls,--disable-dtls,openssl"
-PACKAGECONFIG[faac] = "--enable-faac,--disable-faac,faac"
-PACKAGECONFIG[faad] = "--enable-faad,--disable-faad,faad2"
-PACKAGECONFIG[flite] = "--enable-flite,--disable-flite,flite-alsa"
-PACKAGECONFIG[fluidsynth] = "--enable-fluidsynth,--disable-fluidsynth,fluidsynth"
-PACKAGECONFIG[gles2] = "--enable-gles2,--disable-gles2,virtual/libgles2"
-PACKAGECONFIG[gtk] = "--enable-gtk3,--disable-gtk3,gtk+3"
-PACKAGECONFIG[hls] = "--enable-hls,--disable-hls,nettle"
-PACKAGECONFIG[libmms] = "--enable-libmms,--disable-libmms,libmms"
-PACKAGECONFIG[libssh2] = "--enable-libssh2,--disable-libssh2,libssh2"
-PACKAGECONFIG[modplug] = "--enable-modplug,--disable-modplug,libmodplug"
-PACKAGECONFIG[neon] = "--enable-neon,--disable-neon,neon"
-PACKAGECONFIG[openal] = "--enable-openal,--disable-openal,openal-soft"
-PACKAGECONFIG[opencv] = "--enable-opencv,--disable-opencv,opencv"
-PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,virtual/libgl libglu"
-PACKAGECONFIG[opus] = "--enable-opus,--disable-opus,libopus"
-PACKAGECONFIG[resindvd] = "--enable-resindvd,--disable-resindvd,libdvdread libdvdnav"
-PACKAGECONFIG[rsvg] = "--enable-rsvg,--disable-rsvg,librsvg"
-PACKAGECONFIG[rtmp] = "--enable-rtmp,--disable-rtmp,rtmpdump"
-PACKAGECONFIG[sbc] = "--enable-sbc,--disable-sbc,sbc"
-PACKAGECONFIG[schroedinger] = "--enable-schro,--disable-schro,schroedinger"
-PACKAGECONFIG[smoothstreaming] = "--enable-smoothstreaming,--disable-smoothstreaming,libxml2"
-PACKAGECONFIG[sndfile] = "--enable-sndfile,--disable-sndfile,libsndfile1"
-PACKAGECONFIG[srtp] = "--enable-srtp,--disable-srtp,libsrtp"
-PACKAGECONFIG[uvch264] = "--enable-uvch264,--disable-uvch264,libusb1 libgudev"
-PACKAGECONFIG[voaacenc] = "--enable-voaacenc,--disable-voaacenc,vo-aacenc"
-PACKAGECONFIG[voamrwbenc] = "--enable-voamrwbenc,--disable-voamrwbenc,vo-amrwbenc"
-PACKAGECONFIG[wayland] = "--enable-wayland --enable-egl,--disable-wayland --disable-egl,wayland virtual/egl"
-PACKAGECONFIG[webp] = "--enable-webp,--disable-webp,libwebp"
-
-# these plugins have not been ported to 1.0 (yet):
-# apexsink dc1394 lv2 linsys musepack nas timidity teletextdec sdl xvid wininet
-# acm gsettings sndio cdxaparse dccp faceoverlay hdvparse tta mve nuvdemux
-# patchdetect real sdi videomeasure gsettings
-
-# these plugins have no corresponding library in OE-core or meta-openembedded:
-# openni2 winks direct3d directsound winscreencap
-# apple_media android_media avc bs2b chromaprint daala dts gme gsm kate ladspa
-# libde265 mimic mpeg2enc mplex ofa openh264 opensles pvr soundtouch spandsp
-# spc vdpau wasapi x265 zbar
-
-# qt5 support is disabled, because it is not present in OE core, and requires more work than
-# just adding a packageconfig (it requires access to moc, uic, rcc, and qmake paths).
-# This is better done in a separate qt5 layer (which then should add a "qt5" packageconfig
-# in a gstreamer1.0-plugins-bad bbappend).
-
-EXTRA_OECONF += " \
- --enable-decklink \
- --enable-dvb \
- --enable-fbdev \
- --enable-shm \
- --enable-vcd \
- --disable-acm \
- --disable-android_media \
- --disable-apexsink \
- --disable-apple_media \
- --disable-avc \
- --disable-bs2b \
- --disable-chromaprint \
- --disable-cocoa \
- --disable-daala \
- --disable-dc1394 \
- --disable-direct3d \
- --disable-directsound \
- --disable-dts \
- --disable-gme \
- --disable-gsm \
- --disable-kate \
- --disable-ladspa \
- --disable-libde265 \
- --disable-libvisual \
- --disable-linsys \
- --disable-lv2 \
- --disable-mimic \
- --disable-mpeg2enc \
- --disable-mplex \
- --disable-musepack \
- --disable-nas \
- --disable-ofa \
- --disable-openexr \
- --disable-openh264 \
- --disable-openjpeg \
- --disable-openni2 \
- --disable-opensles \
- --disable-pvr \
- --disable-qt \
- --disable-sdl \
- --disable-sdltest \
- --disable-sndio \
- --disable-soundtouch \
- --disable-spandsp \
- --disable-spc \
- --disable-teletextdec \
- --disable-timidity \
- --disable-vdpau \
- --disable-wasapi \
- --disable-wildmidi \
- --disable-wininet \
- --disable-winks \
- --disable-winscreencap \
- --disable-x265 \
- --disable-xvid \
- --disable-zbar \
- ${@bb.utils.contains("TUNE_FEATURES", "mx32", "--disable-yadif", "", d)} \
-"
-
-export OPENCV_PREFIX = "${STAGING_DIR_TARGET}${prefix}"
-
-ARM_INSTRUCTION_SET_armv4 = "arm"
-ARM_INSTRUCTION_SET_armv5 = "arm"
-
-FILES_${PN}-dev += "${libdir}/gstreamer-${LIBV}/include/gst/gl/gstglconfig.h"
-FILES_${PN}-freeverb += "${datadir}/gstreamer-${LIBV}/presets/GstFreeverb.prs"
-FILES_${PN}-opencv += "${datadir}/gst-plugins-bad/${LIBV}/opencv*"
-FILES_${PN}-voamrwbenc += "${datadir}/gstreamer-${LIBV}/presets/GstVoAmrwbEnc.prs"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
deleted file mode 100644
index 154d340e4..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From cff6fbf555a072408c21da1e818209c9d3814dd3 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Tue, 27 Oct 2015 14:36:58 +0200
-Subject: [PATCH] Makefile.am: don't hardcode libtool name when running
- introspection tools
-
-Upstream-Status: Pending [review on oe-core list]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
-
----
- gst-libs/gst/gl/Makefile.am | 2 +-
- gst-libs/gst/insertbin/Makefile.am | 2 +-
- gst-libs/gst/mpegts/Makefile.am | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
-index f968357..7cc2c7a 100644
---- a/gst-libs/gst/gl/Makefile.am
-+++ b/gst-libs/gst/gl/Makefile.am
-@@ -149,7 +149,7 @@ GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@
- --library=libgstgl-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg gstreamer-video-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/insertbin/Makefile.am b/gst-libs/gst/insertbin/Makefile.am
-index 09eb97c..b746885 100644
---- a/gst-libs/gst/insertbin/Makefile.am
-+++ b/gst-libs/gst/insertbin/Makefile.am
-@@ -43,7 +43,7 @@ GstInsertBin-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstinsertbin-@GS
- --library=libgstinsertbin-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-insertbin-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/mpegts/Makefile.am b/gst-libs/gst/mpegts/Makefile.am
-index 2511d49..c1cbce6 100644
---- a/gst-libs/gst/mpegts/Makefile.am
-+++ b/gst-libs/gst/mpegts/Makefile.am
-@@ -78,7 +78,7 @@ GstMpegts-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstmpegts-@GST_API_
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-video-@GST_API_VERSION@` \
- --library=libgstmpegts-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-video-@GST_API_VERSION@ \
- --pkg-export gstreamer-mpegts-@GST_API_VERSION@ \
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-glimagesink-Downrank-to-marginal.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-glimagesink-Downrank-to-marginal.patch
deleted file mode 100644
index 1085e95e8..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-glimagesink-Downrank-to-marginal.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From c6b37a80806f9128de47f1ccc3f2354f8d436bb6 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Thu, 24 Sep 2015 19:47:32 +0300
-Subject: [PATCH] glimagesink: Downrank to marginal
-
-On desktop, where there is good OpenGL, xvimagesink will come up first,
-on other platforms, OpenGL can't be trusted because it's either software (like
-in a VM) or broken (like on embedded)., so let ximagesink come above.
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=751684]
-
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- ext/gl/gstopengl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ext/gl/gstopengl.c b/ext/gl/gstopengl.c
-index a4b2540..0ccaacd 100644
---- a/ext/gl/gstopengl.c
-+++ b/ext/gl/gstopengl.c
-@@ -101,7 +101,7 @@ plugin_init (GstPlugin * plugin)
- #endif
-
- if (!gst_element_register (plugin, "glimagesink",
-- GST_RANK_SECONDARY, gst_gl_image_sink_bin_get_type ())) {
-+ GST_RANK_MARGINAL, gst_gl_image_sink_bin_get_type ())) {
- return FALSE;
- }
-
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch
deleted file mode 100644
index e81b06570..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From a93ca63d01e7cd1e40b5be576992f77fac364bd5 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Mon, 21 Mar 2016 18:21:17 +0200
-Subject: [PATCH] gstreamer-gl.pc.in: don't append GL_CFLAGS to CFLAGS
-
-Dependencies' include directories should not be added in this way;
-it causes problems when cross-compiling in sysroot environments.
-
-Upstream-Status: Pending
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- pkgconfig/gstreamer-gl.pc.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pkgconfig/gstreamer-gl.pc.in b/pkgconfig/gstreamer-gl.pc.in
-index 5589e2a..b986450 100644
---- a/pkgconfig/gstreamer-gl.pc.in
-+++ b/pkgconfig/gstreamer-gl.pc.in
-@@ -10,4 +10,4 @@ Version: @VERSION@
- Requires: gstreamer-base-@GST_API_VERSION@ gstreamer-@GST_API_VERSION@
-
- Libs: -L${libdir} -lgstgl-@GST_API_VERSION@ @GL_LIBS@
--Cflags: -I${includedir} @GL_CFLAGS@
-+Cflags: -I${includedir}
---
-2.7.0
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0002-glplugin-glwindow-fix-memory-leak-of-navigation-thre.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0002-glplugin-glwindow-fix-memory-leak-of-navigation-thre.patch
deleted file mode 100755
index 3491a15e6..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/0002-glplugin-glwindow-fix-memory-leak-of-navigation-thre.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 95cda7fbcf1a81289d9315c801c8e2b3d896f4cb Mon Sep 17 00:00:00 2001
-From: Haihua Hu <b55597@freescale.com>
-Date: Mon, 30 Nov 2015 09:36:09 +0800
-Subject: [PATCH 2/5] [glplugin] glwindow: fix memory leak of navigation
- thread
-
-When exit navigation thread, call g_thread_join() to release
-the resource hold by it.
-
-Upstream-Status: Backport [1.7.1]
-
-bugzilla URL: https://bugzilla.gnome.org/show_bug.cgi?id=758820
-
-Signed-off-by: Haihua Hu <b55597@freescale.com>
----
- gst-libs/gst/gl/gstglwindow.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
-index 44b74ca..42ef296 100644
---- a/gst-libs/gst/gl/gstglwindow.c
-+++ b/gst-libs/gst/gl/gstglwindow.c
-@@ -343,6 +343,9 @@ gst_gl_window_finalize (GObject * object)
- while (window->nav_alive) {
- g_cond_wait (&window->nav_destroy_cond, &window->nav_lock);
- }
-+ /* release resource hold by navigation thread */
-+ g_thread_join(window->priv->navigation_thread);
-+ window->priv->navigation_thread = NULL;
- g_mutex_unlock (&window->nav_lock);
- }
-
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/avoid-including-sys-poll.h-directly.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/avoid-including-sys-poll.h-directly.patch
deleted file mode 100644
index 357fd7800..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/avoid-including-sys-poll.h-directly.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 72561a0fca562d03567ace7b4cfc94992cd6525c Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Wed, 3 Feb 2016 18:05:41 -0800
-Subject: [PATCH] avoid including <sys/poll.h> directly
-
-musl libc generates warnings if <sys/poll.h> is included directly.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- sys/dvb/gstdvbsrc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c
-index b93255f..49f145a 100644
---- a/sys/dvb/gstdvbsrc.c
-+++ b/sys/dvb/gstdvbsrc.c
-@@ -93,7 +93,7 @@
- #include <gst/gst.h>
- #include <gst/glib-compat-private.h>
- #include <sys/ioctl.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <stdio.h>
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/configure-allow-to-disable-libssh2.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/configure-allow-to-disable-libssh2.patch
deleted file mode 100644
index d52afd5d5..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/configure-allow-to-disable-libssh2.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From f59c5269f92d59a5296cbfeeb682d42095cd88ad Mon Sep 17 00:00:00 2001
-From: Wenzong Fan <wenzong.fan@windriver.com>
-Date: Thu, 18 Sep 2014 02:24:07 -0400
-Subject: [PATCH] gstreamer1.0-plugins-bad: allow to disable libssh2
-
-libssh2 is automatically linked to if present, this undetermined
-dependency may cause build errors like:
-
- .../x86_64-poky-linux/4.9.0/ld: cannot find -lssh2
-
-libssh2 isn't an oe-core recipe, so allow to disable it from
-configure.
-
-Upstream-Status: Pending
-
-Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
----
- configure.ac | 23 +++++++++++++++++------
- 1 file changed, 17 insertions(+), 6 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 0e95c5c..12153b4 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1901,6 +1901,15 @@ AG_GST_CHECK_FEATURE(CHROMAPRINT, [chromaprint], chromaprint, [
- ])
-
- dnl *** Curl ***
-+AC_ARG_ENABLE([libssh2],
-+ [ --enable-libssh2 enable LIBSSH2 support @<:@default=auto@:>@],
-+ [case "${enableval}" in
-+ yes) NEED_SSH2=yes ;;
-+ no) NEED_SSH2=no ;;
-+ auto) NEED_SSH2=auto ;;
-+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-libssh2]) ;;
-+ esac],[NEED_SSH2=auto])
-+
- translit(dnm, m, l) AM_CONDITIONAL(USE_CURL, true)
- AG_GST_CHECK_FEATURE(CURL, [Curl plugin], curl, [
- PKG_CHECK_MODULES(CURL, libcurl >= 7.21.0, [
-@@ -1915,12 +1924,14 @@ AG_GST_CHECK_FEATURE(CURL, [Curl plugin], curl, [
- ])
- AC_SUBST(CURL_CFLAGS)
- AC_SUBST(CURL_LIBS)
-- PKG_CHECK_MODULES(SSH2, libssh2 >= 1.4.3, [
-- HAVE_SSH2="yes"
-- AC_DEFINE(HAVE_SSH2, 1, [Define if libssh2 is available])
-- ], [
-- HAVE_SSH2="no"
-- ])
-+ if test "x$NEED_SSH2" != "xno"; then
-+ PKG_CHECK_MODULES(SSH2, libssh2 >= 1.4.3, [
-+ HAVE_SSH2="yes"
-+ AC_DEFINE(HAVE_SSH2, 1, [Define if libssh2 is available])
-+ ], [
-+ HAVE_SSH2="no"
-+ ])
-+ fi
- AM_CONDITIONAL(USE_SSH2, test "x$HAVE_SSH2" = "xyes")
- AC_SUBST(SSH2_CFLAGS)
- AC_SUBST(SSH2_LIBS)
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/ensure-valid-sentinels-for-gst_structure_get-etc.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/ensure-valid-sentinels-for-gst_structure_get-etc.patch
deleted file mode 100644
index 369ff93ac..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/ensure-valid-sentinels-for-gst_structure_get-etc.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 2262ba4b686d5cc0d3e894707fe1d31619a3a8f1 Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Tue, 9 Feb 2016 14:00:00 -0800
-Subject: [PATCH] ensure valid sentinals for gst_structure_get() etc
-
-For GStreamer functions declared with G_GNUC_NULL_TERMINATED,
-ie __attribute__((__sentinel__)), gcc will generate a warning if the
-last parameter passed to the function is not NULL (where a valid NULL
-in this context is defined as zero with any pointer type).
-
-The C callers to such functions within gst-plugins-bad use the C NULL
-definition (ie ((void*)0)), which is a valid sentinel.
-
-However the C++ NULL definition (ie 0L), is not a valid sentinel
-without an explicit cast to a pointer type.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- sys/decklink/gstdecklink.cpp | 10 +++++-----
- sys/decklink/gstdecklinkaudiosrc.cpp | 2 +-
- sys/decklink/gstdecklinkvideosink.cpp | 2 +-
- 3 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp
-index 64637f1..bac956f 100644
---- a/sys/decklink/gstdecklink.cpp
-+++ b/sys/decklink/gstdecklink.cpp
-@@ -324,22 +324,22 @@ gst_decklink_mode_get_structure (GstDecklinkModeEnum e, BMDPixelFormat f)
- "height", G_TYPE_INT, mode->height,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
- "interlace-mode", G_TYPE_STRING, mode->interlaced ? "interleaved" : "progressive",
-- "framerate", GST_TYPE_FRACTION, mode->fps_n, mode->fps_d, NULL);
-+ "framerate", GST_TYPE_FRACTION, mode->fps_n, mode->fps_d, (void *) NULL);
-
- switch (f) {
- case bmdFormat8BitYUV: /* '2vuy' */
- gst_structure_set (s, "format", G_TYPE_STRING, "UYVY",
- "colorimetry", G_TYPE_STRING, mode->colorimetry,
-- "chroma-site", G_TYPE_STRING, "mpeg2", NULL);
-+ "chroma-site", G_TYPE_STRING, "mpeg2", (void *) NULL);
- break;
- case bmdFormat10BitYUV: /* 'v210' */
-- gst_structure_set (s, "format", G_TYPE_STRING, "v210", NULL);
-+ gst_structure_set (s, "format", G_TYPE_STRING, "v210", (void *) NULL);
- break;
- case bmdFormat8BitARGB: /* 'ARGB' */
-- gst_structure_set (s, "format", G_TYPE_STRING, "ARGB", NULL);
-+ gst_structure_set (s, "format", G_TYPE_STRING, "ARGB", (void *) NULL);
- break;
- case bmdFormat8BitBGRA: /* 'BGRA' */
-- gst_structure_set (s, "format", G_TYPE_STRING, "BGRA", NULL);
-+ gst_structure_set (s, "format", G_TYPE_STRING, "BGRA", (void *) NULL);
- break;
- case bmdFormat10BitRGB: /* 'r210' Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 */
- case bmdFormat12BitRGB: /* 'R12B' Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component */
-diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp
-index 9a701ee..26fb7ec 100644
---- a/sys/decklink/gstdecklinkaudiosrc.cpp
-+++ b/sys/decklink/gstdecklinkaudiosrc.cpp
-@@ -312,7 +312,7 @@ gst_decklink_audio_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
- g_mutex_unlock (&self->input->lock);
-
- if (videosrc) {
-- g_object_get (videosrc, "connection", &vconn, NULL);
-+ g_object_get (videosrc, "connection", &vconn, (void *) NULL);
- gst_object_unref (videosrc);
-
- switch (vconn) {
-diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp
-index eebeff3..da6e486 100644
---- a/sys/decklink/gstdecklinkvideosink.cpp
-+++ b/sys/decklink/gstdecklinkvideosink.cpp
-@@ -158,7 +158,7 @@ reset_framerate (GstCapsFeatures * features, GstStructure * structure,
- gpointer user_data)
- {
- gst_structure_set (structure, "framerate", GST_TYPE_FRACTION_RANGE, 0, 1,
-- G_MAXINT, 1, NULL);
-+ G_MAXINT, 1, (void *) NULL);
-
- return TRUE;
- }
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/fix-maybe-uninitialized-warnings-when-compiling-with-Os.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/fix-maybe-uninitialized-warnings-when-compiling-with-Os.patch
deleted file mode 100644
index 5ce57714e..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad/fix-maybe-uninitialized-warnings-when-compiling-with-Os.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From a67781000e82bd9ae3813da29401e8c0c852328a Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Tue, 26 Jan 2016 15:16:01 -0800
-Subject: [PATCH] fix maybe-uninitialized warnings when compiling with -Os
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- gst-libs/gst/codecparsers/gstvc1parser.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gst-libs/gst/codecparsers/gstvc1parser.c b/gst-libs/gst/codecparsers/gstvc1parser.c
-index fd16ee0..ddb890c 100644
---- a/gst-libs/gst/codecparsers/gstvc1parser.c
-+++ b/gst-libs/gst/codecparsers/gstvc1parser.c
-@@ -1729,7 +1729,7 @@ gst_vc1_parse_sequence_layer (const guint8 * data, gsize size,
- GstVC1SeqLayer * seqlayer)
- {
- guint32 tmp;
-- guint8 tmp8;
-+ guint8 tmp8 = 0;
- guint8 structA[8] = { 0, };
- guint8 structB[12] = { 0, };
- GstBitReader br;
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_1.6.3.bb
deleted file mode 100644
index 8eb47c265..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_1.6.3.bb
+++ /dev/null
@@ -1,28 +0,0 @@
-include gstreamer1.0-plugins-bad.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=73a5855a8119deb017f5f13cf327095d \
- file://COPYING.LIB;md5=21682e4e8fea52413fd26c60acb907e5 \
- file://gst/tta/crc32.h;beginline=12;endline=29;md5=27db269c575d1e5317fffca2d33b3b50 \
- file://gst/tta/filters.h;beginline=12;endline=29;md5=8a08270656f2f8ad7bb3655b83138e5a"
-
-# Note: The mpg123 plugin was moved to gst-plugins-ugly prior to the 1.7.2
-# release, so this line should be removed during the update to 1.8.x
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=08d8aefcdaaf89ecb6dd53ec1e4f95cd42d01664
-PACKAGECONFIG[mpg123] = "--enable-mpg123,--disable-mpg123,mpg123"
-
-# Note: The gsettings plug-in was dropped prior to the 1.7.2 release,
-# so this line should be removed during the update to 1.8.x
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=914291808ad10621d6a74031f3d46d45eef5a3a3
-EXTRA_OECONF += "--disable-gsettings"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${PV}.tar.xz \
- file://configure-allow-to-disable-libssh2.patch \
- file://0001-glimagesink-Downrank-to-marginal.patch \
- file://0002-glplugin-glwindow-fix-memory-leak-of-navigation-thre.patch \
-"
-
-SRC_URI[md5sum] = "4857adcafe41e4b9b8805cf88303bd55"
-SRC_URI[sha256sum] = "971b29101d6a9c5e3fe94d99d977a227f58f0b2d29b6ca2c7f292052542b3a61"
-
-S = "${WORKDIR}/gst-plugins-bad-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_git.bb
deleted file mode 100644
index ef6581b2a..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-bad_git.bb
+++ /dev/null
@@ -1,65 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-plugins-bad.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=73a5855a8119deb017f5f13cf327095d \
- file://COPYING.LIB;md5=21682e4e8fea52413fd26c60acb907e5 \
- file://gst/tta/crc32.h;beginline=12;endline=29;md5=27db269c575d1e5317fffca2d33b3b50 \
- file://gst/tta/filters.h;beginline=12;endline=29;md5=8a08270656f2f8ad7bb3655b83138e5a"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-plugins-bad;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
- file://configure-allow-to-disable-libssh2.patch \
- file://fix-maybe-uninitialized-warnings-when-compiling-with-Os.patch \
- file://avoid-including-sys-poll.h-directly.patch \
- file://ensure-valid-sentinels-for-gst_structure_get-etc.patch \
- file://0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "50ae46cc0f8827bf966920d9c221e5cf86e811ba"
-SRCREV_common = "a25397448942079002622be231e9ec49b985745a"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-# over-ride the default hls PACKAGECONFIG in gstreamer1.0-plugins-bad.inc to
-# pass an additional --with-hls-crypto=XXX option (new in 1.7.x) and switch HLS
-# AES decryption from nettle to openssl (ie a shared dependency with dtls).
-# This should move back to the common .inc once the main recipe updates to 1.8.x
-PACKAGECONFIG[hls] = "--enable-hls --with-hls-crypto=openssl,--disable-hls,openssl"
-
-# The tinyalsa plugin was added prior to the 1.7.2 release
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c8bd74fa9a81398f57d976c478d2043f30188684
-PACKAGECONFIG[tinyalsa] = "--enable-tinyalsa,--disable-tinyalsa,tinyalsa"
-
-# The vulkan based video sink plugin was added prior to the 1.7.2 release
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=5de6dd9f40629562acf90e35e1fa58464d66617d
-PACKAGECONFIG[vulkan] = "--enable-vulkan,--disable-vulkan,libxcb"
-
-# The dependency-less netsim plugin was added prior to the 1.7.2 release
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=e3f9e854f08e82bfab11182c5a2aa6f9a0c73cd5
-EXTRA_OECONF += " \
- --enable-netsim \
-"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
-
-# In 1.6.2, the "--enable-hls" configure option generated an installable package
-# called "gstreamer1.0-plugins-bad-fragmented". In 1.7.1 that HLS plugin package
-# has become "gstreamer1.0-plugins-bad-hls". See:
-# http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=efe62292a3d045126654d93239fdf4cc8e48ae08
-
-PACKAGESPLITFUNCS_append = " handle_hls_rename "
-
-python handle_hls_rename () {
- d.setVar('RPROVIDES_gstreamer1.0-plugins-bad-hls', 'gstreamer1.0-plugins-bad-fragmented')
- d.setVar('RREPLACES_gstreamer1.0-plugins-bad-hls', 'gstreamer1.0-plugins-bad-fragmented')
- d.setVar('RCONFLICTS_gstreamer1.0-plugins-bad-hls', 'gstreamer1.0-plugins-bad-fragmented')
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base.inc
deleted file mode 100644
index 7381458f4..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base.inc
+++ /dev/null
@@ -1,50 +0,0 @@
-require gstreamer1.0-plugins.inc
-
-SRC_URI_append = "\
- file://0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch \
- file://0002-Makefile.am-prefix-calls-to-pkg-config-with-PKG_CONF.patch \
- file://0003-riff-add-missing-include-directories-when-calling-in.patch \
- file://0004-rtsp-drop-incorrect-reference-to-gstreamer-sdp-in-Ma.patch \
-"
-
-LICENSE = "GPLv2+ & LGPLv2+"
-
-DEPENDS += "iso-codes util-linux zlib"
-
-inherit gettext
-
-PACKAGES_DYNAMIC =+ "^libgst.*"
-
-PACKAGECONFIG ??= " \
- ${GSTREAMER_ORC} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
- gio-unix-2.0 ivorbis ogg pango theora vorbis \
-"
-
-X11DEPENDS = "virtual/libx11 libsm libxrender libxv"
-X11ENABLEOPTS = "--enable-x --enable-xvideo --enable-xshm"
-X11DISABLEOPTS = "--disable-x --disable-xvideo --disable-xshm"
-
-PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib"
-PACKAGECONFIG[cdparanoia] = "--enable-cdparanoia,--disable-cdparanoia,cdparanoia"
-PACKAGECONFIG[gio-unix-2.0] = "--enable-gio_unix_2_0,--disable-gio_unix_2_0,glib-2.0"
-PACKAGECONFIG[ivorbis] = "--enable-ivorbis,--disable-ivorbis,tremor"
-PACKAGECONFIG[ogg] = "--enable-ogg,--disable-ogg,libogg"
-PACKAGECONFIG[pango] = "--enable-pango,--disable-pango,pango"
-PACKAGECONFIG[theora] = "--enable-theora,--disable-theora,libtheora"
-PACKAGECONFIG[visual] = "--enable-libvisual,--disable-libvisual,libvisual"
-PACKAGECONFIG[vorbis] = "--enable-vorbis,--disable-vorbis,libvorbis"
-PACKAGECONFIG[x11] = "${X11ENABLEOPTS},${X11DISABLEOPTS},${X11DEPENDS}"
-
-EXTRA_OECONF += " \
- --enable-zlib \
-"
-
-CACHED_CONFIGUREVARS_append_x86 = " ac_cv_header_emmintrin_h=no ac_cv_header_xmmintrin_h=no"
-
-FILES_${MLPREFIX}libgsttag-1.0 += "${datadir}/gst-plugins-base/1.0/license-translations.dict"
-
-do_compile_prepend() {
- export GIR_EXTRA_LIBS_PATH="${B}/gst-libs/gst/tag/.libs:${B}/gst-libs/gst/video/.libs:${B}/gst-libs/gst/audio/.libs:${B}/gst-libs/gst/rtp/.libs"
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
deleted file mode 100644
index 781e4d801..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From f1d9652351e7754c63003104eceb526af424c7e0 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Fri, 20 Nov 2015 16:53:04 +0200
-Subject: [PATCH 1/4] Makefile.am: don't hardcode libtool name when running
- introspection tools
-
-Upstream-Status: Pending [review on oe-core maillist]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- gst-libs/gst/allocators/Makefile.am | 2 +-
- gst-libs/gst/app/Makefile.am | 2 +-
- gst-libs/gst/audio/Makefile.am | 2 +-
- gst-libs/gst/fft/Makefile.am | 2 +-
- gst-libs/gst/pbutils/Makefile.am | 2 +-
- gst-libs/gst/riff/Makefile.am | 2 +-
- gst-libs/gst/rtp/Makefile.am | 2 +-
- gst-libs/gst/rtsp/Makefile.am | 2 +-
- gst-libs/gst/sdp/Makefile.am | 2 +-
- gst-libs/gst/tag/Makefile.am | 2 +-
- gst-libs/gst/video/Makefile.am | 2 +-
- 11 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am
-index 9361bf9..bc7f53a 100644
---- a/gst-libs/gst/allocators/Makefile.am
-+++ b/gst-libs/gst/allocators/Makefile.am
-@@ -37,7 +37,7 @@ GstAllocators-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstallocators-@
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstallocators-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg-export gstreamer-allocators-@GST_API_VERSION@ \
- --output $@ \
-diff --git a/gst-libs/gst/app/Makefile.am b/gst-libs/gst/app/Makefile.am
-index 6d6de8d..dcc2fe0 100644
---- a/gst-libs/gst/app/Makefile.am
-+++ b/gst-libs/gst/app/Makefile.am
-@@ -52,7 +52,7 @@ GstApp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstapp-@GST_API_VERSIO
- --library=libgstapp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-app-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/audio/Makefile.am b/gst-libs/gst/audio/Makefile.am
-index 275d222..2374196 100644
---- a/gst-libs/gst/audio/Makefile.am
-+++ b/gst-libs/gst/audio/Makefile.am
-@@ -106,7 +106,7 @@ GstAudio-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstaudio-@GST_API_VE
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
- --include=GstTag-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-audio-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/fft/Makefile.am b/gst-libs/gst/fft/Makefile.am
-index 09b3d68..f545354 100644
---- a/gst-libs/gst/fft/Makefile.am
-+++ b/gst-libs/gst/fft/Makefile.am
-@@ -64,7 +64,7 @@ GstFft-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstfft-@GST_API_VERSIO
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstfft-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg-export gstreamer-fft-@GST_API_VERSION@ \
- --output $@ \
-diff --git a/gst-libs/gst/pbutils/Makefile.am b/gst-libs/gst/pbutils/Makefile.am
-index 64d5eb0..91dc214 100644
---- a/gst-libs/gst/pbutils/Makefile.am
-+++ b/gst-libs/gst/pbutils/Makefile.am
-@@ -94,7 +94,7 @@ GstPbutils-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstpbutils-@GST_AP
- --include=GstTag-@GST_API_VERSION@ \
- --include=GstVideo-@GST_API_VERSION@ \
- --include=GstAudio-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-tag-@GST_API_VERSION@ \
- --pkg gstreamer-video-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/riff/Makefile.am b/gst-libs/gst/riff/Makefile.am
-index 83d83cb..3bd8fc0 100644
---- a/gst-libs/gst/riff/Makefile.am
-+++ b/gst-libs/gst/riff/Makefile.am
-@@ -47,7 +47,7 @@ libgstriff_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS)
- # --include=GstAudio-@GST_API_VERSION@ \
- # --include=GstTag-@GST_API_VERSION@ \
- # --include=Gst-@GST_API_VERSION@ \
--# --libtool="$(top_builddir)/libtool" \
-+# --libtool="$(LIBTOOL)" \
- # --pkg gstreamer-@GST_API_VERSION@ \
- # --pkg gstreamer-tag-@GST_API_VERSION@ \
- # --pkg gstreamer-audio-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/rtp/Makefile.am b/gst-libs/gst/rtp/Makefile.am
-index fdd01c1..f5445c1 100644
---- a/gst-libs/gst/rtp/Makefile.am
-+++ b/gst-libs/gst/rtp/Makefile.am
-@@ -64,7 +64,7 @@ GstRtp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtp-@GST_API_VERSIO
- --library=libgstrtp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-rtp-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am
-index ede5706..9b0b258 100644
---- a/gst-libs/gst/rtsp/Makefile.am
-+++ b/gst-libs/gst/rtsp/Makefile.am
-@@ -71,7 +71,7 @@ GstRtsp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_API_VERS
- --include=Gio-2.0 \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstSdp-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gio-2.0 \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-sdp-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/sdp/Makefile.am b/gst-libs/gst/sdp/Makefile.am
-index a90f30b..0e149b8 100644
---- a/gst-libs/gst/sdp/Makefile.am
-+++ b/gst-libs/gst/sdp/Makefile.am
-@@ -31,7 +31,7 @@ GstSdp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstsdp-@GST_API_VERSIO
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstsdp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg-export gstreamer-sdp-@GST_API_VERSION@ \
- --output $@ \
-diff --git a/gst-libs/gst/tag/Makefile.am b/gst-libs/gst/tag/Makefile.am
-index c534a4d..cafafd3 100644
---- a/gst-libs/gst/tag/Makefile.am
-+++ b/gst-libs/gst/tag/Makefile.am
-@@ -44,7 +44,7 @@ GstTag-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgsttag-@GST_API_VERSIO
- --library=libgsttag-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-tag-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am
-index 5d31fa1..ac64eb3 100644
---- a/gst-libs/gst/video/Makefile.am
-+++ b/gst-libs/gst/video/Makefile.am
-@@ -113,7 +113,7 @@ GstVideo-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstvideo-@GST_API_VE
- --library=libgstvideo-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg-export gstreamer-video-@GST_API_VERSION@ \
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0002-Makefile.am-prefix-calls-to-pkg-config-with-PKG_CONF.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0002-Makefile.am-prefix-calls-to-pkg-config-with-PKG_CONF.patch
deleted file mode 100644
index 85fcacb55..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0002-Makefile.am-prefix-calls-to-pkg-config-with-PKG_CONF.patch
+++ /dev/null
@@ -1,298 +0,0 @@
-From 990b653c7b6de1937ec759019982d6c5f15770f7 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Mon, 26 Oct 2015 16:38:18 +0200
-Subject: [PATCH 2/4] Makefile.am: prefix calls to pkg-config with
- PKG_CONFIG_SYSROOT_DIR
-
-Upstream-Status: Pending [review on oe-core maillist]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- gst-libs/gst/allocators/Makefile.am | 4 ++--
- gst-libs/gst/app/Makefile.am | 4 ++--
- gst-libs/gst/audio/Makefile.am | 12 ++++++------
- gst-libs/gst/fft/Makefile.am | 4 ++--
- gst-libs/gst/pbutils/Makefile.am | 12 ++++++------
- gst-libs/gst/riff/Makefile.am | 8 ++++----
- gst-libs/gst/rtp/Makefile.am | 8 ++++----
- gst-libs/gst/rtsp/Makefile.am | 4 ++--
- gst-libs/gst/sdp/Makefile.am | 4 ++--
- gst-libs/gst/tag/Makefile.am | 8 ++++----
- gst-libs/gst/video/Makefile.am | 8 ++++----
- 11 files changed, 38 insertions(+), 38 deletions(-)
-
-diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am
-index bc7f53a..0ef5f86 100644
---- a/gst-libs/gst/allocators/Makefile.am
-+++ b/gst-libs/gst/allocators/Makefile.am
-@@ -34,7 +34,7 @@ GstAllocators-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstallocators-@
- --c-include "gst/allocators/allocators.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstallocators-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --libtool="$(LIBTOOL)" \
-@@ -58,7 +58,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/app/Makefile.am b/gst-libs/gst/app/Makefile.am
-index dcc2fe0..dc076cb 100644
---- a/gst-libs/gst/app/Makefile.am
-+++ b/gst-libs/gst/app/Makefile.am
-@@ -47,8 +47,8 @@ GstApp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstapp-@GST_API_VERSIO
- --c-include "gst/app/app.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --library=libgstapp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-diff --git a/gst-libs/gst/audio/Makefile.am b/gst-libs/gst/audio/Makefile.am
-index 2374196..295eb42 100644
---- a/gst-libs/gst/audio/Makefile.am
-+++ b/gst-libs/gst/audio/Makefile.am
-@@ -96,12 +96,12 @@ GstAudio-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstaudio-@GST_API_VE
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- --c-include "gst/audio/audio.h" \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --add-include-path="$(top_builddir)/gst-libs/gst/tag/" \
- --library=libgstaudio-@GST_API_VERSION@.la \
-- --library-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-@GST_API_VERSION@` \
-- --library-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-base-@GST_API_VERSION@` \
-+ --library-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-@GST_API_VERSION@` \
-+ --library-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-base-@GST_API_VERSION@` \
- --library-path="$(top_builddir)/gst-libs/gst/tag/" \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-@@ -130,8 +130,8 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
- --includedir="$(top_builddir)/gst-libs/gst/tag/" \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/fft/Makefile.am b/gst-libs/gst/fft/Makefile.am
-index f545354..1bb6243 100644
---- a/gst-libs/gst/fft/Makefile.am
-+++ b/gst-libs/gst/fft/Makefile.am
-@@ -61,7 +61,7 @@ GstFft-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstfft-@GST_API_VERSIO
- --c-include "gst/fft/fft.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstfft-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --libtool="$(LIBTOOL)" \
-@@ -85,7 +85,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/pbutils/Makefile.am b/gst-libs/gst/pbutils/Makefile.am
-index 91dc214..dc8e1d3 100644
---- a/gst-libs/gst/pbutils/Makefile.am
-+++ b/gst-libs/gst/pbutils/Makefile.am
-@@ -79,14 +79,14 @@ GstPbutils-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstpbutils-@GST_AP
- --c-include "gst/pbutils/pbutils.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --add-include-path="$(top_builddir)/gst-libs/gst/tag/" \
- --add-include-path="$(top_builddir)/gst-libs/gst/video/" \
- --add-include-path="$(top_builddir)/gst-libs/gst/audio/" \
- --library=libgstpbutils-@GST_API_VERSION@.la \
-- --library-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-@GST_API_VERSION@` \
-- --library-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-base-@GST_API_VERSION@` \
-+ --library-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-@GST_API_VERSION@` \
-+ --library-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=libdir gstreamer-base-@GST_API_VERSION@` \
- --library-path="$(top_builddir)/gst-libs/gst/tag/" \
- --library-path="$(top_builddir)/gst-libs/gst/video/" \
- --library-path="$(top_builddir)/gst-libs/gst/audio/" \
-@@ -119,8 +119,8 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --includedir="$(top_builddir)/gst-libs/gst/tag/" \
- --includedir="$(top_builddir)/gst-libs/gst/video/" \
- --includedir="$(top_builddir)/gst-libs/gst/audio/" \
-diff --git a/gst-libs/gst/riff/Makefile.am b/gst-libs/gst/riff/Makefile.am
-index 3bd8fc0..0a115cc 100644
---- a/gst-libs/gst/riff/Makefile.am
-+++ b/gst-libs/gst/riff/Makefile.am
-@@ -41,8 +41,8 @@ libgstriff_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS)
- # --c-include "gst/riff/riff.h" \
- # --add-include-path=$(builddir)/../tag \
- # --add-include-path=$(builddir)/../audio \
--# --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--# --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+# --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+# --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- # --library=libgstriff-@GST_API_VERSION@.la \
- # --include=GstAudio-@GST_API_VERSION@ \
- # --include=GstTag-@GST_API_VERSION@ \
-@@ -73,8 +73,8 @@ libgstriff_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS)
- # --includedir=$(builddir) \
- # --includedir=$(builddir)/../tag \
- # --includedir=$(builddir)/../audio \
--# --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--# --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+# --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+# --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- # $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
- #
- #CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/rtp/Makefile.am b/gst-libs/gst/rtp/Makefile.am
-index f5445c1..527c0b4 100644
---- a/gst-libs/gst/rtp/Makefile.am
-+++ b/gst-libs/gst/rtp/Makefile.am
-@@ -59,8 +59,8 @@ GstRtp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtp-@GST_API_VERSIO
- --c-include "gst/rtp/rtp.h" \
- -I$(top_builddir)/gst-libs \
- -I$(top_srcdir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --library=libgstrtp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-@@ -87,8 +87,8 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am
-index 9b0b258..4f6d9f8 100644
---- a/gst-libs/gst/rtsp/Makefile.am
-+++ b/gst-libs/gst/rtsp/Makefile.am
-@@ -66,7 +66,7 @@ GstRtsp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_API_VERS
- -I$(top_builddir)/gst-libs \
- -I$(top_srcdir)/gst-libs \
- --add-include-path=$(builddir)/../sdp \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstrtsp-@GST_API_VERSION@.la \
- --include=Gio-2.0 \
- --include=Gst-@GST_API_VERSION@ \
-@@ -96,7 +96,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
- --includedir=$(builddir)/../sdp \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/sdp/Makefile.am b/gst-libs/gst/sdp/Makefile.am
-index 0e149b8..9aa0512 100644
---- a/gst-libs/gst/sdp/Makefile.am
-+++ b/gst-libs/gst/sdp/Makefile.am
-@@ -28,7 +28,7 @@ GstSdp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstsdp-@GST_API_VERSIO
- --warn-all \
- --c-include "gst/sdp/sdp.h" \
- -I$(top_srcdir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --library=libgstsdp-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --libtool="$(LIBTOOL)" \
-@@ -52,7 +52,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/tag/Makefile.am b/gst-libs/gst/tag/Makefile.am
-index cafafd3..ba99279 100644
---- a/gst-libs/gst/tag/Makefile.am
-+++ b/gst-libs/gst/tag/Makefile.am
-@@ -39,8 +39,8 @@ GstTag-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgsttag-@GST_API_VERSIO
- --c-include "gst/tag/tag.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --library=libgsttag-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-@@ -67,8 +67,8 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am
-index ac64eb3..342c8c6 100644
---- a/gst-libs/gst/video/Makefile.am
-+++ b/gst-libs/gst/video/Makefile.am
-@@ -108,8 +108,8 @@ GstVideo-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstvideo-@GST_API_VE
- --c-include "gst/video/video.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --library=libgstvideo-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
-@@ -136,8 +136,8 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
-+ --includedir=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
- CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-riff-add-missing-include-directories-when-calling-in.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-riff-add-missing-include-directories-when-calling-in.patch
deleted file mode 100644
index 9b66f7f49..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-riff-add-missing-include-directories-when-calling-in.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 3c2c2d5dd08aa30ed0e8acd8566ec99412bb8209 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Mon, 26 Oct 2015 17:29:37 +0200
-Subject: [PATCH 3/4] riff: add missing include directories when calling
- introspection scanner
-
-Upstream-Status: Pending [review on oe-core maillist]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- gst-libs/gst/riff/Makefile.am | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/gst-libs/gst/riff/Makefile.am b/gst-libs/gst/riff/Makefile.am
-index 0a115cc..5057a58 100644
---- a/gst-libs/gst/riff/Makefile.am
-+++ b/gst-libs/gst/riff/Makefile.am
-@@ -39,6 +39,8 @@ libgstriff_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS)
- # --strip-prefix=Gst \
- # --warn-all \
- # --c-include "gst/riff/riff.h" \
-+# -I$(top_srcdir)/gst-libs \
-+# -I$(top_builddir)/gst-libs \
- # --add-include-path=$(builddir)/../tag \
- # --add-include-path=$(builddir)/../audio \
- # --add-include-path=$(PKG_CONFIG_SYSROOT_DIR)`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-ssaparse-enhance-SSA-text-lines-parsing.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-ssaparse-enhance-SSA-text-lines-parsing.patch
deleted file mode 100644
index 9fbebd570..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0003-ssaparse-enhance-SSA-text-lines-parsing.patch
+++ /dev/null
@@ -1,225 +0,0 @@
-From be6163cfa3a255493f9d75bad9541cbfe1723fee Mon Sep 17 00:00:00 2001
-From: Mingke Wang <mingke.wang@freescale.com>
-Date: Thu, 19 Mar 2015 14:17:10 +0800
-Subject: [PATCH 3/4] ssaparse: enhance SSA text lines parsing.
-
-some parser will pass in the original ssa text line which starts with "Dialog:"
-and there's are maybe multiple Dialog lines in one input buffer.
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=747496]
-
-Signed-off-by: Mingke Wang <mingke.wang@freescale.com>
-
-diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c
-old mode 100644
-new mode 100755
-index 06ecef9..0ab5dce
---- a/gst/subparse/gstssaparse.c
-+++ b/gst/subparse/gstssaparse.c
-@@ -260,6 +260,7 @@ gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt)
- * gst_ssa_parse_push_line:
- * @parse: caller element
- * @txt: text to push
-+ * @size: text size need to be parse
- * @start: timestamp for the buffer
- * @duration: duration for the buffer
- *
-@@ -269,27 +270,133 @@ gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt)
- * Returns: result of the push of the created buffer
- */
- static GstFlowReturn
--gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt,
-+gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt, gint size,
- GstClockTime start, GstClockTime duration)
- {
- GstFlowReturn ret;
- GstBuffer *buf;
-- gchar *t, *escaped;
-+ gchar *t, *text, *p, *escaped, *p_start, *p_end;
- gint num, i, len;
-+ GstClockTime start_time = G_MAXUINT64, end_time = 0;
-
-- num = atoi (txt);
-- GST_LOG_OBJECT (parse, "Parsing line #%d at %" GST_TIME_FORMAT,
-- num, GST_TIME_ARGS (start));
--
-- /* skip all non-text fields before the actual text */
-+ p = text = g_malloc(size + 1);
-+ *p = '\0';
- t = txt;
-- for (i = 0; i < 8; ++i) {
-- t = strchr (t, ',');
-+
-+ /* there are may have multiple dialogue lines at a time */
-+ while (*t) {
-+ /* ignore leading white space characters */
-+ while (isspace(*t))
-+ t++;
-+
-+ /* ignore Format: and Style: lines */
-+ if (strncmp(t, "Format:", 7) == 0 || strncmp(t, "Style:", 6) == 0) {
-+ while (*t != '\0' && *t != '\n') {
-+ t++;
-+ }
-+ }
-+
-+ if (*t == '\0')
-+ break;
-+
-+ /* continue with next line */
-+ if (*t == '\n') {
-+ t++;
-+ continue;
-+ }
-+
-+ if(strncmp(t, "Dialogue:", 9) != 0) {
-+ /* not started with "Dialogue:", it must be a line trimmed by demuxer */
-+ num = atoi (t);
-+ GST_LOG_OBJECT (parse, "Parsing line #%d at %" GST_TIME_FORMAT,
-+ num, GST_TIME_ARGS (start));
-+
-+ /* skip all non-text fields before the actual text */
-+ for (i = 0; i < 8; ++i) {
-+ t = strchr (t, ',');
-+ if (t == NULL)
-+ break;
-+ ++t;
-+ }
-+ } else {
-+ /* started with "Dialogue:", update timestamp and duration */
-+ /* time format are like Dialog:Mark,0:00:01.02,0:00:03.04,xx,xxx,... */
-+ guint hour, min, sec, msec, len;
-+ GstClockTime tmp;
-+ gchar t_str[12] = {0};
-+
-+ /* find the first ',' */
-+ p_start = strchr (t, ',');
-+ if (p_start)
-+ p_end = strchr (++p_start, ',');
-+
-+ if (p_start && p_end) {
-+ /* copy text between first ',' and second ',' */
-+ strncpy(t_str, p_start, p_end - p_start);
-+ if (sscanf (t_str, "%u:%u:%u.%u", &hour, &min, &sec, &msec) == 4) {
-+ tmp = ((hour*3600) + (min*60) + sec) * GST_SECOND + msec*GST_MSECOND;
-+ GST_DEBUG_OBJECT (parse, "Get start time:%02d:%02d:%02d:%03d\n",
-+ hour, min, sec, msec);
-+ if (start_time > tmp)
-+ start_time = tmp;
-+ } else {
-+ GST_WARNING_OBJECT (parse,
-+ "failed to parse ssa start timestamp string :%s", t_str);
-+ }
-+
-+ p_start = p_end;
-+ p_end = strchr (++p_start, ',');
-+ if (p_end) {
-+ /* copy text between second ',' and third ',' */
-+ strncpy(t_str, p_start, p_end - p_start);
-+ if (sscanf (t_str, "%u:%u:%u.%u", &hour, &min, &sec, &msec) == 4) {
-+ tmp = ((hour*3600) + (min*60) + sec)*GST_SECOND + msec*GST_MSECOND;
-+ GST_DEBUG_OBJECT(parse, "Get end time:%02d:%02d:%02d:%03d\n",
-+ hour, min, sec, msec);
-+ if (end_time < tmp)
-+ end_time = tmp;
-+ } else {
-+ GST_WARNING_OBJECT (parse,
-+ "failed to parse ssa end timestamp string :%s", t_str);
-+ }
-+ }
-+ }
-+
-+ /* now skip all non-text fields before the actual text */
-+ for (i = 0; i <= 8; ++i) {
-+ t = strchr (t, ',');
-+ if (t == NULL)
-+ break;
-+ ++t;
-+ }
-+ }
-+
-+ /* line end before expected number of ',', not a Dialogue line */
- if (t == NULL)
-- return GST_FLOW_ERROR;
-- ++t;
-+ break;
-+
-+ /* if not the first line, and the last character of previous line is '\0',
-+ * then replace it with '\N' */
-+ if (p != text && *p == '\0') {
-+ *p++ = '\\';
-+ *p++ = 'N';
-+ }
-+
-+ /* copy all actual text of this line */
-+ while ((*t != '\0') && (*t != '\n'))
-+ *p++ = *t++;
-+
-+ /* add a terminator at the end */
-+ *p = '\0';
-+ }
-+
-+ /* not valid text found in this buffer return OK to let caller unref buffer */
-+ if (strlen(text) <= 0) {
-+ GST_WARNING_OBJECT (parse, "Not valid text found in this buffer\n");
-+ return GST_FLOW_ERROR;
- }
-
-+ t = text;
- GST_LOG_OBJECT (parse, "Text : %s", t);
-
- if (gst_ssa_parse_remove_override_codes (parse, t)) {
-@@ -307,13 +414,22 @@ gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt,
- gst_buffer_fill (buf, 0, escaped, len + 1);
- gst_buffer_set_size (buf, len);
- g_free (escaped);
-+ g_free(t);
-+
-+ if (start_time != G_MAXUINT64)
-+ GST_BUFFER_TIMESTAMP (buf) = start_time;
-+ else
-+ GST_BUFFER_TIMESTAMP (buf) = start;
-
-- GST_BUFFER_TIMESTAMP (buf) = start;
-- GST_BUFFER_DURATION (buf) = duration;
-+ if (end_time > start_time)
-+ GST_BUFFER_DURATION (buf) = end_time - start_time;
-+ else
-+ GST_BUFFER_DURATION (buf) = duration;
-
- GST_LOG_OBJECT (parse, "Pushing buffer with timestamp %" GST_TIME_FORMAT
-- " and duration %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
-- GST_TIME_ARGS (duration));
-+ " and duration %" GST_TIME_FORMAT,
-+ GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
-+ GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-
- ret = gst_pad_push (parse->srcpad, buf);
-
-@@ -333,6 +449,7 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
- GstClockTime ts;
- gchar *txt;
- GstMapInfo map;
-+ gint size;
-
- if (G_UNLIKELY (!parse->framed))
- goto not_framed;
-@@ -350,13 +467,14 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
- /* make double-sure it's 0-terminated and all */
- gst_buffer_map (buf, &map, GST_MAP_READ);
- txt = g_strndup ((gchar *) map.data, map.size);
-+ size = map.size;
- gst_buffer_unmap (buf, &map);
-
- if (txt == NULL)
- goto empty_text;
-
- ts = GST_BUFFER_TIMESTAMP (buf);
-- ret = gst_ssa_parse_push_line (parse, txt, ts, GST_BUFFER_DURATION (buf));
-+ ret = gst_ssa_parse_push_line (parse, txt, size, ts, GST_BUFFER_DURATION (buf));
-
- if (ret != GST_FLOW_OK && GST_CLOCK_TIME_IS_VALID (ts)) {
- GstSegment segment;
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-rtsp-drop-incorrect-reference-to-gstreamer-sdp-in-Ma.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-rtsp-drop-incorrect-reference-to-gstreamer-sdp-in-Ma.patch
deleted file mode 100644
index 42d99c1db..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-rtsp-drop-incorrect-reference-to-gstreamer-sdp-in-Ma.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 4330915d88dc4dd46eb4c28d756482b767c2747f Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Mon, 26 Oct 2015 17:30:14 +0200
-Subject: [PATCH 4/4] rtsp: drop incorrect reference to gstreamer-sdp in
- Makefile.am
-
-Upstream-Status: Pending [review on oe-core maillist]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- gst-libs/gst/rtsp/Makefile.am | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am
-index 4f6d9f8..0afa370 100644
---- a/gst-libs/gst/rtsp/Makefile.am
-+++ b/gst-libs/gst/rtsp/Makefile.am
-@@ -74,7 +74,6 @@ GstRtsp-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_API_VERS
- --libtool="$(LIBTOOL)" \
- --pkg gio-2.0 \
- --pkg gstreamer-@GST_API_VERSION@ \
-- --pkg gstreamer-sdp-@GST_API_VERSION@ \
- --pkg-export gstreamer-rtsp-@GST_API_VERSION@ \
- --add-init-section="$(INTROSPECTION_INIT)" \
- --output $@ \
---
-2.6.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-subparse-set-need_segment-after-sink-pad-received-GS.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-subparse-set-need_segment-after-sink-pad-received-GS.patch
deleted file mode 100644
index 7813915d8..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0004-subparse-set-need_segment-after-sink-pad-received-GS.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From ed09c8fd2c9c2b5384b72cc70af3728be6694e64 Mon Sep 17 00:00:00 2001
-From: Mingke Wang <mingke.wang@freescale.com>
-Date: Thu, 19 Mar 2015 14:20:26 +0800
-Subject: [PATCH 4/4] subparse: set need_segment after sink pad received
- GST_EVENT_SEGMENT
-
-subparse works in push mode, chain funciton will be called once
-up stream element finished the seeking and flushing.
-if set need_segment flag in src pad event handler, the segment
-event will be pushed earlier, result in the subtitle text will
-be send out to down stream from the beginning.
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=747498]
-
-Signed-off-by: Mingke Wang <mingke.wang@freescale.com>
-
-diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c
-old mode 100644
-new mode 100755
-index b565e93..7741ccc
---- a/gst/subparse/gstsubparse.c
-+++ b/gst/subparse/gstsubparse.c
-@@ -266,22 +266,20 @@ gst_sub_parse_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
- goto beach;
- }
-
-+ /* Apply the seek to our segment */
-+ gst_segment_do_seek (&self->segment, rate, format, flags,
-+ start_type, start, stop_type, stop, &update);
-+
-+ GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
-+ &self->segment);
-+
- /* Convert that seek to a seeking in bytes at position 0,
- FIXME: could use an index */
- ret = gst_pad_push_event (self->sinkpad,
- gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
- GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0));
-
-- if (ret) {
-- /* Apply the seek to our segment */
-- gst_segment_do_seek (&self->segment, rate, format, flags,
-- start_type, start, stop_type, stop, &update);
--
-- GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
-- &self->segment);
--
-- self->need_segment = TRUE;
-- } else {
-+ if (!ret) {
- GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
- }
-
-@@ -1632,8 +1630,10 @@ gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
- gst_event_parse_segment (event, &s);
- if (s->format == GST_FORMAT_TIME)
- gst_event_copy_segment (event, &self->segment);
-- GST_DEBUG_OBJECT (self, "newsegment (%s)",
-- gst_format_get_name (self->segment.format));
-+ GST_DEBUG_OBJECT (self, "newsegment (%s) %" GST_SEGMENT_FORMAT,
-+ gst_format_get_name (self->segment.format), &self->segment);
-+
-+ self->need_segment = TRUE;
-
- /* if not time format, we'll either start with a 0 timestamp anyway or
- * it's following a seek in which case we'll have saved the requested
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0005-convertframe-Support-video-crop-when-convert-frame.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0005-convertframe-Support-video-crop-when-convert-frame.patch
deleted file mode 100755
index 096a6f4cb..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/0005-convertframe-Support-video-crop-when-convert-frame.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 5be6ed00aad028d9cbb4e0c63af0be69d335c71e Mon Sep 17 00:00:00 2001
-From: Song Bing <b06498@freescale.com>
-Date: Fri, 11 Dec 2015 21:42:00 +0800
-Subject: [PATCH] convertframe: Support video crop when convert frame
-
-Get thumbnail will user convertframe to convert video frame to
-desired video format and size. But haven't process crop meta on
-the video buffer. Add support video crop.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=759329
-
-Upstream-Status: Backport [1.7.1]
-
----
- gst-libs/gst/video/convertframe.c | 65 +++++++++++++++++++++++++++++++++------
- 1 file changed, 56 insertions(+), 9 deletions(-)
-
-diff --git a/gst-libs/gst/video/convertframe.c b/gst-libs/gst/video/convertframe.c
-index aa9c3d3..942a51e 100644
---- a/gst-libs/gst/video/convertframe.c
-+++ b/gst-libs/gst/video/convertframe.c
-@@ -110,12 +110,23 @@ fail:
- static GstElement *
- build_convert_frame_pipeline (GstElement ** src_element,
- GstElement ** sink_element, const GstCaps * from_caps,
-- const GstCaps * to_caps, GError ** err)
-+ GstVideoCropMeta * cmeta, const GstCaps * to_caps, GError ** err)
- {
-- GstElement *src = NULL, *csp = NULL, *vscale = NULL;
-- GstElement *sink = NULL, *encoder = NULL, *pipeline;
-+ GstElement *vcrop = NULL, *csp = NULL, *csp2 = NULL, *vscale = NULL;
-+ GstElement *src = NULL, *sink = NULL, *encoder = NULL, *pipeline;
-+ GstVideoInfo info;
- GError *error = NULL;
-
-+ if (cmeta) {
-+ if (!create_element ("videocrop", &vcrop, &error)) {
-+ g_warning
-+ ("build_convert_frame_pipeline: Buffer has crop metadata but videocrop element is not found. Cropping will be disabled");
-+ } else {
-+ if (!create_element ("videoconvert", &csp2, &error))
-+ goto no_elements;
-+ }
-+ }
-+
- /* videoscale is here to correct for the pixel-aspect-ratio for us */
- GST_DEBUG ("creating elements");
- if (!create_element ("appsrc", &src, &error) ||
-@@ -133,15 +144,42 @@ build_convert_frame_pipeline (GstElement ** src_element,
-
- GST_DEBUG ("adding elements");
- gst_bin_add_many (GST_BIN (pipeline), src, csp, vscale, sink, NULL);
-+ if (vcrop)
-+ gst_bin_add_many (GST_BIN (pipeline), vcrop, csp2, NULL);
-
- /* set caps */
- g_object_set (src, "caps", from_caps, NULL);
-+ if (vcrop) {
-+ gst_video_info_from_caps (&info, from_caps);
-+ g_object_set (vcrop, "left", cmeta->x, NULL);
-+ g_object_set (vcrop, "top", cmeta->y, NULL);
-+ g_object_set (vcrop, "right", GST_VIDEO_INFO_WIDTH (&info) - cmeta->width,
-+ NULL);
-+ g_object_set (vcrop, "bottom",
-+ GST_VIDEO_INFO_HEIGHT (&info) - cmeta->height, NULL);
-+ GST_DEBUG ("crop meta [x,y,width,height]: %d %d %d %d", cmeta->x, cmeta->y,
-+ cmeta->width, cmeta->height);
-+ }
- g_object_set (sink, "caps", to_caps, NULL);
-
- /* FIXME: linking is still way too expensive, profile this properly */
-- GST_DEBUG ("linking src->csp");
-- if (!gst_element_link_pads (src, "src", csp, "sink"))
-- goto link_failed;
-+ if (vcrop) {
-+ GST_DEBUG ("linking src->csp2");
-+ if (!gst_element_link_pads (src, "src", csp2, "sink"))
-+ goto link_failed;
-+
-+ GST_DEBUG ("linking csp2->vcrop");
-+ if (!gst_element_link_pads (csp2, "src", vcrop, "sink"))
-+ goto link_failed;
-+
-+ GST_DEBUG ("linking vcrop->csp");
-+ if (!gst_element_link_pads (vcrop, "src", csp, "sink"))
-+ goto link_failed;
-+ } else {
-+ GST_DEBUG ("linking src->csp");
-+ if (!gst_element_link_pads (src, "src", csp, "sink"))
-+ goto link_failed;
-+ }
-
- GST_DEBUG ("linking csp->vscale");
- if (!gst_element_link_pads_full (csp, "src", vscale, "sink",
-@@ -193,8 +231,12 @@ no_elements:
- {
- if (src)
- gst_object_unref (src);
-+ if (vcrop)
-+ gst_object_unref (vcrop);
- if (csp)
- gst_object_unref (csp);
-+ if (csp2)
-+ gst_object_unref (csp2);
- if (vscale)
- gst_object_unref (vscale);
- if (sink)
-@@ -209,7 +251,11 @@ no_elements:
- no_pipeline:
- {
- gst_object_unref (src);
-+ if (vcrop)
-+ gst_object_unref (vcrop);
- gst_object_unref (csp);
-+ if (csp2)
-+ gst_object_unref (csp2);
- gst_object_unref (vscale);
- gst_object_unref (sink);
-
-@@ -282,7 +328,8 @@ gst_video_convert_sample (GstSample * sample, const GstCaps * to_caps,
- }
-
- pipeline =
-- build_convert_frame_pipeline (&src, &sink, from_caps, to_caps_copy, &err);
-+ build_convert_frame_pipeline (&src, &sink, from_caps,
-+ gst_buffer_get_video_crop_meta (buf), to_caps_copy, &err);
- if (!pipeline)
- goto no_pipeline;
-
-@@ -646,8 +693,8 @@ gst_video_convert_sample_async (GstSample * sample,
- }
-
- pipeline =
-- build_convert_frame_pipeline (&src, &sink, from_caps, to_caps_copy,
-- &error);
-+ build_convert_frame_pipeline (&src, &sink, from_caps,
-+ gst_buffer_get_video_crop_meta (buf), to_caps_copy, &error);
- if (!pipeline)
- goto no_pipeline;
-
---
-2.5.0
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch
deleted file mode 100644
index 325671721..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 540e02c92c75e08b90326863dc787fa5cadf9da6 Mon Sep 17 00:00:00 2001
-From: Song Bing <b06498@freescale.com>
-Date: Fri, 13 Mar 2015 18:04:31 +0800
-Subject: [PATCH] encodebin: Need more buffers in output queue for better
- performance
-
-Need more buffers in output queue for better performance
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=744191]
-
-Signed-off-by: Song Bing <b06498@freescale.com>
----
- gst/encoding/gstencodebin.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c
-index 6728e58..32daae4 100644
---- a/gst/encoding/gstencodebin.c
-+++ b/gst/encoding/gstencodebin.c
-@@ -1138,8 +1138,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
- * We only use a 1buffer long queue here, the actual queueing will be done
- * in the input queue */
- last = sgroup->outqueue = gst_element_factory_make ("queue", NULL);
-- g_object_set (sgroup->outqueue, "max-size-buffers", (guint32) 1,
-- "max-size-bytes", (guint32) 0, "max-size-time", (guint64) 0,
-+ g_object_set (sgroup->outqueue, "max-size-time", (guint64) 0,
- "silent", TRUE, NULL);
-
- gst_bin_add (GST_BIN (ebin), sgroup->outqueue);
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/get-caps-from-src-pad-when-query-caps.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/get-caps-from-src-pad-when-query-caps.patch
deleted file mode 100644
index 284abbe94..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/get-caps-from-src-pad-when-query-caps.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From af0dac26f62aaceb4bf266720911953793e0fc5d Mon Sep 17 00:00:00 2001
-From: zhouming <b42586@freescale.com>
-Date: Wed, 14 May 2014 10:16:20 +0800
-Subject: [PATCH] ENGR00312515: get caps from src pad when query caps
-
-https://bugzilla.gnome.org/show_bug.cgi?id=728312
-
-Upstream-Status: Pending
-
-Signed-off-by: zhouming <b42586@freescale.com>
----
- gst-libs/gst/tag/gsttagdemux.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
- mode change 100644 => 100755 gst-libs/gst/tag/gsttagdemux.c
-
-diff --git a/gst-libs/gst/tag/gsttagdemux.c b/gst-libs/gst/tag/gsttagdemux.c
-old mode 100644
-new mode 100755
-index 9b6c478..ae2294a
---- a/gst-libs/gst/tag/gsttagdemux.c
-+++ b/gst-libs/gst/tag/gsttagdemux.c
-@@ -1708,6 +1708,19 @@ gst_tag_demux_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
- }
- break;
- }
-+ case GST_QUERY_CAPS:
-+ {
-+
-+ /* We can hijack caps query if we typefind already */
-+ if (demux->priv->src_caps) {
-+ gst_query_set_caps_result (query, demux->priv->src_caps);
-+ res = TRUE;
-+ } else {
-+ res = gst_pad_query_default (pad, parent, query);
-+ }
-+ break;
-+ }
-+
- default:
- res = gst_pad_query_default (pad, parent, query);
- break;
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/make-gio_unix_2_0-dependency-configurable.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/make-gio_unix_2_0-dependency-configurable.patch
deleted file mode 100644
index 01e944ddd..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base/make-gio_unix_2_0-dependency-configurable.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 10d2a977ee1d469f0bf9059bb2d0b55fd2eecbac Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Wed, 20 Jan 2016 13:00:00 -0800
-Subject: [PATCH] make gio_unix_2_0 dependency configurable
-
-Prior to 1.7.1, gst-plugins-base accepted a configure option to
-disable gio_unix_2_0, however it was implemented incorrectly using
-AG_GST_CHECK_FEATURE. That was fixed in 1.7.1 by making the
-dependency unconditional.
-
- http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=aadefefba88afe4acbe64454650f24e7ce7c8d70
-
-To make builds deterministic, re-instate support for
---disable-gio_unix_2_0, but implement it using the AC_ARG_ENABLE
-instead of AG_GST_CHECK_FEATURE.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- configure.ac | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 9c52aeb..26cacd6 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -747,9 +747,16 @@ AC_SUBST(FT2_CFLAGS)
- AC_SUBST(FT2_LIBS)
-
- dnl *** gio-unix-2.0 for tests/check/pipelines/tcp.c ***
-+AC_ARG_ENABLE([gio_unix_2_0],
-+ [AS_HELP_STRING([--disable-gio_unix_2_0],[disable use of gio_unix_2_0])],
-+ [],
-+ [enable_gio_unix_2_0=yes])
-+
-+if test "x${enable_gio_unix_2_0}" != "xno"; then
- PKG_CHECK_MODULES(GIO_UNIX_2_0, gio-unix-2.0 >= 2.24,
- HAVE_GIO_UNIX_2_0="yes",
- HAVE_GIO_UNIX_2_0="no")
-+fi
- AM_CONDITIONAL(USE_GIO_UNIX_2_0, test "x$HAVE_GIO_UNIX_2_0" = "xyes")
-
- dnl *** finalize CFLAGS, LDFLAGS, LIBS
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_1.6.3.bb
deleted file mode 100644
index 429dc9338..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_1.6.3.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-include gstreamer1.0-plugins-base.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=c54ce9345727175ff66d17b67ff51f58 \
- file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
- file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607"
-
-# Note: The dependency on freetype was dropped shortly after the 1.7.1 release
-# so these lines should be removed during the update to 1.8.x
-# http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=183610c035dd6955c9b3540b940aec50474af031
-DEPENDS += "freetype"
-EXTRA_OECONF += "--disable-freetypetest"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-${PV}.tar.xz \
- file://get-caps-from-src-pad-when-query-caps.patch \
- file://0003-ssaparse-enhance-SSA-text-lines-parsing.patch \
- file://0004-subparse-set-need_segment-after-sink-pad-received-GS.patch \
- file://encodebin-Need-more-buffers-in-output-queue-for-bett.patch \
- file://0005-convertframe-Support-video-crop-when-convert-frame.patch \
-"
-
-SRC_URI[md5sum] = "3ddde0ad598ef69f58d6a2e87f8b460f"
-SRC_URI[sha256sum] = "b6154f8fdba4877e95efd94610ef0ada4f0171cd12eb829a3c3c97345d9c7a75"
-
-S = "${WORKDIR}/gst-plugins-base-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_git.bb
deleted file mode 100644
index 38a9fcc29..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-base_git.bb
+++ /dev/null
@@ -1,27 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-plugins-base.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=c54ce9345727175ff66d17b67ff51f58 \
- file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
- file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-plugins-base;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
- file://make-gio_unix_2_0-dependency-configurable.patch \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "97e108bebaa58821f4566a74cbf0135e93407c01"
-SRCREV_common = "b64f03f6090245624608beb5d2fff335e23a01c0"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good.inc
deleted file mode 100644
index 4621bf894..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-require gstreamer1.0-plugins.inc
-
-LICENSE = "GPLv2+ & LGPLv2.1+"
-
-DEPENDS += "gstreamer1.0-plugins-base libcap zlib bzip2"
-
-inherit gettext
-
-PACKAGECONFIG ??= " \
- ${GSTREAMER_ORC} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
- cairo flac gdk-pixbuf gudev jpeg libpng soup speex taglib v4l2 \
-"
-
-X11DEPENDS = "virtual/libx11 libsm libxrender libxfixes libxdamage"
-
-PACKAGECONFIG[cairo] = "--enable-cairo,--disable-cairo,cairo"
-PACKAGECONFIG[dv1394] = "--enable-dv1394,--disable-dv1394,libiec61883 libavc1394 libraw1394"
-PACKAGECONFIG[flac] = "--enable-flac,--disable-flac,flac"
-PACKAGECONFIG[gdk-pixbuf] = "--enable-gdk_pixbuf,--disable-gdk_pixbuf,gdk-pixbuf"
-PACKAGECONFIG[gudev] = "--with-gudev,--without-gudev,libgudev"
-PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack"
-PACKAGECONFIG[jpeg] = "--enable-jpeg,--disable-jpeg,jpeg"
-PACKAGECONFIG[libpng] = "--enable-libpng,--disable-libpng,libpng"
-PACKAGECONFIG[libv4l2] = "--with-libv4l2,--without-libv4l2,libv4l2"
-PACKAGECONFIG[pulseaudio] = "--enable-pulse,--disable-pulse,pulseaudio"
-PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4"
-PACKAGECONFIG[speex] = "--enable-speex,--disable-speex,speex"
-PACKAGECONFIG[taglib] = "--enable-taglib,--disable-taglib,taglib"
-PACKAGECONFIG[v4l2] = "--enable-gst_v4l2,--disable-gst_v4l2"
-PACKAGECONFIG[vpx] = "--enable-vpx,--disable-vpx,libvpx"
-PACKAGECONFIG[wavpack] = "--enable-wavpack,--disable-wavpack,wavpack"
-PACKAGECONFIG[x11] = "--enable-x,--disable-x,${X11DEPENDS}"
-
-EXTRA_OECONF += " \
- --enable-bz2 \
- --enable-oss \
- --enable-zlib \
- --disable-aalib \
- --disable-aalibtest \
- --disable-directsound \
- --disable-libcaca \
- --disable-libdv \
- --disable-oss4 \
- --disable-osx_audio \
- --disable-osx_video \
- --disable-shout2 \
- --disable-sunaudio \
- --disable-waveform \
-"
-
-FILES_${PN}-equalizer += "${datadir}/gstreamer-1.0/presets/*.prs"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/0001-gstrtpmp4gpay-set-dafault-value-for-MPEG4-without-co.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/0001-gstrtpmp4gpay-set-dafault-value-for-MPEG4-without-co.patch
deleted file mode 100755
index d1973d439..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/0001-gstrtpmp4gpay-set-dafault-value-for-MPEG4-without-co.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From c782a30482908a4b4dd9cd4abff9f9bc4016698f Mon Sep 17 00:00:00 2001
-From: Song Bing <b06498@freescale.com>
-Date: Tue, 5 Aug 2014 14:40:46 +0800
-Subject: [PATCH] gstrtpmp4gpay: set dafault value for MPEG4 without codec
- data in caps.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=734263
-
-Upstream-Status: Submitted
-
-Signed-off-by: Song Bing <b06498@freescale.com>
----
- gst/rtp/gstrtpmp4gpay.c | 19 ++++++++++++++++++-
- 1 file changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/gst/rtp/gstrtpmp4gpay.c b/gst/rtp/gstrtpmp4gpay.c
-index 7913d9a..1749d39 100644
---- a/gst/rtp/gstrtpmp4gpay.c
-+++ b/gst/rtp/gstrtpmp4gpay.c
-@@ -390,6 +390,7 @@ gst_rtp_mp4g_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
- const GValue *codec_data;
- const gchar *media_type = NULL;
- gboolean res;
-+ const gchar *name;
-
- rtpmp4gpay = GST_RTP_MP4G_PAY (payload);
-
-@@ -400,7 +401,6 @@ gst_rtp_mp4g_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
- GST_LOG_OBJECT (rtpmp4gpay, "got codec_data");
- if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
- GstBuffer *buffer;
-- const gchar *name;
-
- buffer = gst_value_get_buffer (codec_data);
- GST_LOG_OBJECT (rtpmp4gpay, "configuring codec_data");
-@@ -426,6 +426,23 @@ gst_rtp_mp4g_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
-
- rtpmp4gpay->config = gst_buffer_copy (buffer);
- }
-+ } else {
-+ name = gst_structure_get_name (structure);
-+
-+ if (!strcmp (name, "video/mpeg")) {
-+ rtpmp4gpay->profile = g_strdup ("1");
-+
-+ /* fixed rate */
-+ rtpmp4gpay->rate = 90000;
-+ /* video stream type */
-+ rtpmp4gpay->streamtype = "4";
-+ /* no params for video */
-+ rtpmp4gpay->params = NULL;
-+ /* mode */
-+ rtpmp4gpay->mode = "generic";
-+
-+ media_type = "video";
-+ }
- }
- if (media_type == NULL)
- goto config_failed;
---
-1.7.9.5
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/avoid-including-sys-poll.h-directly.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/avoid-including-sys-poll.h-directly.patch
deleted file mode 100644
index c7f3630ec..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/avoid-including-sys-poll.h-directly.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 4bfe2c8570a4a7080ec662504882969054d8a072 Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Wed, 3 Feb 2016 18:12:38 -0800
-Subject: [PATCH] avoid including <sys/poll.h> directly
-
-musl libc generates warnings if <sys/poll.h> is included directly.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- ext/raw1394/gstdv1394src.c | 2 +-
- ext/raw1394/gsthdv1394src.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c
-index dbc7607..3c42b41 100644
---- a/ext/raw1394/gstdv1394src.c
-+++ b/ext/raw1394/gstdv1394src.c
-@@ -37,7 +37,7 @@
- #include "config.h"
- #endif
- #include <unistd.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <sys/socket.h>
- #include <errno.h>
- #include <fcntl.h>
-diff --git a/ext/raw1394/gsthdv1394src.c b/ext/raw1394/gsthdv1394src.c
-index 0b07a37..9785a15 100644
---- a/ext/raw1394/gsthdv1394src.c
-+++ b/ext/raw1394/gsthdv1394src.c
-@@ -36,7 +36,7 @@
- #include "config.h"
- #endif
- #include <unistd.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <sys/socket.h>
- #include <errno.h>
- #include <fcntl.h>
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/ensure-valid-sentinel-for-gst_structure_get.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/ensure-valid-sentinel-for-gst_structure_get.patch
deleted file mode 100644
index bc7ac0b6a..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good/ensure-valid-sentinel-for-gst_structure_get.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 2169f2205c0205a220d826d7573e5a863bd36e0a Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <armccurdy@gmail.com>
-Date: Tue, 9 Feb 2016 14:00:00 -0800
-Subject: [PATCH] ensure valid sentinal for gst_structure_get()
-
-gst_structure_get() is declared with G_GNUC_NULL_TERMINATED, ie
-__attribute__((__sentinel__)), which means gcc will generate a
-warning if the last parameter passed to the function is not NULL
-(where a valid NULL in this context is defined as zero with any
-pointer type).
-
-The C code callers to gst_structure_get() within gst-plugins-good
-use the C NULL definition (ie ((void*)0)), which is a valid sentinel.
-
-However gstid3v2mux.cc uses the C++ NULL definition (ie 0L), which
-is not a valid sentinel without an explicit cast to a pointer type.
-
-Upstream-Status: Pending
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
----
- ext/taglib/gstid3v2mux.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ext/taglib/gstid3v2mux.cc b/ext/taglib/gstid3v2mux.cc
-index 8651e77..a87234f 100644
---- a/ext/taglib/gstid3v2mux.cc
-+++ b/ext/taglib/gstid3v2mux.cc
-@@ -465,7 +465,7 @@ add_image_tag (ID3v2::Tag * id3v2tag, const GstTagList * list,
-
- if (info_struct) {
- if (gst_structure_get (info_struct, "image-type",
-- GST_TYPE_TAG_IMAGE_TYPE, &image_type, NULL)) {
-+ GST_TYPE_TAG_IMAGE_TYPE, &image_type, (void *) NULL)) {
- if (image_type > 0 && image_type <= 18) {
- image_type += 2;
- } else {
---
-1.9.1
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_1.6.3.bb
deleted file mode 100644
index 0b4f43690..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_1.6.3.bb
+++ /dev/null
@@ -1,15 +0,0 @@
-include gstreamer1.0-plugins-good.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
- file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607 \
- file://gst/replaygain/rganalysis.c;beginline=1;endline=23;md5=b60ebefd5b2f5a8e0cab6bfee391a5fe"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${PV}.tar.xz \
- file://0001-gstrtpmp4gpay-set-dafault-value-for-MPEG4-without-co.patch \
-"
-
-SRC_URI[md5sum] = "a1958df7aa498b42793e2f2048673815"
-SRC_URI[sha256sum] = "24b19db70b2a83461ebddfe20033db432dadfdb5d4b54ffb1dfa0d830134a177"
-
-S = "${WORKDIR}/gst-plugins-good-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_git.bb
deleted file mode 100644
index 9cadc9afc..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-good_git.bb
+++ /dev/null
@@ -1,28 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-plugins-good.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
- file://common/coverage/coverage-report.pl;beginline=2;endline=17;md5=a4e1830fce078028c8f0974161272607 \
- file://gst/replaygain/rganalysis.c;beginline=1;endline=23;md5=b60ebefd5b2f5a8e0cab6bfee391a5fe"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-plugins-good;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
- file://avoid-including-sys-poll.h-directly.patch \
- file://ensure-valid-sentinel-for-gst_structure_get.patch \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "1b6fdce67c15d59957e395b1957aa625322092d4"
-SRCREV_common = "b64f03f6090245624608beb5d2fff335e23a01c0"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly.inc
deleted file mode 100644
index aff223072..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly.inc
+++ /dev/null
@@ -1,31 +0,0 @@
-require gstreamer1.0-plugins.inc
-
-LICENSE = "GPLv2+ & LGPLv2.1+ & LGPLv2+"
-LICENSE_FLAGS = "commercial"
-
-DEPENDS += "gstreamer1.0-plugins-base libid3tag"
-
-inherit gettext
-
-PACKAGECONFIG ??= " \
- ${GSTREAMER_ORC} \
- a52dec lame mad mpeg2dec \
-"
-
-PACKAGECONFIG[a52dec] = "--enable-a52dec,--disable-a52dec,liba52"
-PACKAGECONFIG[amrnb] = "--enable-amrnb,--disable-amrnb,opencore-amr"
-PACKAGECONFIG[amrwb] = "--enable-amrwb,--disable-amrwb,opencore-amr"
-PACKAGECONFIG[cdio] = "--enable-cdio,--disable-cdio,libcdio"
-PACKAGECONFIG[dvdread] = "--enable-dvdread,--disable-dvdread,libdvdread"
-PACKAGECONFIG[lame] = "--enable-lame,--disable-lame,lame"
-PACKAGECONFIG[mad] = "--enable-mad,--disable-mad,libmad"
-PACKAGECONFIG[mpeg2dec] = "--enable-mpeg2dec,--disable-mpeg2dec,mpeg2dec"
-PACKAGECONFIG[x264] = "--enable-x264,--disable-x264,x264"
-
-EXTRA_OECONF += " \
- --disable-sidplay \
- --disable-twolame \
-"
-
-FILES_${PN}-amrnb += "${datadir}/gstreamer-1.0/presets/GstAmrnbEnc.prs"
-FILES_${PN}-x264 += "${datadir}/gstreamer-1.0/presets/GstX264Enc.prs"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_1.6.3.bb
deleted file mode 100644
index 7edfb81d2..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_1.6.3.bb
+++ /dev/null
@@ -1,13 +0,0 @@
-include gstreamer1.0-plugins-ugly.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
- file://tests/check/elements/xingmux.c;beginline=1;endline=21;md5=4c771b8af188724855cb99cadd390068"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \
-"
-
-SRC_URI[md5sum] = "dbd92afb3816cbfa90ab1f197144a2e2"
-SRC_URI[sha256sum] = "2fecf7b7c7882f8f62f1900048f4013f98c214fb3d3303d8d812245bb41fd064"
-
-S = "${WORKDIR}/gst-plugins-ugly-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_git.bb
deleted file mode 100644
index 69afe4cfb..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins-ugly_git.bb
+++ /dev/null
@@ -1,41 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0-plugins-ugly.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
- file://tests/check/elements/xingmux.c;beginline=1;endline=21;md5=4c771b8af188724855cb99cadd390068"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gst-plugins-ugly;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "8bdb68edbc605e21314b608e7a39bdbaab7302b8"
-SRCREV_common = "b64f03f6090245624608beb5d2fff335e23a01c0"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-# The mpg123 plugin was added prior to the 1.7.2 release
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=43bd45ba991ef3247957ca37cdcb52f4b8c0acb1
-PACKAGECONFIG[mpg123] = "--enable-mpg123,--disable-mpg123,mpg123"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
-
-# In 1.7.2, the mpg123 plugin was moved from -bad to -ugly
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=08d8aefcdaaf89ecb6dd53ec1e4f95cd42d01664
-# https://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=43bd45ba991ef3247957ca37cdcb52f4b8c0acb1
-
-PACKAGESPLITFUNCS_append = " handle_mpg123_rename "
-
-python handle_mpg123_rename () {
- d.setVar('RPROVIDES_gstreamer1.0-plugins-ugly-mpg123', 'gstreamer1.0-plugins-bad-mpg123')
- d.setVar('RREPLACES_gstreamer1.0-plugins-ugly-mpg123', 'gstreamer1.0-plugins-bad-mpg123')
- d.setVar('RCONFLICTS_gstreamer1.0-plugins-ugly-mpg123', 'gstreamer1.0-plugins-bad-mpg123')
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins.inc
deleted file mode 100644
index 2dcec509d..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-plugins.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-SUMMARY = "Plugins for the GStreamer multimedia framework 1.x"
-HOMEPAGE = "http://gstreamer.freedesktop.org/"
-BUGTRACKER = "https://bugzilla.gnome.org/enter_bug.cgi?product=Gstreamer"
-SECTION = "multimedia"
-
-DEPENDS = "gstreamer1.0 glib-2.0-native"
-
-inherit autotools pkgconfig upstream-version-is-even gobject-introspection
-
-acpaths = "-I ${S}/common/m4 -I ${S}/m4"
-
-LIBV = "1.0"
-require gst-plugins-package.inc
-
-# Orc enables runtime JIT compilation of data processing routines from Orc
-# bytecode to SIMD instructions for various architectures (currently SSE, MMX,
-# MIPS, Altivec and NEON are supported).
-
-GSTREAMER_ORC ?= "orc"
-
-PACKAGECONFIG[debug] = "--enable-debug,--disable-debug"
-PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc orc-native"
-PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind"
-
-export ORCC = "${STAGING_DIR_NATIVE}${bindir}/orcc"
-
-EXTRA_OECONF = " \
- --disable-examples \
-"
-
-SRC_URI_append = " file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch"
-
-delete_pkg_m4_file() {
- # This m4 file is out of date and is missing PKG_CONFIG_SYSROOT_PATH tweaks which we need for introspection
- rm "${S}/common/m4/pkg.m4" || true
-}
-
-do_configure[prefuncs] += " delete_pkg_m4_file"
-
-PACKAGES_DYNAMIC = "^${PN}-.*"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server.inc
deleted file mode 100644
index ae6d36477..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "A library on top of GStreamer for building an RTSP server"
-HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/"
-SECTION = "multimedia"
-LICENSE = "LGPLv2"
-
-DEPENDS = "gstreamer1.0 libcgroup gstreamer1.0-plugins-base"
-
-PNREAL = "gst-rtsp-server"
-
-SRC_URI = "http://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz \
- file://0001-Don-t-hardcode-libtool-name-when-using-introspection.patch \
- file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch"
-
-S = "${WORKDIR}/${PNREAL}-${PV}"
-
-inherit autotools pkgconfig upstream-version-is-even gobject-introspection
-
-delete_pkg_m4_file() {
- # This m4 file is out of date and is missing PKG_CONFIG_SYSROOT_PATH tweaks which we need for introspection
- rm "${S}/common/m4/pkg.m4" || true
-}
-
-do_configure[prefuncs] += " delete_pkg_m4_file"
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server/0001-Don-t-hardcode-libtool-name-when-using-introspection.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server/0001-Don-t-hardcode-libtool-name-when-using-introspection.patch
deleted file mode 100644
index 89d6384ad..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server/0001-Don-t-hardcode-libtool-name-when-using-introspection.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 4a12569e5ae5be63cd92a9b178860026a99746b1 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Tue, 27 Oct 2015 16:55:45 +0200
-Subject: [PATCH] Don't hardcode libtool name when using introspection
-
-Upstream-Status: Pending [review on oe-core maillist]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- gst/rtsp-server/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gst/rtsp-server/Makefile.am b/gst/rtsp-server/Makefile.am
-index 4fcd366..c67f5ab 100644
---- a/gst/rtsp-server/Makefile.am
-+++ b/gst/rtsp-server/Makefile.am
-@@ -87,7 +87,7 @@ GstRtspServer-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstrtspserver-@
- --include=Gst-@GST_API_VERSION@ \
- --include=GstRtsp-@GST_API_VERSION@ \
- --include=GstNet-@GST_API_VERSION@ \
-- --libtool="$(top_builddir)/libtool" \
-+ --libtool="$(LIBTOOL)" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-rtsp-@GST_API_VERSION@ \
- --pkg gstreamer-net-@GST_API_VERSION@ \
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server_1.6.2.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server_1.6.2.bb
deleted file mode 100644
index 5bdae6cf9..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0-rtsp-server_1.6.2.bb
+++ /dev/null
@@ -1,6 +0,0 @@
-include gstreamer1.0-rtsp-server.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d"
-
-SRC_URI[md5sum] = "a1cafefb5fc14ac5d7e7d8cdbdfa9694"
-SRC_URI[sha256sum] = "0f51f9879556c0950203c766b09a1b62f1f25b17f9a7d516e01b13ecf93c8858"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0.inc b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0.inc
deleted file mode 100644
index 10b4668e5..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0.inc
+++ /dev/null
@@ -1,58 +0,0 @@
-SUMMARY = "GStreamer 1.0 multimedia framework"
-DESCRIPTION = "GStreamer is a multimedia framework for encoding and decoding video and sound. \
-It supports a wide range of formats including mp3, ogg, avi, mpeg and quicktime."
-HOMEPAGE = "http://gstreamer.freedesktop.org/"
-BUGTRACKER = "https://bugzilla.gnome.org/enter_bug.cgi?product=Gstreamer"
-SECTION = "multimedia"
-LICENSE = "LGPLv2+"
-
-DEPENDS = "glib-2.0 glib-2.0-native libcap libxml2 bison-native flex-native"
-
-inherit autotools pkgconfig gettext upstream-version-is-even gobject-introspection
-
-# This way common/m4/introspection.m4 will come first
-# (it has a custom INTROSPECTION_INIT macro, and so must be used instead of our common introspection.m4 file)
-acpaths = "-I ${S}/common/m4 -I ${S}/m4"
-
-SRC_URI_append = " \
- file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
-"
-
-PACKAGECONFIG ??= ""
-
-PACKAGECONFIG[check] = "--enable-check,--disable-check"
-PACKAGECONFIG[debug] = "--enable-debug,--disable-debug"
-PACKAGECONFIG[tests] = "--enable-tests,--disable-tests"
-PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind,"
-
-EXTRA_OECONF = " \
- --disable-dependency-tracking \
- --disable-docbook \
- --disable-examples \
- --disable-gtk-doc \
-"
-
-CACHED_CONFIGUREVARS += "ac_cv_header_valgrind_valgrind_h=no"
-
-# musl libc generates warnings if <sys/poll.h> is included directly
-CACHED_CONFIGUREVARS += "ac_cv_header_sys_poll_h=no"
-
-PACKAGES += "${PN}-bash-completion"
-
-FILES_${PN} += "${libdir}/gstreamer-1.0/*.so"
-FILES_${PN}-dev += "${libdir}/gstreamer-1.0/*.la ${libdir}/gstreamer-1.0/*.a ${libdir}/gstreamer-1.0/include"
-FILES_${PN}-bash-completion += "${datadir}/bash-completion/completions/ ${datadir}/bash-completion/helpers/gst*"
-
-RRECOMMENDS_${PN}_qemux86 += "kernel-module-snd-ens1370 kernel-module-snd-rawmidi"
-RRECOMMENDS_${PN}_qemux86-64 += "kernel-module-snd-ens1370 kernel-module-snd-rawmidi"
-
-delete_pkg_m4_file() {
- # This m4 file is out of date and is missing PKG_CONFIG_SYSROOT_PATH tweaks which we need for introspection
- rm "${S}/common/m4/pkg.m4" || true
-}
-
-do_configure[prefuncs] += " delete_pkg_m4_file"
-
-do_compile_prepend() {
- export GIR_EXTRA_LIBS_PATH="${B}/gst/.libs:${B}/libs/gst/base/.libs"
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0/0001-Fix-crash-with-gst-inspect.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0/0001-Fix-crash-with-gst-inspect.patch
deleted file mode 100644
index 94f5cc56e..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0/0001-Fix-crash-with-gst-inspect.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 6b26f3dbf9bf577d71534ab7410de66d06e46ba2 Mon Sep 17 00:00:00 2001
-From: Carlos Rafael Giani <dv@pseudoterminal.org>
-Date: Sat, 6 Apr 2013 23:52:11 +0200
-Subject: [PATCH] Fix crash with gst-inspect Chris Lord <chris@openedhand.com>
-
-Upstream-Status: Pending
-
-Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
----
- tools/gst-inspect.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c
-index 23b7c44..b79b02e 100644
---- a/tools/gst-inspect.c
-+++ b/tools/gst-inspect.c
-@@ -1556,7 +1556,7 @@ main (int argc, char *argv[])
- g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
-- g_printerr ("Error initializing: %s\n", err->message);
-+ g_printerr ("Error initializing: %s\n", err ? err->message : "(null)");
- return -1;
- }
- g_option_context_free (ctx);
---
-1.8.2
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_1.6.3.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_1.6.3.bb
deleted file mode 100644
index ba1b83b08..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_1.6.3.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-include gstreamer1.0.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \
- file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d"
-
-SRC_URI = " \
- http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \
- file://0001-Fix-crash-with-gst-inspect.patch \
-"
-
-SRC_URI[md5sum] = "b4cdeb2b9cb20dd6ac022a4f417eae0d"
-SRC_URI[sha256sum] = "22f9568d67b87cf700a111f381144bd37cb93790a77e4e331db01fe854a37f24"
-
-S = "${WORKDIR}/gstreamer-${PV}"
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_git.bb
deleted file mode 100644
index 7715bb202..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-backport/gstreamer_bp_krogoth/gstreamer1.0_git.bb
+++ /dev/null
@@ -1,30 +0,0 @@
-DEFAULT_PREFERENCE = "-1"
-
-include gstreamer1.0.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \
- file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d"
-
-SRC_URI = " \
- git://anongit.freedesktop.org/gstreamer/gstreamer;name=base \
- git://anongit.freedesktop.org/gstreamer/common;destsuffix=git/common;name=common \
-"
-
-PV = "1.7.2+git${SRCPV}"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
-
-SRCREV_base = "9e33bfa2c7a5f43da2c49b0a8235fd43cba9feaf"
-SRCREV_common = "b64f03f6090245624608beb5d2fff335e23a01c0"
-SRCREV_FORMAT = "base"
-
-S = "${WORKDIR}/git"
-
-# The option to configure tracer hooks was added prior to the 1.7.2 release
-# https://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=e5ca47236e4df4683707f0bcf99181a937d358d5
-PACKAGECONFIG[gst-tracer-hooks] = "--enable-gst-tracer-hooks,--disable-gst-tracer-hooks,"
-PACKAGECONFIG[trace-historic] = "--enable-trace,--disable-trace,"
-
-do_configure_prepend() {
- ${S}/autogen.sh --noconfigure
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend
deleted file mode 100644
index 47c0fec7b..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-
-SRC_URI_append = " file://0001-fix-arm-trusted-firmware-build-for-gcc6.patch"
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-fix-arm-trusted-firmware-build-for-gcc6.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-fix-arm-trusted-firmware-build-for-gcc6.patch
deleted file mode 100644
index 744f9f5f5..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-fix-arm-trusted-firmware-build-for-gcc6.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 26927f2aff43607b422ce5cb463ee4eccbdaef5a Mon Sep 17 00:00:00 2001
-From: Ronan Le Martret <ronan.lemartret@iot.bzh>
-Date: Thu, 23 Feb 2017 14:18:06 +0100
-Subject: [PATCH] Fix arm-trusted-firmware build for gcc6
-
-Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
----
- include/lib/smcc.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/lib/smcc.h b/include/lib/smcc.h
-index c415ba1..e648692 100644
---- a/include/lib/smcc.h
-+++ b/include/lib/smcc.h
-@@ -57,7 +57,7 @@
- #define SMC_64 1
- #define SMC_32 0
- #define SMC_UNK 0xffffffff
--#define SMC_TYPE_FAST 1
-+#define SMC_TYPE_FAST 1U
- #define SMC_TYPE_STD 0
- #define SMC_PREEMPTED 0xfffffffe
- /*******************************************************************************
---
-2.6.6
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-Remove-the-file-generation-and-directly-copy-the-fil.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-Remove-the-file-generation-and-directly-copy-the-fil.patch
deleted file mode 100644
index 14b91699a..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-Remove-the-file-generation-and-directly-copy-the-fil.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From f9e26ca66938281a635cdac2fbeda7418488aac8 Mon Sep 17 00:00:00 2001
-From: Ronan Le Martret <ronan.lemartret@iot.bzh>
-Date: Thu, 23 Mar 2017 15:20:45 +0100
-Subject: [PATCH] Remove the file generation and directly copy the files.
-
-Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
----
- lib/libutee/tui/sub.mk | 12 ++++--------
- 1 file changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/lib/libutee/tui/sub.mk b/lib/libutee/tui/sub.mk
-index 517cde4..d55340c 100644
---- a/lib/libutee/tui/sub.mk
-+++ b/lib/libutee/tui/sub.mk
-@@ -11,19 +11,15 @@ produce-additional-default_bold = default_bold.h
- produce-default_bold = default_bold.c
- depends-default_bold := scripts/render_font.py \
- $(sub-dir)/fonts/amble/Amble-Bold.ttf
--recipe-default_bold := scripts/render_font.py \
-- --font_file $(sub-dir)/fonts/amble/Amble-Bold.ttf \
-- --font_size 20 --font_name default_bold \
-- --out_dir $(sub-dir-out)
-+recipe-default_bold := cp $(sub-dir)/fonts/amble/default_bold.{c,h} \
-+ $(sub-dir-out)
-
- gensrcs-y += default_regular
- produce-additional-default_regular = default_regular.h
- produce-default_regular = default_regular.c
- depends-default_regular := scripts/render_font.py \
- $(sub-dir)/fonts/amble/Amble-Regular.ttf
--recipe-default_regular := scripts/render_font.py \
-- --font_file $(sub-dir)/fonts/amble/Amble-Regular.ttf \
-- --font_size 20 --font_name default_regular \
-- --out_dir $(sub-dir-out)
-+recipe-default_regular := cp $(sub-dir)/fonts/amble/default_regular.{c,h} \
-+ $(sub-dir-out)
-
-
---
-2.6.6
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.c b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.c
deleted file mode 100644
index 4fbbadddd..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*
- * This file is auto generated with
- * scripts/render_font.py --font_file lib/libutee/tui/fonts/amble/Amble-Bold.ttf --font_size 20 --font_name default_bold --out_dir out/arm-plat-rcar/ta_arm64-lib/libutee/tui
- * do not edit.
- */
-#include "font.h"
-
-static const unsigned char letter_20[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_21[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,
- 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_22[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x6e, 0x00, 0x6e, 0x00, 0x6c, 0x00,
- 0x6c, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_23[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0e, 0x60, 0x0e, 0x60, 0x0e, 0xe0,
- 0x3f, 0xf8, 0x3f, 0xf8, 0x0c, 0xe0, 0x0c, 0xe0,
- 0x1c, 0xc0, 0x7f, 0xf8, 0x7f, 0xf8, 0x1c, 0xc0,
- 0x19, 0xc0, 0x19, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_24[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x0f, 0x80, 0x3f, 0xc0, 0x3d, 0xc0,
- 0x78, 0x00, 0x78, 0x00, 0x3c, 0x00, 0x1f, 0x00,
- 0x0f, 0xc0, 0x01, 0xc0, 0x00, 0xe0, 0x00, 0xe0,
- 0x3f, 0xc0, 0x3f, 0x80, 0x0f, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_25[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c,
- 0x18, 0x00, 0x7e, 0x30, 0x00, 0x66, 0x20, 0x00,
- 0x66, 0x60, 0x00, 0x3c, 0xc0, 0x00, 0x01, 0x80,
- 0x00, 0x01, 0x80, 0x00, 0x03, 0x3c, 0x00, 0x06,
- 0x6c, 0x00, 0x06, 0x66, 0x00, 0x0c, 0x66, 0x00,
- 0x18, 0x7c, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_26[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x00, 0x1f, 0xc0, 0x39, 0xc0,
- 0x39, 0xc0, 0x1f, 0x80, 0x1f, 0x00, 0x1f, 0x00,
- 0x3f, 0x80, 0x73, 0xf0, 0x71, 0xf0, 0x79, 0xf0,
- 0x3f, 0xf8, 0x1f, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_27[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_28[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
- 0x0c, 0x00, 0x1c, 0x00, 0x18, 0x00, 0x38, 0x00,
- 0x38, 0x00, 0x30, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x30, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x18, 0x00, 0x1c, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_29[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
- 0x70, 0x00, 0x30, 0x00, 0x38, 0x00, 0x18, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x18, 0x00, 0x38, 0x00, 0x38, 0x00, 0x30, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x6d, 0x80,
- 0x7f, 0x80, 0x0e, 0x00, 0x1f, 0x00, 0x3b, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x7f, 0xc0,
- 0x7f, 0xc0, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x38, 0x30, 0x30, 0x70, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_2d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_2f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x00, 0x07, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x38, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x60, 0x00, 0x60, 0x00, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_30[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x00, 0x3f, 0x80, 0x39, 0xc0,
- 0x71, 0xc0, 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x71, 0xc0, 0x39, 0xc0,
- 0x3f, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_31[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x00, 0x3f, 0x00, 0x37, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x3f, 0xc0, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_32[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x7f, 0xc0, 0x33, 0xc0,
- 0x01, 0xe0, 0x01, 0xc0, 0x01, 0xc0, 0x07, 0x80,
- 0x0f, 0x00, 0x1c, 0x00, 0x38, 0x00, 0x70, 0x00,
- 0x7f, 0xe0, 0x7f, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_33[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x00, 0x7f, 0x80, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0x1f, 0x80, 0x1f, 0x80,
- 0x01, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x21, 0xc0,
- 0x7f, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_34[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x80, 0x07, 0x80, 0x07, 0x80,
- 0x0f, 0x80, 0x1d, 0x80, 0x19, 0x80, 0x39, 0x80,
- 0x31, 0x80, 0x73, 0xc0, 0x7f, 0xe0, 0x7f, 0xe0,
- 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_35[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0xc0, 0x3f, 0xc0, 0x30, 0x00,
- 0x30, 0x00, 0x7f, 0x00, 0x7f, 0xc0, 0x01, 0xc0,
- 0x00, 0xe0, 0x00, 0xe0, 0x01, 0xe0, 0x03, 0xc0,
- 0x7f, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_36[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x80, 0x1f, 0x80, 0x3c, 0x00,
- 0x38, 0x00, 0x77, 0x80, 0x7f, 0xc0, 0x79, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x78, 0xe0, 0x39, 0xc0,
- 0x1f, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_37[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xe0, 0x7f, 0xe0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0x80, 0x03, 0x80, 0x03, 0x80,
- 0x07, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x0c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_38[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3f, 0xc0, 0x79, 0xc0,
- 0x71, 0xc0, 0x39, 0xc0, 0x3f, 0x80, 0x3f, 0x80,
- 0x71, 0xc0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xe0,
- 0x3f, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_39[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3f, 0x80, 0x71, 0xc0,
- 0x71, 0xc0, 0x70, 0xe0, 0x71, 0xe0, 0x3f, 0xe0,
- 0x1f, 0xe0, 0x01, 0xc0, 0x01, 0xc0, 0x03, 0xc0,
- 0x1f, 0x80, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_3b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30,
- 0x30, 0x70, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_3c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x01, 0xc0, 0x0f, 0xc0, 0x3f, 0x00,
- 0x78, 0x00, 0x78, 0x00, 0x3f, 0x00, 0x0f, 0xc0,
- 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xc0, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xc0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x00, 0x7c, 0x00, 0x1f, 0x80,
- 0x07, 0xc0, 0x07, 0xc0, 0x1f, 0x80, 0x7c, 0x00,
- 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3e, 0x00, 0x7f, 0x80, 0x43, 0x80,
- 0x03, 0x80, 0x03, 0x80, 0x07, 0x00, 0x0e, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_40[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0xf8, 0x00, 0x0f, 0xbc, 0x00, 0x1c, 0x06, 0x00,
- 0x18, 0x03, 0x00, 0x31, 0xf1, 0x80, 0x33, 0xf9,
- 0x80, 0x63, 0x19, 0x80, 0x66, 0x19, 0x80, 0x66,
- 0x31, 0x80, 0x66, 0x31, 0x80, 0x66, 0x31, 0x80,
- 0x67, 0xff, 0x00, 0x63, 0x9e, 0x00, 0x30, 0x00,
- 0x00, 0x38, 0x00, 0x00, 0x1c, 0x10, 0x00, 0x07,
- 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_41[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0x00, 0x07, 0x80, 0x0f, 0x80,
- 0x0f, 0x80, 0x1d, 0xc0, 0x1c, 0xc0, 0x18, 0xe0,
- 0x38, 0xe0, 0x3f, 0xe0, 0x3f, 0xf0, 0x70, 0x70,
- 0x70, 0x70, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_42[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x79, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x7f, 0xc0, 0x7f, 0xc0,
- 0x70, 0xe0, 0x70, 0x70, 0x70, 0x70, 0x78, 0xe0,
- 0x7f, 0xe0, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_43[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0xc0, 0x1f, 0xc0, 0x3c, 0x00,
- 0x38, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x38, 0x00, 0x3c, 0x00,
- 0x1f, 0xc0, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_44[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x71, 0xe0,
- 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x38,
- 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x71, 0xe0,
- 0x7f, 0xc0, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_45[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xc0, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x7f, 0x80, 0x7f, 0x80,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x7f, 0xc0, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_46[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xc0, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x7f, 0x80, 0x7f, 0x80,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_47[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0xe0, 0x1f, 0xe0, 0x3c, 0x00,
- 0x38, 0x00, 0x70, 0x00, 0x70, 0x00, 0x71, 0xf0,
- 0x71, 0xf0, 0x70, 0x30, 0x38, 0x30, 0x3c, 0x70,
- 0x1f, 0xf0, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_48[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x7f, 0xf8, 0x7f, 0xf8,
- 0x70, 0x38, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_49[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x0f, 0x00,
- 0x7e, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0xe0, 0x70, 0xe0, 0x71, 0xc0,
- 0x71, 0xc0, 0x73, 0x80, 0x7f, 0x80, 0x7f, 0x80,
- 0x73, 0x80, 0x71, 0xc0, 0x71, 0xc0, 0x70, 0xe0,
- 0x70, 0xf0, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x7f, 0xc0, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
- 0x0e, 0x00, 0x7c, 0x1e, 0x00, 0x7c, 0x3e, 0x00,
- 0x7e, 0x3e, 0x00, 0x7e, 0x7e, 0x00, 0x77, 0x6e,
- 0x00, 0x73, 0xee, 0x00, 0x73, 0xce, 0x00, 0x71,
- 0xce, 0x00, 0x70, 0x0e, 0x00, 0x70, 0x0e, 0x00,
- 0x70, 0x0e, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x78, 0x38, 0x78, 0x38, 0x7c, 0x38,
- 0x7e, 0x38, 0x7e, 0x38, 0x77, 0x38, 0x73, 0xb8,
- 0x71, 0xb8, 0x71, 0xf8, 0x70, 0xf8, 0x70, 0xf8,
- 0x70, 0x78, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0xe0, 0x3c, 0xf0,
- 0x70, 0x78, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x78, 0x78, 0x3c, 0xf0,
- 0x1f, 0xe0, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_50[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0x80, 0x7f, 0xe0, 0x70, 0xe0,
- 0x70, 0x70, 0x70, 0x70, 0x70, 0xe0, 0x7f, 0xe0,
- 0x7f, 0x80, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_51[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0xe0, 0x3c, 0xf0,
- 0x70, 0x78, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x78, 0x78, 0x3c, 0xf0,
- 0x1f, 0xe0, 0x0f, 0xf0, 0x00, 0x78, 0x00, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_52[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x7f, 0xc0,
- 0x7f, 0xc0, 0x71, 0xc0, 0x71, 0xc0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_53[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3f, 0xc0, 0x79, 0x80,
- 0x70, 0x00, 0x70, 0x00, 0x7c, 0x00, 0x1f, 0x00,
- 0x07, 0x80, 0x01, 0xc0, 0x01, 0xc0, 0x73, 0xc0,
- 0x7f, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_54[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xe0, 0xff, 0xe0, 0x0e, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x0e, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_55[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x70, 0x38, 0x70, 0x38,
- 0x70, 0x38, 0x70, 0x38, 0x38, 0x70, 0x3c, 0xf0,
- 0x1f, 0xe0, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_56[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70,
- 0x38, 0xe0, 0x38, 0xe0, 0x38, 0xe0, 0x19, 0xc0,
- 0x1d, 0xc0, 0x1d, 0xc0, 0x0f, 0x80, 0x0f, 0x80,
- 0x0f, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_57[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
- 0xc1, 0xc0, 0x71, 0xe3, 0x80, 0x71, 0xe3, 0x80,
- 0x71, 0xe3, 0x80, 0x71, 0xf3, 0x80, 0x33, 0xf3,
- 0x00, 0x3b, 0x37, 0x00, 0x3b, 0x37, 0x00, 0x3f,
- 0x3f, 0x00, 0x1f, 0x1f, 0x00, 0x1e, 0x1e, 0x00,
- 0x1e, 0x1e, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_58[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0xe0, 0x70, 0xe0, 0x39, 0xc0,
- 0x1d, 0xc0, 0x1f, 0x80, 0x0f, 0x00, 0x0f, 0x00,
- 0x0f, 0x00, 0x1f, 0x80, 0x3d, 0xc0, 0x39, 0xc0,
- 0x70, 0xe0, 0x70, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_59[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x70, 0x70, 0x70, 0xe0, 0x38, 0xe0,
- 0x39, 0xc0, 0x19, 0xc0, 0x1f, 0x80, 0x0f, 0x80,
- 0x0f, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x7f, 0xc0, 0x01, 0xc0,
- 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x0e, 0x00,
- 0x0e, 0x00, 0x1c, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x7f, 0xe0, 0x7f, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5b[] = {
- 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x38, 0x3e, 0x3e, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_5c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x0c, 0x00, 0x0e, 0x00, 0x0e, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
- 0x7c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x7c, 0x00,
- 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x3e, 0x00,
- 0x37, 0x00, 0x33, 0x00, 0x63, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xe0,
- 0x7f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_60[] = {
- 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x18, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_61[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x3f, 0x80, 0x23, 0xc0, 0x01, 0xc0,
- 0x1f, 0xc0, 0x7f, 0xc0, 0x71, 0xc0, 0x71, 0xc0,
- 0x7f, 0xc0, 0x3d, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_62[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x7f, 0x80, 0x7f, 0xc0, 0x79, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xe0,
- 0x7f, 0xc0, 0x77, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_63[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3f, 0x00, 0x78, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x78, 0x00,
- 0x3f, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_64[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0,
- 0x1f, 0xe0, 0x3f, 0xe0, 0x79, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xe0,
- 0x3f, 0xe0, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_65[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x3f, 0x80, 0x79, 0xc0, 0x71, 0xc0,
- 0x7f, 0xc0, 0x7f, 0xc0, 0x70, 0x00, 0x78, 0x00,
- 0x3f, 0x80, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_66[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3f, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0xfe, 0x00, 0x7e, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_67[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0xe0, 0x3f, 0xe0, 0x71, 0xc0, 0x71, 0xc0,
- 0x71, 0xc0, 0x3f, 0xc0, 0x3f, 0x00, 0x30, 0x00,
- 0x3f, 0x80, 0x3f, 0xc0, 0x70, 0xe0, 0xf0, 0xe0,
- 0x7f, 0xe0, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_68[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x77, 0x80, 0x7f, 0xc0, 0x79, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_69[] = {
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00,
- 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_6a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x1c, 0x00,
- 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x71, 0xc0, 0x73, 0xc0, 0x73, 0x80, 0x77, 0x00,
- 0x7f, 0x00, 0x7f, 0x00, 0x73, 0x80, 0x73, 0x80,
- 0x71, 0xc0, 0x71, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
- 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_6d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0xdf, 0x00, 0x7f, 0xff, 0x00, 0x78, 0xe3,
- 0x80, 0x70, 0xe3, 0x80, 0x70, 0xe3, 0x80, 0x70,
- 0xe3, 0x80, 0x70, 0xe3, 0x80, 0x70, 0xe3, 0x80,
- 0x70, 0xe3, 0x80, 0x70, 0xe3, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x80, 0x7f, 0xc0, 0x78, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3f, 0xc0, 0x79, 0xc0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xc0,
- 0x3f, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_70[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x80, 0x7f, 0xc0, 0x79, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xe0,
- 0x7f, 0xc0, 0x7f, 0x80, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_71[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1e, 0xe0, 0x3f, 0xe0, 0x79, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x79, 0xe0,
- 0x3f, 0xe0, 0x1f, 0xe0, 0x00, 0xe0, 0x00, 0xe0,
- 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_72[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x77, 0x00, 0x7e, 0x00, 0x78, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_73[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x7f, 0x00, 0x70, 0x00, 0x70, 0x00,
- 0x3e, 0x00, 0x1f, 0x00, 0x07, 0x80, 0x47, 0x80,
- 0x7f, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_74[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0xff, 0x00, 0xfe, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x3f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_75[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0,
- 0x70, 0xe0, 0x70, 0xe0, 0x70, 0xe0, 0x39, 0xe0,
- 0x3f, 0xe0, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_76[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe1, 0xc0, 0x71, 0xc0, 0x73, 0x80, 0x73, 0x80,
- 0x33, 0x00, 0x3b, 0x00, 0x3f, 0x00, 0x1e, 0x00,
- 0x1e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_77[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x63, 0x8c, 0x00, 0x73, 0x9c, 0x00, 0x73, 0x9c,
- 0x00, 0x77, 0xdc, 0x00, 0x36, 0xd8, 0x00, 0x36,
- 0xd8, 0x00, 0x3e, 0xf8, 0x00, 0x3c, 0x78, 0x00,
- 0x1c, 0x70, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_78[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x71, 0xc0, 0x3b, 0x80, 0x3b, 0x80, 0x1f, 0x00,
- 0x0e, 0x00, 0x1e, 0x00, 0x1f, 0x00, 0x3b, 0x80,
- 0x73, 0x80, 0x71, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_79[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe1, 0xc0, 0x71, 0xc0, 0x71, 0x80, 0x33, 0x80,
- 0x3b, 0x80, 0x3b, 0x00, 0x1f, 0x00, 0x1f, 0x00,
- 0x1e, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x1c, 0x00,
- 0x3c, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7f, 0x00, 0x7f, 0x00, 0x0f, 0x00, 0x0e, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x38, 0x00, 0x78, 0x00,
- 0x7f, 0x80, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
- 0x1c, 0x00, 0x1c, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x38, 0x00,
- 0x70, 0x00, 0x70, 0x00, 0x38, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x1c, 0x00,
- 0x1e, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7c[] = {
- 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x70, 0x70,
- 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70,
- 0x70, 0x70, 0x70, 0x70, 0x70, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_7d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
- 0x78, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x18, 0x00, 0x1c, 0x00,
- 0x0e, 0x00, 0x1e, 0x00, 0x1c, 0x00, 0x18, 0x00,
- 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
- 0x78, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const struct font_letter letters[] = {
- { letter_20, sizeof(letter_20), 7},
- { letter_21, sizeof(letter_21), 6},
- { letter_22, sizeof(letter_22), 9},
- { letter_23, sizeof(letter_23), 15},
- { letter_24, sizeof(letter_24), 13},
- { letter_25, sizeof(letter_25), 17},
- { letter_26, sizeof(letter_26), 16},
- { letter_27, sizeof(letter_27), 6},
- { letter_28, sizeof(letter_28), 9},
- { letter_29, sizeof(letter_29), 9},
- { letter_2a, sizeof(letter_2a), 12},
- { letter_2b, sizeof(letter_2b), 13},
- { letter_2c, sizeof(letter_2c), 7},
- { letter_2d, sizeof(letter_2d), 9},
- { letter_2e, sizeof(letter_2e), 7},
- { letter_2f, sizeof(letter_2f), 11},
- { letter_30, sizeof(letter_30), 13},
- { letter_31, sizeof(letter_31), 12},
- { letter_32, sizeof(letter_32), 13},
- { letter_33, sizeof(letter_33), 13},
- { letter_34, sizeof(letter_34), 14},
- { letter_35, sizeof(letter_35), 13},
- { letter_36, sizeof(letter_36), 13},
- { letter_37, sizeof(letter_37), 13},
- { letter_38, sizeof(letter_38), 13},
- { letter_39, sizeof(letter_39), 13},
- { letter_3a, sizeof(letter_3a), 6},
- { letter_3b, sizeof(letter_3b), 7},
- { letter_3c, sizeof(letter_3c), 12},
- { letter_3d, sizeof(letter_3d), 13},
- { letter_3e, sizeof(letter_3e), 12},
- { letter_3f, sizeof(letter_3f), 12},
- { letter_40, sizeof(letter_40), 20},
- { letter_41, sizeof(letter_41), 16},
- { letter_42, sizeof(letter_42), 14},
- { letter_43, sizeof(letter_43), 13},
- { letter_44, sizeof(letter_44), 15},
- { letter_45, sizeof(letter_45), 13},
- { letter_46, sizeof(letter_46), 12},
- { letter_47, sizeof(letter_47), 15},
- { letter_48, sizeof(letter_48), 15},
- { letter_49, sizeof(letter_49), 10},
- { letter_4a, sizeof(letter_4a), 10},
- { letter_4b, sizeof(letter_4b), 15},
- { letter_4c, sizeof(letter_4c), 12},
- { letter_4d, sizeof(letter_4d), 18},
- { letter_4e, sizeof(letter_4e), 15},
- { letter_4f, sizeof(letter_4f), 16},
- { letter_50, sizeof(letter_50), 14},
- { letter_51, sizeof(letter_51), 16},
- { letter_52, sizeof(letter_52), 15},
- { letter_53, sizeof(letter_53), 13},
- { letter_54, sizeof(letter_54), 14},
- { letter_55, sizeof(letter_55), 15},
- { letter_56, sizeof(letter_56), 16},
- { letter_57, sizeof(letter_57), 21},
- { letter_58, sizeof(letter_58), 15},
- { letter_59, sizeof(letter_59), 15},
- { letter_5a, sizeof(letter_5a), 13},
- { letter_5b, sizeof(letter_5b), 8},
- { letter_5c, sizeof(letter_5c), 12},
- { letter_5d, sizeof(letter_5d), 9},
- { letter_5e, sizeof(letter_5e), 11},
- { letter_5f, sizeof(letter_5f), 13},
- { letter_60, sizeof(letter_60), 8},
- { letter_61, sizeof(letter_61), 12},
- { letter_62, sizeof(letter_62), 14},
- { letter_63, sizeof(letter_63), 11},
- { letter_64, sizeof(letter_64), 13},
- { letter_65, sizeof(letter_65), 13},
- { letter_66, sizeof(letter_66), 11},
- { letter_67, sizeof(letter_67), 15},
- { letter_68, sizeof(letter_68), 13},
- { letter_69, sizeof(letter_69), 6},
- { letter_6a, sizeof(letter_6a), 9},
- { letter_6b, sizeof(letter_6b), 13},
- { letter_6c, sizeof(letter_6c), 6},
- { letter_6d, sizeof(letter_6d), 19},
- { letter_6e, sizeof(letter_6e), 13},
- { letter_6f, sizeof(letter_6f), 14},
- { letter_70, sizeof(letter_70), 14},
- { letter_71, sizeof(letter_71), 13},
- { letter_72, sizeof(letter_72), 10},
- { letter_73, sizeof(letter_73), 11},
- { letter_74, sizeof(letter_74), 11},
- { letter_75, sizeof(letter_75), 13},
- { letter_76, sizeof(letter_76), 14},
- { letter_77, sizeof(letter_77), 18},
- { letter_78, sizeof(letter_78), 14},
- { letter_79, sizeof(letter_79), 14},
- { letter_7a, sizeof(letter_7a), 11},
- { letter_7b, sizeof(letter_7b), 9},
- { letter_7c, sizeof(letter_7c), 6},
- { letter_7d, sizeof(letter_7d), 10},
-};
-
-const struct font font_default_bold = {
- .first = 0x20,
- .last = 0x7d,
- .letters = letters,
- .height = 26,
- .max_width = 22.0,
-};
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.h b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.h
deleted file mode 100644
index dbc58301f..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_bold.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * This file is auto generated with
- * scripts/render_font.py --font_file lib/libutee/tui/fonts/amble/Amble-Bold.ttf --font_size 20 --font_name default_bold --out_dir out/arm-plat-rcar/ta_arm64-lib/libutee/tui
- * do not edit.
- */
-#ifndef __DEFAULT_BOLD_H
-#define __DEFAULT_BOLD_H
-#include "font.h"
-extern const struct font font_default_bold;
-#endif /*__DEFAULT_BOLD_H*/
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.c b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.c
deleted file mode 100644
index 96e65cf61..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.c
+++ /dev/null
@@ -1,1024 +0,0 @@
-/*
- * This file is auto generated with
- * scripts/render_font.py --font_file lib/libutee/tui/fonts/amble/Amble-Regular.ttf --font_size 20 --font_name default_regular --out_dir out/arm-plat-rcar/ta_arm64-lib/libutee/tui
- * do not edit.
- */
-#include "font.h"
-
-static const unsigned char letter_20[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_21[] = {
- 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,
- 0x20, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_22[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x68, 0x48,
- 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_23[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0xc0, 0x0c, 0xc0, 0x0c, 0xc0,
- 0x3f, 0xf0, 0x1d, 0xc0, 0x0c, 0xc0, 0x0c, 0xc0,
- 0x1d, 0xc0, 0x7f, 0xf0, 0x19, 0x80, 0x19, 0x80,
- 0x19, 0x80, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_24[] = {
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x0f, 0x80, 0x3f, 0xc0, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x38, 0x00, 0x1e, 0x00, 0x07, 0x80,
- 0x01, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x3f, 0x80, 0x1f, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_25[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
- 0x08, 0x00, 0x36, 0x10, 0x00, 0x63, 0x30, 0x00,
- 0x22, 0x20, 0x00, 0x3e, 0x40, 0x00, 0x00, 0xc0,
- 0x00, 0x01, 0x80, 0x00, 0x01, 0x3c, 0x00, 0x03,
- 0x66, 0x00, 0x06, 0x66, 0x00, 0x04, 0x66, 0x00,
- 0x0c, 0x76, 0x00, 0x18, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_26[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x00, 0x3b, 0x80, 0x31, 0x80,
- 0x31, 0x80, 0x1b, 0x00, 0x1e, 0x00, 0x1e, 0x00,
- 0x37, 0x00, 0x63, 0xb0, 0x61, 0xe0, 0x60, 0xe0,
- 0x3f, 0xe0, 0x1f, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_27[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x40, 0x40,
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_28[] = {
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x18, 0x30, 0x30,
- 0x30, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x30, 0x30, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_29[] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x10, 0x18,
- 0x18, 0x08, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18,
- 0x18, 0x18, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_2a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x6b, 0x00,
- 0x3e, 0x00, 0x1c, 0x00, 0x16, 0x00, 0x32, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x7f, 0x80,
- 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x30, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_2d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_2e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_2f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x20, 0x00, 0x60, 0x00, 0x60, 0x00, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_30[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x00, 0x1b, 0x80, 0x30, 0xc0,
- 0x60, 0xc0, 0x60, 0xc0, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0xc0, 0x60, 0xc0, 0x30, 0xc0,
- 0x3b, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_31[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0e, 0x00, 0x3e, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x07, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_32[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3b, 0x80, 0x00, 0xc0,
- 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00,
- 0x0e, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_33[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x00, 0x33, 0x80, 0x00, 0xc0,
- 0x00, 0xc0, 0x01, 0x80, 0x1f, 0x00, 0x03, 0x80,
- 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x77, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_34[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x07, 0x80,
- 0x0d, 0x80, 0x0d, 0x80, 0x19, 0x80, 0x31, 0x80,
- 0x31, 0x80, 0x61, 0x80, 0x7f, 0xe0, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_35[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0xc0, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x20, 0x00, 0x3f, 0x00, 0x31, 0xc0,
- 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x33, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_36[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0x80, 0x1e, 0x80, 0x30, 0x00,
- 0x30, 0x00, 0x6f, 0x80, 0x79, 0xc0, 0x60, 0xc0,
- 0x60, 0x60, 0x60, 0x60, 0x30, 0x60, 0x30, 0xc0,
- 0x1d, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_37[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x03, 0x00,
- 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0c, 0x00,
- 0x0c, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_38[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3b, 0xc0, 0x70, 0xc0,
- 0x60, 0xc0, 0x31, 0xc0, 0x1f, 0x80, 0x39, 0xc0,
- 0x60, 0xc0, 0x60, 0x60, 0x60, 0x60, 0x60, 0xc0,
- 0x3b, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_39[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x3b, 0x80, 0x60, 0xc0,
- 0x60, 0xc0, 0x60, 0xc0, 0x60, 0xc0, 0x31, 0xc0,
- 0x1f, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x80,
- 0x37, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_3b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x30, 0x20, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_3c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x80, 0x07, 0x80, 0x1e, 0x00,
- 0x78, 0x00, 0x70, 0x00, 0x1e, 0x00, 0x07, 0x80,
- 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x1e, 0x00,
- 0x03, 0x80, 0x03, 0x80, 0x0f, 0x00, 0x78, 0x00,
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_3f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3e, 0x00, 0x77, 0x00, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x03, 0x00, 0x0e, 0x00,
- 0x0c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_40[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0xf0, 0x00, 0x06, 0x0c, 0x00, 0x18, 0x06, 0x00,
- 0x10, 0x03, 0x00, 0x31, 0xf1, 0x00, 0x23, 0x91,
- 0x00, 0x63, 0x11, 0x80, 0x66, 0x11, 0x80, 0x66,
- 0x11, 0x80, 0x66, 0x31, 0x80, 0x66, 0x31, 0x00,
- 0x67, 0xf3, 0x00, 0x23, 0x9c, 0x00, 0x30, 0x00,
- 0x00, 0x18, 0x00, 0x00, 0x0c, 0x10, 0x00, 0x03,
- 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_41[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00,
- 0x0d, 0x80, 0x0c, 0x80, 0x18, 0xc0, 0x18, 0xc0,
- 0x18, 0x40, 0x3f, 0xe0, 0x30, 0x60, 0x20, 0x20,
- 0x60, 0x30, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_42[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x00, 0x33, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x3f, 0x80, 0x30, 0xc0,
- 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60,
- 0x31, 0xc0, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_43[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0xc0, 0x1e, 0xc0, 0x30, 0x00,
- 0x30, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x30, 0x00, 0x38, 0x00,
- 0x1e, 0xc0, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_44[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x80, 0x33, 0xc0, 0x30, 0x60,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60,
- 0x33, 0xc0, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_45[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0xc0, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3f, 0x80,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_46[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x80, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x3f, 0x80,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_47[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x07, 0xe0, 0x1e, 0x60, 0x38, 0x00,
- 0x30, 0x00, 0x20, 0x00, 0x60, 0x00, 0x61, 0xf0,
- 0x60, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x30,
- 0x1e, 0x70, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_48[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3f, 0xf0,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_49[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7e, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
- 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
- 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00,
- 0x6e, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x60, 0x30, 0xc0, 0x30, 0xc0,
- 0x31, 0x80, 0x33, 0x80, 0x33, 0x00, 0x3e, 0x00,
- 0x33, 0x00, 0x31, 0x80, 0x31, 0x80, 0x30, 0xc0,
- 0x30, 0x60, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
- 0x0e, 0x00, 0x38, 0x1e, 0x00, 0x3c, 0x1e, 0x00,
- 0x3c, 0x36, 0x00, 0x36, 0x36, 0x00, 0x33, 0x66,
- 0x00, 0x33, 0xc6, 0x00, 0x31, 0xc6, 0x00, 0x30,
- 0x86, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00,
- 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x10, 0x38, 0x10, 0x38, 0x10,
- 0x3c, 0x10, 0x36, 0x10, 0x36, 0x10, 0x33, 0x10,
- 0x31, 0x90, 0x31, 0x90, 0x30, 0xf0, 0x30, 0x70,
- 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_4f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x80, 0x1c, 0xe0, 0x30, 0x70,
- 0x30, 0x30, 0x60, 0x10, 0x60, 0x18, 0x60, 0x18,
- 0x60, 0x18, 0x60, 0x10, 0x30, 0x30, 0x30, 0x70,
- 0x1d, 0xe0, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_50[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x80, 0x33, 0xc0, 0x30, 0x60,
- 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0xc0,
- 0x3f, 0x80, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_51[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0f, 0x80, 0x1d, 0xe0, 0x30, 0x60,
- 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x60, 0x10,
- 0x60, 0x30, 0x60, 0x30, 0x60, 0x30, 0x30, 0x60,
- 0x1d, 0xe0, 0x0f, 0xe0, 0x00, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_52[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3f, 0x80, 0x33, 0xc0, 0x30, 0x60,
- 0x30, 0x60, 0x30, 0x60, 0x30, 0xc0, 0x3f, 0x80,
- 0x31, 0x80, 0x31, 0x80, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0x60, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_53[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1f, 0x80, 0x3b, 0x80, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x38, 0x00, 0x1f, 0x00,
- 0x03, 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x73, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_54[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xe0, 0x0e, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_55[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x1d, 0xe0, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_56[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x30, 0x60, 0x30, 0x30, 0x60,
- 0x30, 0x60, 0x30, 0x60, 0x18, 0xc0, 0x18, 0xc0,
- 0x18, 0x80, 0x0d, 0x80, 0x0d, 0x80, 0x07, 0x00,
- 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_57[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
- 0xc1, 0x80, 0x60, 0xc1, 0x80, 0x61, 0xe1, 0x80,
- 0x31, 0xe3, 0x00, 0x31, 0xe3, 0x00, 0x31, 0x33,
- 0x00, 0x33, 0x33, 0x00, 0x13, 0x32, 0x00, 0x1a,
- 0x16, 0x00, 0x1e, 0x1e, 0x00, 0x1e, 0x1e, 0x00,
- 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_58[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x30, 0xc0, 0x31, 0x80,
- 0x19, 0x80, 0x1b, 0x00, 0x0f, 0x00, 0x0e, 0x00,
- 0x0f, 0x00, 0x1b, 0x00, 0x19, 0x80, 0x31, 0x80,
- 0x30, 0xc0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_59[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x60, 0x60, 0xc0, 0x30, 0xc0,
- 0x31, 0x80, 0x19, 0x80, 0x1b, 0x00, 0x0f, 0x00,
- 0x0e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7f, 0xe0, 0x00, 0xc0, 0x01, 0xc0,
- 0x01, 0x80, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00,
- 0x0c, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x7f, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x1c, 0x18, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x18, 0x1c, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_5c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x10, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00,
- 0x06, 0x00, 0x06, 0x00, 0x02, 0x00, 0x02, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x36, 0x00,
- 0x36, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_5f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_60[] = {
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x18, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_61[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x3f, 0x80, 0x01, 0x80, 0x01, 0x80,
- 0x1f, 0x80, 0x31, 0x80, 0x61, 0x80, 0x61, 0x80,
- 0x73, 0x80, 0x3c, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_62[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x3f, 0x00, 0x3b, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0x60, 0x30, 0x60, 0x30, 0xc0, 0x30, 0xc0,
- 0x3f, 0x80, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_63[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3d, 0x00, 0x30, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x30, 0x00,
- 0x3d, 0x80, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_64[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x1e, 0xc0, 0x3b, 0xc0, 0x30, 0xc0, 0x60, 0xc0,
- 0x60, 0xc0, 0x60, 0xc0, 0x60, 0xc0, 0x30, 0xc0,
- 0x3f, 0xc0, 0x1f, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_65[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3b, 0x80, 0x30, 0xc0, 0x60, 0xc0,
- 0x7f, 0xc0, 0x60, 0x00, 0x60, 0x00, 0x30, 0x00,
- 0x3d, 0x80, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_66[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x18, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x7e, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_67[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0xe0, 0x3b, 0xc0, 0x70, 0xc0, 0x60, 0xc0,
- 0x31, 0xc0, 0x1f, 0x80, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x3f, 0xc0, 0x60, 0xc0, 0x60, 0x60,
- 0x7b, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_68[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x37, 0x80, 0x3d, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_69[] = {
- 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_6a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x38, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x31, 0x80, 0x31, 0x80, 0x33, 0x00, 0x36, 0x00,
- 0x3e, 0x00, 0x36, 0x00, 0x33, 0x00, 0x33, 0x00,
- 0x31, 0x80, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6c[] = {
- 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_6d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3f, 0x9e, 0x00, 0x38, 0xe3, 0x00, 0x30, 0xc3,
- 0x00, 0x30, 0xc3, 0x00, 0x30, 0xc3, 0x00, 0x30,
- 0xc3, 0x00, 0x30, 0xc3, 0x00, 0x30, 0xc3, 0x00,
- 0x30, 0xc3, 0x00, 0x30, 0xc3, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6e[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x37, 0x80, 0x39, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_6f[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0f, 0x00, 0x3b, 0x80, 0x30, 0xc0, 0x60, 0xc0,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0xc0, 0x30, 0xc0,
- 0x3b, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_70[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3f, 0x00, 0x39, 0xc0, 0x30, 0xc0, 0x30, 0x40,
- 0x30, 0x60, 0x30, 0x60, 0x30, 0xc0, 0x30, 0xc0,
- 0x3f, 0x80, 0x3f, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_71[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1e, 0xc0, 0x3b, 0xc0, 0x30, 0xc0, 0x60, 0xc0,
- 0x60, 0xc0, 0x60, 0xc0, 0x60, 0xc0, 0x30, 0xc0,
- 0x3f, 0xc0, 0x1e, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_72[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x26, 0x00, 0x3c, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_73[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x33, 0x00, 0x60, 0x00, 0x60, 0x00,
- 0x3c, 0x00, 0x0f, 0x00, 0x03, 0x00, 0x03, 0x00,
- 0x77, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_74[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x7e, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x3a, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_75[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0, 0x30, 0xc0,
- 0x31, 0xc0, 0x1e, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_76[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x61, 0x80, 0x61, 0x80, 0x61, 0x80, 0x33, 0x00,
- 0x33, 0x00, 0x33, 0x00, 0x16, 0x00, 0x1e, 0x00,
- 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_77[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x61, 0x0c, 0x00, 0x63, 0x8c, 0x00, 0x63, 0x8c,
- 0x00, 0x23, 0x88, 0x00, 0x26, 0xd8, 0x00, 0x36,
- 0xd8, 0x00, 0x34, 0x58, 0x00, 0x1c, 0x70, 0x00,
- 0x18, 0x70, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_78[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x61, 0x80, 0x31, 0x80, 0x13, 0x00, 0x1e, 0x00,
- 0x0c, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x33, 0x00,
- 0x31, 0x80, 0x61, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_79[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x60, 0x80, 0x61, 0x80, 0x61, 0x80, 0x31, 0x00,
- 0x33, 0x00, 0x13, 0x00, 0x1a, 0x00, 0x1e, 0x00,
- 0x0e, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00,
- 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7a[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7f, 0x80, 0x03, 0x80, 0x03, 0x00, 0x06, 0x00,
- 0x0c, 0x00, 0x1c, 0x00, 0x18, 0x00, 0x30, 0x00,
- 0x70, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7b[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x10, 0x00, 0x30, 0x00, 0x30, 0x00,
- 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x10, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char letter_7c[] = {
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const unsigned char letter_7d[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
- 0x30, 0x00, 0x30, 0x00, 0x10, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x0c, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00,
- 0x18, 0x00, 0x18, 0x00, 0x10, 0x00, 0x30, 0x00,
- 0x30, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const struct font_letter letters[] = {
- { letter_20, sizeof(letter_20), 7},
- { letter_21, sizeof(letter_21), 6},
- { letter_22, sizeof(letter_22), 8},
- { letter_23, sizeof(letter_23), 15},
- { letter_24, sizeof(letter_24), 12},
- { letter_25, sizeof(letter_25), 18},
- { letter_26, sizeof(letter_26), 15},
- { letter_27, sizeof(letter_27), 5},
- { letter_28, sizeof(letter_28), 8},
- { letter_29, sizeof(letter_29), 8},
- { letter_2a, sizeof(letter_2a), 11},
- { letter_2b, sizeof(letter_2b), 12},
- { letter_2c, sizeof(letter_2c), 7},
- { letter_2d, sizeof(letter_2d), 9},
- { letter_2e, sizeof(letter_2e), 6},
- { letter_2f, sizeof(letter_2f), 11},
- { letter_30, sizeof(letter_30), 13},
- { letter_31, sizeof(letter_31), 12},
- { letter_32, sizeof(letter_32), 13},
- { letter_33, sizeof(letter_33), 13},
- { letter_34, sizeof(letter_34), 13},
- { letter_35, sizeof(letter_35), 13},
- { letter_36, sizeof(letter_36), 13},
- { letter_37, sizeof(letter_37), 13},
- { letter_38, sizeof(letter_38), 13},
- { letter_39, sizeof(letter_39), 13},
- { letter_3a, sizeof(letter_3a), 6},
- { letter_3b, sizeof(letter_3b), 7},
- { letter_3c, sizeof(letter_3c), 12},
- { letter_3d, sizeof(letter_3d), 13},
- { letter_3e, sizeof(letter_3e), 12},
- { letter_3f, sizeof(letter_3f), 11},
- { letter_40, sizeof(letter_40), 19},
- { letter_41, sizeof(letter_41), 15},
- { letter_42, sizeof(letter_42), 13},
- { letter_43, sizeof(letter_43), 13},
- { letter_44, sizeof(letter_44), 14},
- { letter_45, sizeof(letter_45), 11},
- { letter_46, sizeof(letter_46), 11},
- { letter_47, sizeof(letter_47), 14},
- { letter_48, sizeof(letter_48), 14},
- { letter_49, sizeof(letter_49), 9},
- { letter_4a, sizeof(letter_4a), 10},
- { letter_4b, sizeof(letter_4b), 14},
- { letter_4c, sizeof(letter_4c), 11},
- { letter_4d, sizeof(letter_4d), 17},
- { letter_4e, sizeof(letter_4e), 14},
- { letter_4f, sizeof(letter_4f), 15},
- { letter_50, sizeof(letter_50), 12},
- { letter_51, sizeof(letter_51), 16},
- { letter_52, sizeof(letter_52), 13},
- { letter_53, sizeof(letter_53), 12},
- { letter_54, sizeof(letter_54), 13},
- { letter_55, sizeof(letter_55), 14},
- { letter_56, sizeof(letter_56), 15},
- { letter_57, sizeof(letter_57), 20},
- { letter_58, sizeof(letter_58), 13},
- { letter_59, sizeof(letter_59), 13},
- { letter_5a, sizeof(letter_5a), 14},
- { letter_5b, sizeof(letter_5b), 7},
- { letter_5c, sizeof(letter_5c), 11},
- { letter_5d, sizeof(letter_5d), 9},
- { letter_5e, sizeof(letter_5e), 11},
- { letter_5f, sizeof(letter_5f), 12},
- { letter_60, sizeof(letter_60), 8},
- { letter_61, sizeof(letter_61), 12},
- { letter_62, sizeof(letter_62), 12},
- { letter_63, sizeof(letter_63), 11},
- { letter_64, sizeof(letter_64), 13},
- { letter_65, sizeof(letter_65), 12},
- { letter_66, sizeof(letter_66), 10},
- { letter_67, sizeof(letter_67), 13},
- { letter_68, sizeof(letter_68), 12},
- { letter_69, sizeof(letter_69), 6},
- { letter_6a, sizeof(letter_6a), 9},
- { letter_6b, sizeof(letter_6b), 12},
- { letter_6c, sizeof(letter_6c), 6},
- { letter_6d, sizeof(letter_6d), 18},
- { letter_6e, sizeof(letter_6e), 12},
- { letter_6f, sizeof(letter_6f), 13},
- { letter_70, sizeof(letter_70), 12},
- { letter_71, sizeof(letter_71), 13},
- { letter_72, sizeof(letter_72), 9},
- { letter_73, sizeof(letter_73), 11},
- { letter_74, sizeof(letter_74), 10},
- { letter_75, sizeof(letter_75), 12},
- { letter_76, sizeof(letter_76), 13},
- { letter_77, sizeof(letter_77), 17},
- { letter_78, sizeof(letter_78), 12},
- { letter_79, sizeof(letter_79), 12},
- { letter_7a, sizeof(letter_7a), 12},
- { letter_7b, sizeof(letter_7b), 9},
- { letter_7c, sizeof(letter_7c), 5},
- { letter_7d, sizeof(letter_7d), 9},
-};
-
-const struct font font_default_regular = {
- .first = 0x20,
- .last = 0x7d,
- .letters = letters,
- .height = 26,
- .max_width = 21.0,
-};
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.h b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.h
deleted file mode 100644
index 28ae28420..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os/default_regular.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * This file is auto generated with
- * scripts/render_font.py --font_file lib/libutee/tui/fonts/amble/Amble-Regular.ttf --font_size 20 --font_name default_regular --out_dir out/arm-plat-rcar/ta_arm64-lib/libutee/tui
- * do not edit.
- */
-#ifndef __DEFAULT_REGULAR_H
-#define __DEFAULT_REGULAR_H
-#include "font.h"
-extern const struct font font_default_regular;
-#endif /*__DEFAULT_REGULAR_H*/
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bbappend
deleted file mode 100644
index 135b2a430..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bbappend
+++ /dev/null
@@ -1,23 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-inherit pythonnative
-DEPENDS += " python-pycrypto-native"
-
-#Need for gcc 6.2
-CFLAGS += " -fno-strict-aliasing -Wno-unused-variable -Wno-shift-negative-value"
-
-SRC_URI_append = " \
- file://default_bold.c \
- file://default_bold.h \
- file://default_regular.c \
- file://default_regular.h \
- file://0001-Remove-the-file-generation-and-directly-copy-the-fil.patch \
- "
-
-
-do_compile_prepend() {
- GENDIRECTORY=${S}/lib/libutee/tui/fonts/amble/
- cp ${WORKDIR}/default_bold.c ${GENDIRECTORY}
- cp ${WORKDIR}/default_bold.h ${GENDIRECTORY}
- cp ${WORKDIR}/default_regular.c ${GENDIRECTORY}
- cp ${WORKDIR}/default_regular.h ${GENDIRECTORY}
-}
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc6.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc7.patch
index df1f786c6..a286ba680 100644
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc6.patch
+++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot/0001-fixup-build-with-gcc7.patch
@@ -1,22 +1,22 @@
From ba619c7ec7820e80d1b5b520440fdb81c31c0baf Mon Sep 17 00:00:00 2001
From: Ronan Le Martret <ronan.lemartret@iot.bzh>
Date: Fri, 14 Oct 2016 09:03:11 +0200
-Subject: [PATCH] fix gcc6 build
+Subject: [PATCH] fix gcc7 build
Signed-off-by: ronan <ronan@linux-pgnz.suse>
---
- include/linux/compiler-gcc6.h | 66 +++++++++++++++++++++++++++++++++++++++++++
+ include/linux/compiler-gcc7.h | 66 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
- create mode 100644 include/linux/compiler-gcc6.h
+ create mode 100644 include/linux/compiler-gcc7.h
-diff --git a/include/linux/compiler-gcc6.h b/include/linux/compiler-gcc6.h
+diff --git a/include/linux/compiler-gcc7.h b/include/linux/compiler-gcc7.h
new file mode 100644
index 0000000..a3d00d8
--- /dev/null
-+++ b/include/linux/compiler-gcc6.h
++++ b/include/linux/compiler-gcc7.h
@@ -0,0 +1,66 @@
+#ifndef __LINUX_COMPILER_H
-+#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
++#error "Please don't include <linux/compiler-gcc7.h> directly, include <linux/compiler.h> instead."
+#endif
+
+#define __used __attribute__((__used__))
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2015.04.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2015.04.bbappend
index b50c1da6f..6f30fa18e 100644
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2015.04.bbappend
+++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2015.04.bbappend
@@ -1,7 +1,7 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:"
SRC_URI_append = " \
- file://0001-fixup-build-with-gcc6.patch \
+ file://0001-fixup-build-with-gcc7.patch \
"
do_deploy_prepend() {
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0001-mm-larger-stack-guard-gap-between-vmas.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0001-mm-larger-stack-guard-gap-between-vmas.patch
deleted file mode 100644
index 08a4ec717..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0001-mm-larger-stack-guard-gap-between-vmas.patch
+++ /dev/null
@@ -1,935 +0,0 @@
-From 0f637a08fa3b048f1e0b0d3dc8f5cb9df3368b5d Mon Sep 17 00:00:00 2001
-From: Hugh Dickins <hughd@google.com>
-Date: Mon, 19 Jun 2017 04:03:24 -0700
-Subject: [PATCH 1/3] mm: larger stack guard gap, between vmas
-
-commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream.
-
-Stack guard page is a useful feature to reduce a risk of stack smashing
-into a different mapping. We have been using a single page gap which
-is sufficient to prevent having stack adjacent to a different mapping.
-But this seems to be insufficient in the light of the stack usage in
-userspace. E.g. glibc uses as large as 64kB alloca() in many commonly
-used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX]
-which is 256kB or stack strings with MAX_ARG_STRLEN.
-
-This will become especially dangerous for suid binaries and the default
-no limit for the stack size limit because those applications can be
-tricked to consume a large portion of the stack and a single glibc call
-could jump over the guard page. These attacks are not theoretical,
-unfortunatelly.
-
-Make those attacks less probable by increasing the stack guard gap
-to 1MB (on systems with 4k pages; but make it depend on the page size
-because systems with larger base pages might cap stack allocations in
-the PAGE_SIZE units) which should cover larger alloca() and VLA stack
-allocations. It is obviously not a full fix because the problem is
-somehow inherent, but it should reduce attack space a lot.
-
-One could argue that the gap size should be configurable from userspace,
-but that can be done later when somebody finds that the new 1MB is wrong
-for some special case applications. For now, add a kernel command line
-option (stack_guard_gap) to specify the stack gap size (in page units).
-
-Implementation wise, first delete all the old code for stack guard page:
-because although we could get away with accounting one extra page in a
-stack vma, accounting a larger gap can break userspace - case in point,
-a program run with "ulimit -S -v 20000" failed when the 1MB gap was
-counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK
-and strict non-overcommit mode.
-
-Instead of keeping gap inside the stack vma, maintain the stack guard
-gap as a gap between vmas: using vm_start_gap() in place of vm_start
-(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few
-places which need to respect the gap - mainly arch_get_unmapped_area(),
-and and the vma tree's subtree_gap support for that.
-
-Original-patch-by: Oleg Nesterov <oleg@redhat.com>
-Original-patch-by: Michal Hocko <mhocko@suse.com>
-Signed-off-by: Hugh Dickins <hughd@google.com>
-Acked-by: Michal Hocko <mhocko@suse.com>
-Tested-by: Helge Deller <deller@gmx.de> # parisc
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-[wt: backport to 4.11: adjust context]
-[wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide]
-Signed-off-by: Willy Tarreau <w@1wt.eu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- Documentation/kernel-parameters.txt | 7 ++
- arch/arc/mm/mmap.c | 2 +-
- arch/arm/mm/mmap.c | 4 +-
- arch/frv/mm/elf-fdpic.c | 2 +-
- arch/mips/mm/mmap.c | 2 +-
- arch/parisc/kernel/sys_parisc.c | 15 ++--
- arch/powerpc/mm/hugetlbpage-radix.c | 2 +-
- arch/powerpc/mm/mmap.c | 4 +-
- arch/powerpc/mm/slice.c | 2 +-
- arch/s390/mm/mmap.c | 4 +-
- arch/sh/mm/mmap.c | 4 +-
- arch/sparc/kernel/sys_sparc_64.c | 4 +-
- arch/sparc/mm/hugetlbpage.c | 2 +-
- arch/tile/mm/hugetlbpage.c | 2 +-
- arch/x86/kernel/sys_x86_64.c | 4 +-
- arch/x86/mm/hugetlbpage.c | 2 +-
- arch/xtensa/kernel/syscall.c | 2 +-
- fs/hugetlbfs/inode.c | 2 +-
- fs/proc/task_mmu.c | 4 -
- include/linux/mm.h | 53 ++++++-------
- mm/gup.c | 5 --
- mm/memory.c | 38 ---------
- mm/mmap.c | 149 +++++++++++++++++++++---------------
- 23 files changed, 152 insertions(+), 163 deletions(-)
-
-diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
-index 38556cd..bf3ecf8 100644
---- a/Documentation/kernel-parameters.txt
-+++ b/Documentation/kernel-parameters.txt
-@@ -3918,6 +3918,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
- spia_pedr=
- spia_peddr=
-
-+ stack_guard_gap= [MM]
-+ override the default stack gap protection. The value
-+ is in page units and it defines how many pages prior
-+ to (for stacks growing down) resp. after (for stacks
-+ growing up) the main stack are reserved for no other
-+ mapping. Default value is 256 pages.
-+
- stacktrace [FTRACE]
- Enabled the stack tracer on boot up.
-
-diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c
-index 2e06d56..cf4ae69 100644
---- a/arch/arc/mm/mmap.c
-+++ b/arch/arc/mm/mmap.c
-@@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
-index 66353ca..641334e 100644
---- a/arch/arm/mm/mmap.c
-+++ b/arch/arm/mm/mmap.c
-@@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -140,7 +140,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c
-index 836f147..efa59f1 100644
---- a/arch/frv/mm/elf-fdpic.c
-+++ b/arch/frv/mm/elf-fdpic.c
-@@ -74,7 +74,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
- addr = PAGE_ALIGN(addr);
- vma = find_vma(current->mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- goto success;
- }
-
-diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
-index d08ea3f..a44052c 100644
---- a/arch/mips/mm/mmap.c
-+++ b/arch/mips/mm/mmap.c
-@@ -92,7 +92,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
-index 0a393a0..1d7691f 100644
---- a/arch/parisc/kernel/sys_parisc.c
-+++ b/arch/parisc/kernel/sys_parisc.c
-@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- unsigned long len, unsigned long pgoff, unsigned long flags)
- {
- struct mm_struct *mm = current->mm;
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- unsigned long task_size = TASK_SIZE;
- int do_color_align, last_mmap;
- struct vm_unmapped_area_info info;
-@@ -115,9 +115,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- else
- addr = PAGE_ALIGN(addr);
-
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- goto found_addr;
- }
-
-@@ -141,7 +142,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- const unsigned long len, const unsigned long pgoff,
- const unsigned long flags)
- {
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct mm_struct *mm = current->mm;
- unsigned long addr = addr0;
- int do_color_align, last_mmap;
-@@ -175,9 +176,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = COLOR_ALIGN(addr, last_mmap, pgoff);
- else
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- goto found_addr;
- }
-
-diff --git a/arch/powerpc/mm/hugetlbpage-radix.c b/arch/powerpc/mm/hugetlbpage-radix.c
-index 35254a6..a2b2d97 100644
---- a/arch/powerpc/mm/hugetlbpage-radix.c
-+++ b/arch/powerpc/mm/hugetlbpage-radix.c
-@@ -65,7 +65,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- /*
-diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
-index 2f1e443..5bc2845 100644
---- a/arch/powerpc/mm/mmap.c
-+++ b/arch/powerpc/mm/mmap.c
-@@ -106,7 +106,7 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -142,7 +142,7 @@ radix__arch_get_unmapped_area_topdown(struct file *filp,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
-index 2b27458..c4d5c9c 100644
---- a/arch/powerpc/mm/slice.c
-+++ b/arch/powerpc/mm/slice.c
-@@ -105,7 +105,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr,
- if ((mm->task_size - len) < addr)
- return 0;
- vma = find_vma(mm, addr);
-- return (!vma || (addr + len) <= vma->vm_start);
-+ return (!vma || (addr + len) <= vm_start_gap(vma));
- }
-
- static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice)
-diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
-index eb9df28..812368f 100644
---- a/arch/s390/mm/mmap.c
-+++ b/arch/s390/mm/mmap.c
-@@ -98,7 +98,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -136,7 +136,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
-index 6777177..7df7d59 100644
---- a/arch/sh/mm/mmap.c
-+++ b/arch/sh/mm/mmap.c
-@@ -63,7 +63,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -113,7 +113,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
-index fe8b8ee..02e05e2 100644
---- a/arch/sparc/kernel/sys_sparc_64.c
-+++ b/arch/sparc/kernel/sys_sparc_64.c
-@@ -118,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
-
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -181,7 +181,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
-
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
-index 988acc8..58cde8d 100644
---- a/arch/sparc/mm/hugetlbpage.c
-+++ b/arch/sparc/mm/hugetlbpage.c
-@@ -116,7 +116,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, HPAGE_SIZE);
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
-index 77ceaa3..67508b2 100644
---- a/arch/tile/mm/hugetlbpage.c
-+++ b/arch/tile/mm/hugetlbpage.c
-@@ -232,7 +232,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (current->mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
-index a55ed63..1119414 100644
---- a/arch/x86/kernel/sys_x86_64.c
-+++ b/arch/x86/kernel/sys_x86_64.c
-@@ -140,7 +140,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (end - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -183,7 +183,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
-index 2ae8584..fe342e8 100644
---- a/arch/x86/mm/hugetlbpage.c
-+++ b/arch/x86/mm/hugetlbpage.c
-@@ -144,7 +144,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
-index 83cf496..3aaaae1 100644
---- a/arch/xtensa/kernel/syscall.c
-+++ b/arch/xtensa/kernel/syscall.c
-@@ -87,7 +87,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- /* At this point: (!vmm || addr < vmm->vm_end). */
- if (TASK_SIZE - len < addr)
- return -ENOMEM;
-- if (!vmm || addr + len <= vmm->vm_start)
-+ if (!vmm || addr + len <= vm_start_gap(vmm))
- return addr;
- addr = vmm->vm_end;
- if (flags & MAP_SHARED)
-diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
-index 4fb7b10..704fa0b 100644
---- a/fs/hugetlbfs/inode.c
-+++ b/fs/hugetlbfs/inode.c
-@@ -191,7 +191,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index 35b92d8..c5f2136 100644
---- a/fs/proc/task_mmu.c
-+++ b/fs/proc/task_mmu.c
-@@ -299,11 +299,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
-
- /* We don't show the stack guard page in /proc/maps */
- start = vma->vm_start;
-- if (stack_guard_page_start(vma, start))
-- start += PAGE_SIZE;
- end = vma->vm_end;
-- if (stack_guard_page_end(vma, end))
-- end -= PAGE_SIZE;
-
- seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
- seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
-diff --git a/include/linux/mm.h b/include/linux/mm.h
-index a92c8d7..451251b 100644
---- a/include/linux/mm.h
-+++ b/include/linux/mm.h
-@@ -1354,39 +1354,11 @@ int clear_page_dirty_for_io(struct page *page);
-
- int get_cmdline(struct task_struct *task, char *buffer, int buflen);
-
--/* Is the vma a continuation of the stack vma above it? */
--static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
--{
-- return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
--}
--
- static inline bool vma_is_anonymous(struct vm_area_struct *vma)
- {
- return !vma->vm_ops;
- }
-
--static inline int stack_guard_page_start(struct vm_area_struct *vma,
-- unsigned long addr)
--{
-- return (vma->vm_flags & VM_GROWSDOWN) &&
-- (vma->vm_start == addr) &&
-- !vma_growsdown(vma->vm_prev, addr);
--}
--
--/* Is the vma a continuation of the stack vma below it? */
--static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr)
--{
-- return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP);
--}
--
--static inline int stack_guard_page_end(struct vm_area_struct *vma,
-- unsigned long addr)
--{
-- return (vma->vm_flags & VM_GROWSUP) &&
-- (vma->vm_end == addr) &&
-- !vma_growsup(vma->vm_next, addr);
--}
--
- int vma_is_stack_for_current(struct vm_area_struct *vma);
-
- extern unsigned long move_page_tables(struct vm_area_struct *vma,
-@@ -2125,6 +2097,7 @@ void page_cache_async_readahead(struct address_space *mapping,
- pgoff_t offset,
- unsigned long size);
-
-+extern unsigned long stack_guard_gap;
- /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
- extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
-
-@@ -2153,6 +2126,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m
- return vma;
- }
-
-+static inline unsigned long vm_start_gap(struct vm_area_struct *vma)
-+{
-+ unsigned long vm_start = vma->vm_start;
-+
-+ if (vma->vm_flags & VM_GROWSDOWN) {
-+ vm_start -= stack_guard_gap;
-+ if (vm_start > vma->vm_start)
-+ vm_start = 0;
-+ }
-+ return vm_start;
-+}
-+
-+static inline unsigned long vm_end_gap(struct vm_area_struct *vma)
-+{
-+ unsigned long vm_end = vma->vm_end;
-+
-+ if (vma->vm_flags & VM_GROWSUP) {
-+ vm_end += stack_guard_gap;
-+ if (vm_end < vma->vm_end)
-+ vm_end = -PAGE_SIZE;
-+ }
-+ return vm_end;
-+}
-+
- static inline unsigned long vma_pages(struct vm_area_struct *vma)
- {
- return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-diff --git a/mm/gup.c b/mm/gup.c
-index ec4f827..c63a034 100644
---- a/mm/gup.c
-+++ b/mm/gup.c
-@@ -370,11 +370,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
- /* mlock all present pages, but do not fault in new pages */
- if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK)
- return -ENOENT;
-- /* For mm_populate(), just skip the stack guard page. */
-- if ((*flags & FOLL_POPULATE) &&
-- (stack_guard_page_start(vma, address) ||
-- stack_guard_page_end(vma, address + PAGE_SIZE)))
-- return -ENOENT;
- if (*flags & FOLL_WRITE)
- fault_flags |= FAULT_FLAG_WRITE;
- if (*flags & FOLL_REMOTE)
-diff --git a/mm/memory.c b/mm/memory.c
-index e18c57b..2868911 100644
---- a/mm/memory.c
-+++ b/mm/memory.c
-@@ -2699,40 +2699,6 @@ int do_swap_page(struct fault_env *fe, pte_t orig_pte)
- }
-
- /*
-- * This is like a special single-page "expand_{down|up}wards()",
-- * except we must first make sure that 'address{-|+}PAGE_SIZE'
-- * doesn't hit another vma.
-- */
--static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address)
--{
-- address &= PAGE_MASK;
-- if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
-- struct vm_area_struct *prev = vma->vm_prev;
--
-- /*
-- * Is there a mapping abutting this one below?
-- *
-- * That's only ok if it's the same stack mapping
-- * that has gotten split..
-- */
-- if (prev && prev->vm_end == address)
-- return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
--
-- return expand_downwards(vma, address - PAGE_SIZE);
-- }
-- if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) {
-- struct vm_area_struct *next = vma->vm_next;
--
-- /* As VM_GROWSDOWN but s/below/above/ */
-- if (next && next->vm_start == address + PAGE_SIZE)
-- return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM;
--
-- return expand_upwards(vma, address + PAGE_SIZE);
-- }
-- return 0;
--}
--
--/*
- * We enter with non-exclusive mmap_sem (to exclude vma changes,
- * but allow concurrent faults), and pte mapped but not yet locked.
- * We return with mmap_sem still held, but pte unmapped and unlocked.
-@@ -2748,10 +2714,6 @@ static int do_anonymous_page(struct fault_env *fe)
- if (vma->vm_flags & VM_SHARED)
- return VM_FAULT_SIGBUS;
-
-- /* Check if we need to add a guard page to the stack */
-- if (check_stack_guard_page(vma, fe->address) < 0)
-- return VM_FAULT_SIGSEGV;
--
- /*
- * Use pte_alloc() instead of pte_alloc_map(). We can't run
- * pte_offset_map() on pmds where a huge pmd might be created
-diff --git a/mm/mmap.c b/mm/mmap.c
-index 1af87c1..26542b3 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -183,6 +183,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
- unsigned long retval;
- unsigned long newbrk, oldbrk;
- struct mm_struct *mm = current->mm;
-+ struct vm_area_struct *next;
- unsigned long min_brk;
- bool populate;
-
-@@ -228,7 +229,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
- }
-
- /* Check against existing mmap mappings. */
-- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
-+ next = find_vma(mm, oldbrk);
-+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next))
- goto out;
-
- /* Ok, looks good - let it rip. */
-@@ -251,10 +253,22 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
-
- static long vma_compute_subtree_gap(struct vm_area_struct *vma)
- {
-- unsigned long max, subtree_gap;
-- max = vma->vm_start;
-- if (vma->vm_prev)
-- max -= vma->vm_prev->vm_end;
-+ unsigned long max, prev_end, subtree_gap;
-+
-+ /*
-+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we
-+ * allow two stack_guard_gaps between them here, and when choosing
-+ * an unmapped area; whereas when expanding we only require one.
-+ * That's a little inconsistent, but keeps the code here simpler.
-+ */
-+ max = vm_start_gap(vma);
-+ if (vma->vm_prev) {
-+ prev_end = vm_end_gap(vma->vm_prev);
-+ if (max > prev_end)
-+ max -= prev_end;
-+ else
-+ max = 0;
-+ }
- if (vma->vm_rb.rb_left) {
- subtree_gap = rb_entry(vma->vm_rb.rb_left,
- struct vm_area_struct, vm_rb)->rb_subtree_gap;
-@@ -350,7 +364,7 @@ static void validate_mm(struct mm_struct *mm)
- anon_vma_unlock_read(anon_vma);
- }
-
-- highest_address = vma->vm_end;
-+ highest_address = vm_end_gap(vma);
- vma = vma->vm_next;
- i++;
- }
-@@ -539,7 +553,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma,
- if (vma->vm_next)
- vma_gap_update(vma->vm_next);
- else
-- mm->highest_vm_end = vma->vm_end;
-+ mm->highest_vm_end = vm_end_gap(vma);
-
- /*
- * vma->vm_prev wasn't known when we followed the rbtree to find the
-@@ -854,7 +868,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
- vma_gap_update(vma);
- if (end_changed) {
- if (!next)
-- mm->highest_vm_end = end;
-+ mm->highest_vm_end = vm_end_gap(vma);
- else if (!adjust_next)
- vma_gap_update(next);
- }
-@@ -939,7 +953,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
- * mm->highest_vm_end doesn't need any update
- * in remove_next == 1 case.
- */
-- VM_WARN_ON(mm->highest_vm_end != end);
-+ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma));
- }
- }
- if (insert && file)
-@@ -1783,7 +1797,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
-
- while (true) {
- /* Visit left subtree if it looks promising */
-- gap_end = vma->vm_start;
-+ gap_end = vm_start_gap(vma);
- if (gap_end >= low_limit && vma->vm_rb.rb_left) {
- struct vm_area_struct *left =
- rb_entry(vma->vm_rb.rb_left,
-@@ -1794,7 +1808,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
- }
- }
-
-- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
-+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
- check_current:
- /* Check if current node has a suitable gap */
- if (gap_start > high_limit)
-@@ -1821,8 +1835,8 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
- vma = rb_entry(rb_parent(prev),
- struct vm_area_struct, vm_rb);
- if (prev == vma->vm_rb.rb_left) {
-- gap_start = vma->vm_prev->vm_end;
-- gap_end = vma->vm_start;
-+ gap_start = vm_end_gap(vma->vm_prev);
-+ gap_end = vm_start_gap(vma);
- goto check_current;
- }
- }
-@@ -1886,7 +1900,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
-
- while (true) {
- /* Visit right subtree if it looks promising */
-- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
-+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
- if (gap_start <= high_limit && vma->vm_rb.rb_right) {
- struct vm_area_struct *right =
- rb_entry(vma->vm_rb.rb_right,
-@@ -1899,7 +1913,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
-
- check_current:
- /* Check if current node has a suitable gap */
-- gap_end = vma->vm_start;
-+ gap_end = vm_start_gap(vma);
- if (gap_end < low_limit)
- return -ENOMEM;
- if (gap_start <= high_limit && gap_end - gap_start >= length)
-@@ -1925,7 +1939,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
- struct vm_area_struct, vm_rb);
- if (prev == vma->vm_rb.rb_right) {
- gap_start = vma->vm_prev ?
-- vma->vm_prev->vm_end : 0;
-+ vm_end_gap(vma->vm_prev) : 0;
- goto check_current;
- }
- }
-@@ -1963,7 +1977,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- unsigned long len, unsigned long pgoff, unsigned long flags)
- {
- struct mm_struct *mm = current->mm;
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct vm_unmapped_area_info info;
-
- if (len > TASK_SIZE - mmap_min_addr)
-@@ -1974,9 +1988,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- if (addr) {
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- return addr;
- }
-
-@@ -1999,7 +2014,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- const unsigned long len, const unsigned long pgoff,
- const unsigned long flags)
- {
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct mm_struct *mm = current->mm;
- unsigned long addr = addr0;
- struct vm_unmapped_area_info info;
-@@ -2014,9 +2029,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- /* requesting a specific address */
- if (addr) {
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- return addr;
- }
-
-@@ -2151,21 +2167,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr,
- * update accounting. This is shared with both the
- * grow-up and grow-down cases.
- */
--static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow)
-+static int acct_stack_growth(struct vm_area_struct *vma,
-+ unsigned long size, unsigned long grow)
- {
- struct mm_struct *mm = vma->vm_mm;
- struct rlimit *rlim = current->signal->rlim;
-- unsigned long new_start, actual_size;
-+ unsigned long new_start;
-
- /* address space limit tests */
- if (!may_expand_vm(mm, vma->vm_flags, grow))
- return -ENOMEM;
-
- /* Stack limit test */
-- actual_size = size;
-- if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
-- actual_size -= PAGE_SIZE;
-- if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
-+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
- return -ENOMEM;
-
- /* mlock limit tests */
-@@ -2203,17 +2217,30 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
- int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- {
- struct mm_struct *mm = vma->vm_mm;
-+ struct vm_area_struct *next;
-+ unsigned long gap_addr;
- int error = 0;
-
- if (!(vma->vm_flags & VM_GROWSUP))
- return -EFAULT;
-
- /* Guard against wrapping around to address 0. */
-- if (address < PAGE_ALIGN(address+4))
-- address = PAGE_ALIGN(address+4);
-- else
-+ address &= PAGE_MASK;
-+ address += PAGE_SIZE;
-+ if (!address)
- return -ENOMEM;
-
-+ /* Enforce stack_guard_gap */
-+ gap_addr = address + stack_guard_gap;
-+ if (gap_addr < address)
-+ return -ENOMEM;
-+ next = vma->vm_next;
-+ if (next && next->vm_start < gap_addr) {
-+ if (!(next->vm_flags & VM_GROWSUP))
-+ return -ENOMEM;
-+ /* Check that both stack segments have the same anon_vma? */
-+ }
-+
- /* We must make sure the anon_vma is allocated. */
- if (unlikely(anon_vma_prepare(vma)))
- return -ENOMEM;
-@@ -2257,7 +2284,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- if (vma->vm_next)
- vma_gap_update(vma->vm_next);
- else
-- mm->highest_vm_end = address;
-+ mm->highest_vm_end = vm_end_gap(vma);
- spin_unlock(&mm->page_table_lock);
-
- perf_event_mmap(vma);
-@@ -2278,6 +2305,8 @@ int expand_downwards(struct vm_area_struct *vma,
- unsigned long address)
- {
- struct mm_struct *mm = vma->vm_mm;
-+ struct vm_area_struct *prev;
-+ unsigned long gap_addr;
- int error;
-
- address &= PAGE_MASK;
-@@ -2285,6 +2314,17 @@ int expand_downwards(struct vm_area_struct *vma,
- if (error)
- return error;
-
-+ /* Enforce stack_guard_gap */
-+ gap_addr = address - stack_guard_gap;
-+ if (gap_addr > address)
-+ return -ENOMEM;
-+ prev = vma->vm_prev;
-+ if (prev && prev->vm_end > gap_addr) {
-+ if (!(prev->vm_flags & VM_GROWSDOWN))
-+ return -ENOMEM;
-+ /* Check that both stack segments have the same anon_vma? */
-+ }
-+
- /* We must make sure the anon_vma is allocated. */
- if (unlikely(anon_vma_prepare(vma)))
- return -ENOMEM;
-@@ -2339,28 +2379,25 @@ int expand_downwards(struct vm_area_struct *vma,
- return error;
- }
-
--/*
-- * Note how expand_stack() refuses to expand the stack all the way to
-- * abut the next virtual mapping, *unless* that mapping itself is also
-- * a stack mapping. We want to leave room for a guard page, after all
-- * (the guard page itself is not added here, that is done by the
-- * actual page faulting logic)
-- *
-- * This matches the behavior of the guard page logic (see mm/memory.c:
-- * check_stack_guard_page()), which only allows the guard page to be
-- * removed under these circumstances.
-- */
-+/* enforced gap between the expanding stack and other mappings. */
-+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT;
-+
-+static int __init cmdline_parse_stack_guard_gap(char *p)
-+{
-+ unsigned long val;
-+ char *endptr;
-+
-+ val = simple_strtoul(p, &endptr, 10);
-+ if (!*endptr)
-+ stack_guard_gap = val << PAGE_SHIFT;
-+
-+ return 0;
-+}
-+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);
-+
- #ifdef CONFIG_STACK_GROWSUP
- int expand_stack(struct vm_area_struct *vma, unsigned long address)
- {
-- struct vm_area_struct *next;
--
-- address &= PAGE_MASK;
-- next = vma->vm_next;
-- if (next && next->vm_start == address + PAGE_SIZE) {
-- if (!(next->vm_flags & VM_GROWSUP))
-- return -ENOMEM;
-- }
- return expand_upwards(vma, address);
- }
-
-@@ -2382,14 +2419,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr)
- #else
- int expand_stack(struct vm_area_struct *vma, unsigned long address)
- {
-- struct vm_area_struct *prev;
--
-- address &= PAGE_MASK;
-- prev = vma->vm_prev;
-- if (prev && prev->vm_end == address) {
-- if (!(prev->vm_flags & VM_GROWSDOWN))
-- return -ENOMEM;
-- }
- return expand_downwards(vma, address);
- }
-
-@@ -2487,7 +2516,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
- vma->vm_prev = prev;
- vma_gap_update(vma);
- } else
-- mm->highest_vm_end = prev ? prev->vm_end : 0;
-+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0;
- tail_vma->vm_next = NULL;
-
- /* Kill the cache */
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0002-Allow-stack-to-grow-up-to-address-space-limit.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0002-Allow-stack-to-grow-up-to-address-space-limit.patch
deleted file mode 100644
index 10e247197..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0002-Allow-stack-to-grow-up-to-address-space-limit.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 9e8b9c4bd3b16bd70d8be10c465bd0a91ac569fa Mon Sep 17 00:00:00 2001
-From: Helge Deller <deller@gmx.de>
-Date: Mon, 19 Jun 2017 17:34:05 +0200
-Subject: [PATCH 2/3] Allow stack to grow up to address space limit
-
-commit bd726c90b6b8ce87602208701b208a208e6d5600 upstream.
-
-Fix expand_upwards() on architectures with an upward-growing stack (parisc,
-metag and partly IA-64) to allow the stack to reliably grow exactly up to
-the address space limit given by TASK_SIZE.
-
-Signed-off-by: Helge Deller <deller@gmx.de>
-Acked-by: Hugh Dickins <hughd@google.com>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- mm/mmap.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/mm/mmap.c b/mm/mmap.c
-index 26542b3..d71a61e 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -2224,16 +2224,19 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- if (!(vma->vm_flags & VM_GROWSUP))
- return -EFAULT;
-
-- /* Guard against wrapping around to address 0. */
-+ /* Guard against exceeding limits of the address space. */
- address &= PAGE_MASK;
-- address += PAGE_SIZE;
-- if (!address)
-+ if (address >= TASK_SIZE)
- return -ENOMEM;
-+ address += PAGE_SIZE;
-
- /* Enforce stack_guard_gap */
- gap_addr = address + stack_guard_gap;
-- if (gap_addr < address)
-- return -ENOMEM;
-+
-+ /* Guard against overflow */
-+ if (gap_addr < address || gap_addr > TASK_SIZE)
-+ gap_addr = TASK_SIZE;
-+
- next = vma->vm_next;
- if (next && next->vm_start < gap_addr) {
- if (!(next->vm_flags & VM_GROWSUP))
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch
deleted file mode 100644
index cb6614964..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 6c98443e18289db3ff9afb68575a607cea468ae0 Mon Sep 17 00:00:00 2001
-From: Hugh Dickins <hughd@google.com>
-Date: Tue, 20 Jun 2017 02:10:44 -0700
-Subject: [PATCH 3/3] mm: fix new crash in unmapped_area_topdown()
-
-commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream.
-
-Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of
-mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the
-end of unmapped_area_topdown(). Linus points out how MAP_FIXED
-(which does not have to respect our stack guard gap intentions)
-could result in gap_end below gap_start there. Fix that, and
-the similar case in its alternative, unmapped_area().
-
-Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas")
-Reported-by: Dave Jones <davej@codemonkey.org.uk>
-Debugged-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Hugh Dickins <hughd@google.com>
-Acked-by: Michal Hocko <mhocko@suse.com>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- mm/mmap.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/mm/mmap.c b/mm/mmap.c
-index d71a61e..145d3d5 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -1813,7 +1813,8 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
- /* Check if current node has a suitable gap */
- if (gap_start > high_limit)
- return -ENOMEM;
-- if (gap_end >= low_limit && gap_end - gap_start >= length)
-+ if (gap_end >= low_limit &&
-+ gap_end > gap_start && gap_end - gap_start >= length)
- goto found;
-
- /* Visit right subtree if it looks promising */
-@@ -1916,7 +1917,8 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
- gap_end = vm_start_gap(vma);
- if (gap_end < low_limit)
- return -ENOMEM;
-- if (gap_start <= high_limit && gap_end - gap_start >= length)
-+ if (gap_start <= high_limit &&
-+ gap_end > gap_start && gap_end - gap_start >= length)
- goto found;
-
- /* Visit left subtree if it looks promising */
---
-2.1.4
-
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend
index 9bf8f8aa0..d1969205f 100644
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend
+++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend
@@ -1,7 +1,6 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
require recipes-kernel/linux/linux-agl.inc
-require recipes-kernel/linux/linux-agl-4.9.inc
SRC_URI_append = " file://namespace_fix.cfg \
file://disable_ipv6.cfg \
diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.9.bbappend
deleted file mode 100644
index 339e3b5bc..000000000
--- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.9.bbappend
+++ /dev/null
@@ -1,9 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-
-#-------------------------------------------------------------------------
-# Fix for CVE-2017-1000364 by backporting the upstream patches.
-SRC_URI_append = "\
- file://0001-mm-larger-stack-guard-gap-between-vmas.patch \
- file://0002-Allow-stack-to-grow-up-to-address-space-limit.patch \
- file://0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \
- "
diff --git a/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh b/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh
index 587569f9e..f58baed8c 100644
--- a/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh
+++ b/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-ZIP_1="R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston2-20170904.zip"
-ZIP_2="R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston2-20170904.zip"
+ZIP_1="R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-20180130.zip"
+ZIP_2="R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-20180130.zip"
COPY_SCRIPT="$METADIR/meta-renesas-rcar-gen3/meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh"
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/0001-Autoload-uEnv.txt-on-boot.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/0001-Autoload-uEnv.txt-on-boot.patch
deleted file mode 100644
index a485d7a60..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/0001-Autoload-uEnv.txt-on-boot.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From bd56666d27f765113749c2e55eda97b67a659b2b Mon Sep 17 00:00:00 2001
-From: Anton Gerasimov <anton@advancedtelematic.com>
-Date: Wed, 2 Nov 2016 15:17:16 +0100
-Subject: [PATCH] Autoload uEnv.txt on boot
-
----
- include/configs/porter.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/include/configs/porter.h b/include/configs/porter.h
-index 45e6556..19dab74 100644
---- a/include/configs/porter.h
-+++ b/include/configs/porter.h
-@@ -151,6 +151,10 @@
- #define CONFIG_EXTRA_ENV_SETTINGS \
- "bootm_low=0x40e00000\0" \
- "bootm_size=0x100000\0" \
-+ "bootcmd=if fatload mmc 1:1 0x50000000 uEnv.txt; then env import -t 0x50000000 ${filesize}; run bootcmd; fi;\0"
-+
-+/* Shell scripting features */
-+#define CONFIG_SYS_HUSH_PARSER
-
- /* SH Ether */
- #define CONFIG_NET_MULTI
---
-2.7.4
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch
deleted file mode 100644
index 95fc3b247..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-hibernation-image-area.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From 0b5f63c7224cb5c9a00397f0e0ef4a16aa58e516 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:43:06 +0900
-Subject: [PATCH 1/3] Add hibernation image area
-
-0x40000000 <-> 0x77FFFFFF : kernel
-0x78000000 <-> 0x7FFFFFFF : hibernation image area
-and Enable sdhi DMA support
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- arch/arm/include/asm/arch-rmobile/r8a7791.h | 3 +++
- arch/arm/include/asm/armv7.h | 3 +++
- include/configs/porter.h | 24 ++++++++++++------------
- 3 files changed, 18 insertions(+), 12 deletions(-)
-
-diff --git a/arch/arm/include/asm/arch-rmobile/r8a7791.h b/arch/arm/include/asm/arch-rmobile/r8a7791.h
-index c964f13..9e08da4 100644
---- a/arch/arm/include/asm/arch-rmobile/r8a7791.h
-+++ b/arch/arm/include/asm/arch-rmobile/r8a7791.h
-@@ -147,6 +147,8 @@
-
- #define DBSC3_0_DBADJ2 0xE67900C8
- #define DBSC3_1_DBADJ2 0xE67A00C8
-+#define DBSC3_0_DBCALTR 0xE67900F8
-+#define DBSC3_1_DBCALTR 0xE67A00F8
-
- #define CCI_400_MAXOT_1 0xF0091110
- #define CCI_400_MAXOT_2 0xF0092110
-@@ -154,6 +156,7 @@
- #define CCI_400_QOSCNTL_2 0xF009210C
-
- #define MXI_BASE 0xFE960000
-+#define MXI_VIN_QOS 0xFE96020C
- #define MXI_QOS_BASE 0xFE960300
-
- #define SYS_AXI_SYX64TO128_BASE 0xFF800300
-diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
-index aad5bf7..0d4d612 100644
---- a/arch/arm/include/asm/armv7.h
-+++ b/arch/arm/include/asm/armv7.h
-@@ -31,6 +31,9 @@
- #define MIDR_CORTEX_A9_R1P3 0x411FC093
- #define MIDR_CORTEX_A9_R2P10 0x412FC09A
-
-+/* valid bits in CBAR register / PERIPHBASE value */
-+#define CBAR_MASK 0xFFFF8000
-+
- /* Cortex-A15 revisions */
- #define MIDR_CORTEX_A15_R0P0 0x410FC0F0
-
-diff --git a/include/configs/porter.h b/include/configs/porter.h
-index 5567c7c..f652bab 100644
---- a/include/configs/porter.h
-+++ b/include/configs/porter.h
-@@ -91,14 +91,14 @@
-
- /* MEMORY */
- #define PORTER_SDRAM_BASE 0x40000000
--#define PORTER_SDRAM_SIZE 0x48000000
-+#define PORTER_SDRAM_SIZE 0x80000000
- #define PORTER_UBOOT_SDRAM_SIZE 0x40000000
-
- #define CONFIG_SYS_LONGHELP
- #define CONFIG_SYS_PROMPT "=> "
--#define CONFIG_SYS_CBSIZE 512
--#define CONFIG_SYS_PBSIZE 512
--#define CONFIG_SYS_MAXARGS 32
-+#define CONFIG_SYS_CBSIZE 256
-+#define CONFIG_SYS_PBSIZE 256
-+#define CONFIG_SYS_MAXARGS 16
- #define CONFIG_SYS_BARGSIZE 512
- #define CONFIG_SYS_BAUDRATE_TABLE { 38400, 115200 }
-
-@@ -205,15 +205,15 @@
- #define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
- #define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
-
--#define CONFIG_ARMV7_LPAE /* 64-bit MMU descriptors */
--#define CONFIG_SYS_ARM_CACHE_WRITEALLOC /* Make memory operations faster */
--
--#define CONFIG_SYS_ARCH_TIMER /* Init arch timer */
--#define CONFIG_VE_ENABLED /* Virtualization Extensions are enabled*/
--#define CONFIG_SYS_HZ_CLOCK CONFIG_SYS_CLK_FREQ
-+#define CONFIG_ARMV7_LPAE /* 64-bit MMU descriptors */
-+#define CONFIG_SYS_ARM_CACHE_WRITEALLOC /* Make memory operations faster */
-+#define CONFIG_SYS_ARCH_TIMER /* Init arch timer */
-+#define CONFIG_SYS_HZ_CLOCK CONFIG_SYS_CLK_FREQ
-
-+#if 1
- #define CONFIG_SH_DMA
--#define CONFIG_SH_SYS_DMAL_BASE 0xE6700000
--#define CONFIG_SH_SYS_DMAL_NCH 15
-+#define CONFIG_SH_SYS_DMAL_BASE 0xE6700000
-+#define CONFIG_SH_SYS_DMAL_NCH 15
-+#endif
-
- #endif /* __PORTER_H */
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-rcar-sdhi-DMA-support.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-rcar-sdhi-DMA-support.patch
deleted file mode 100755
index c5226d4a2..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0001-Add-rcar-sdhi-DMA-support.patch
+++ /dev/null
@@ -1,650 +0,0 @@
-From 0aae8f3fefc67bc07b7e4e42f885ef661f0921ab Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 19 May 2017 14:25:38 +0900
-Subject: [PATCH 1/4] Add rcar-sdhi DMA support
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/dma/Makefile | 1 +
- drivers/dma/sh_dma.c | 306 ++++++++++++++++++++++++++++++++++++++++++++++++++
- drivers/mmc/sh_sdhi.c | 158 +++++++++++++++++++++++++-
- drivers/mmc/sh_sdhi.h | 5 +
- include/sh_dma.h | 58 ++++++++++
- 5 files changed, 524 insertions(+), 4 deletions(-)
- create mode 100644 drivers/dma/sh_dma.c
- create mode 100644 include/sh_dma.h
-
-diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
-index 5d864b5..1129fc3 100644
---- a/drivers/dma/Makefile
-+++ b/drivers/dma/Makefile
-@@ -29,6 +29,7 @@ COBJS-$(CONFIG_FSLDMAFEC) += MCD_tasksInit.o MCD_dmaApi.o MCD_tasks.o
- COBJS-$(CONFIG_APBH_DMA) += apbh_dma.o
- COBJS-$(CONFIG_FSL_DMA) += fsl_dma.o
- COBJS-$(CONFIG_OMAP3_DMA) += omap3_dma.o
-+COBJS-$(CONFIG_SH_DMA) += sh_dma.o
-
- COBJS := $(COBJS-y)
- SRCS := $(COBJS:.o=.c)
-diff --git a/drivers/dma/sh_dma.c b/drivers/dma/sh_dma.c
-new file mode 100644
-index 0000000..0af2480
---- /dev/null
-+++ b/drivers/dma/sh_dma.c
-@@ -0,0 +1,306 @@
-+/*
-+ * SH SYS-DMA driver
-+ *
-+ * Copyright (C) 2014 Cogent Embedded, Inc.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ */
-+
-+#include <common.h>
-+#include <malloc.h>
-+#include <asm/io.h>
-+#include <linux/list.h>
-+#include <sh_dma.h>
-+
-+struct sh_dma {
-+ u32 base;
-+ u32 mask;
-+ u32 nch;
-+ struct list_head list;
-+};
-+
-+struct sh_dma_chan {
-+ struct sh_dma *dma;
-+ u32 base;
-+ u32 num;
-+ u32 ts;
-+ u32 bs;
-+ u32 rounds;
-+};
-+
-+#define SH_DMA_MAX_TC 0x1000000
-+#define SH_DMA_MAX_CHAN 32
-+#define SH_DMA_CHAN_OFFSET 0x8000
-+#define SH_DMA_CHAN_SIZE 0x80
-+
-+/* Global registers */
-+#define SH_DMAISTA 0x20
-+#define SH_DMASEC 0x30
-+#define SH_DMAOR 0x60
-+#define SH_DMACHCL 0x80
-+#define SH_DMADPSEC 0xA0
-+
-+/* DMA operation register bits */
-+#define SH_DMAOR_DME (0x1 << 0)
-+
-+/* Channel registers */
-+#define SH_DMASAR 0x00
-+#define SH_DMADAR 0x04
-+#define SH_DMATCR 0x08
-+#define SH_DMACHCR 0x0C
-+#define SH_DMATSR 0x28
-+#define SH_DMATCRB 0x18
-+#define SH_DMATSRB 0x38
-+#define SH_DMACHCRB 0x1C
-+#define SH_DMARS 0x40
-+#define SH_DMABUFCR 0x48
-+#define SH_DMADPBASE 0x50
-+#define SH_DMADPCR 0x54
-+#define SH_DMAFIXSAR 0x10
-+#define SH_DMAFIXDAR 0x14
-+#define SH_DMAFIXDPBASE 0x60
-+
-+/* Channel control register bits */
-+#define SH_DMACHCR_SM(v) (((v) & 0x3) << 12)
-+#define SH_DMACHCR_SM_MASK (0x3 << 12)
-+#define SH_DMACHCR_DM(v) (((v) & 0x3) << 14)
-+#define SH_DMACHCR_DM_MASK (0x3 << 14)
-+#define SH_DMACHCR_TS_1 (0x0 << 3 | 0x0 << 20)
-+#define SH_DMACHCR_TS_2 (0x1 << 3 | 0x0 << 20)
-+#define SH_DMACHCR_TS_4 (0x2 << 3 | 0x0 << 20)
-+#define SH_DMACHCR_TS_8 (0x3 << 3 | 0x1 << 20)
-+#define SH_DMACHCR_TS_16 (0x3 << 3 | 0x0 << 20)
-+#define SH_DMACHCR_TS_32 (0x0 << 3 | 0x1 << 20)
-+#define SH_DMACHCR_TS_64 (0x1 << 3 | 0x1 << 20)
-+#define SH_DMACHCR_TS_MASK (0x3 << 3 | 0x3 << 20)
-+#define SH_DMACHCR_RS_AUTO (0x4 << 8)
-+#define SH_DMACHCR_RS_SEL (0x8 << 8)
-+#define SH_DMACHCR_RS_MASK (0xf << 8)
-+#define SH_DMACHCR_CAE (0x1 << 31)
-+#define SH_DMACHCR_TE (0x1 << 1)
-+#define SH_DMACHCR_DE (0x1 << 0)
-+
-+#define sh_dma_writel(d, r, v) writel((v), (d)->base + (r))
-+#define sh_dma_readl(d, r) readl((d)->base + (r))
-+#define sh_dma_writew(d, r, v) writew((v), (d)->base + (r))
-+#define sh_dma_readw(d, r) readw((d)->base + (r))
-+
-+static LIST_HEAD(sh_dma_list);
-+
-+struct sh_dma *sh_dma_add(u32 base, u32 nch)
-+{
-+ struct list_head *entry;
-+ struct sh_dma *dma;
-+ u32 mask;
-+
-+ if (nch > SH_DMA_MAX_CHAN)
-+ return NULL;
-+
-+ mask = (1 << nch) - 1;
-+ list_for_each(entry, &sh_dma_list) {
-+ dma = list_entry(entry, struct sh_dma, list);
-+ if (dma->base == base) {
-+ if (nch > dma->nch) {
-+ mask &= ~((1 << dma->nch) - 1);
-+ sh_dma_writel(dma, SH_DMACHCL, mask);
-+ dma->nch = nch;
-+ }
-+ return dma;
-+ }
-+ }
-+
-+ dma = malloc(sizeof(*dma));
-+ if (!dma)
-+ return NULL;
-+
-+ dma->base = base;
-+ dma->mask = 0;
-+ dma->nch = nch;
-+ sh_dma_writel(dma, SH_DMACHCL, mask);
-+ sh_dma_writew(dma, SH_DMAOR, SH_DMAOR_DME);
-+ list_add(&dma->list, &sh_dma_list);
-+ return dma;
-+}
-+
-+void sh_dma_chan_src(struct sh_dma_chan *chan, u32 src)
-+{
-+ sh_dma_writel(chan, SH_DMASAR, src);
-+}
-+
-+void sh_dma_chan_dst(struct sh_dma_chan *chan, u32 dst)
-+{
-+ sh_dma_writel(chan, SH_DMADAR, dst);
-+}
-+
-+void sh_dma_chan_cfg(struct sh_dma_chan *chan, u8 midrid, u8 sm, u8 dm)
-+{
-+ u32 val;
-+
-+ sh_dma_writew(chan, SH_DMARS, midrid);
-+ val = sh_dma_readl(chan, SH_DMACHCR);
-+ val &= ~(SH_DMACHCR_RS_MASK |
-+ SH_DMACHCR_SM_MASK | SH_DMACHCR_DM_MASK);
-+ val |= midrid ? SH_DMACHCR_RS_SEL : SH_DMACHCR_RS_AUTO;
-+ val |= SH_DMACHCR_SM(sm) | SH_DMACHCR_DM(dm);
-+ sh_dma_writel(chan, SH_DMACHCR, val);
-+}
-+
-+void sh_dma_chan_start(struct sh_dma_chan *chan, u32 ts, u8 bs)
-+{
-+ u32 val;
-+
-+ if (!ts)
-+ return;
-+
-+ val = (ts + (1 << bs) - 1) >> bs;
-+ val = val < SH_DMA_MAX_TC ? val : 0x0;
-+ sh_dma_writel(chan, SH_DMATCR, val);
-+
-+ chan->ts = ts;
-+ chan->bs = bs;
-+ chan->rounds = val;
-+
-+ val = sh_dma_readl(chan, SH_DMACHCR);
-+
-+ val &= ~(SH_DMACHCR_TE | SH_DMACHCR_TS_MASK);
-+ val |= SH_DMACHCR_DE;
-+ switch (bs) {
-+ default:
-+ case 0:
-+ val |= SH_DMACHCR_TS_1;
-+ break;
-+ case 1:
-+ val |= SH_DMACHCR_TS_2;
-+ break;
-+ case 2:
-+ val |= SH_DMACHCR_TS_4;
-+ break;
-+ case 3:
-+ val |= SH_DMACHCR_TS_8;
-+ break;
-+ case 4:
-+ val |= SH_DMACHCR_TS_16;
-+ break;
-+ case 5:
-+ val |= SH_DMACHCR_TS_32;
-+ break;
-+ case 6:
-+ val |= SH_DMACHCR_TS_64;
-+ break;
-+ }
-+
-+ sh_dma_writel(chan, SH_DMACHCR, val);
-+}
-+
-+void sh_dma_chan_stop(struct sh_dma_chan *chan)
-+{
-+ u32 val;
-+
-+ chan->ts = 0;
-+ chan->bs = 0;
-+ chan->rounds = 0;
-+
-+ val = sh_dma_readl(chan, SH_DMACHCR);
-+ val &= ~(SH_DMACHCR_CAE | SH_DMACHCR_TE | SH_DMACHCR_DE);
-+ sh_dma_writel(chan, SH_DMACHCR, val);
-+ do {
-+ val = sh_dma_readl(chan, SH_DMACHCR);
-+ } while (val & SH_DMACHCR_DE);
-+}
-+
-+int sh_dma_chan_wait(struct sh_dma_chan *chan)
-+{
-+ u32 val;
-+ u32 timeout = 10000000;
-+ int retval = 0;
-+
-+ do {
-+ val = sh_dma_readl(chan, SH_DMACHCR);
-+ val &= SH_DMACHCR_CAE | SH_DMACHCR_TE | SH_DMACHCR_DE;
-+ if (val == (SH_DMACHCR_TE | SH_DMACHCR_DE))
-+ break;
-+
-+ if (!timeout)
-+ return -ETIMEDOUT;
-+
-+ timeout--;
-+ udelay(1);
-+ } while (1);
-+
-+ if (!(val & SH_DMACHCR_DE))
-+ return chan->ts ? -EINTR : 0;
-+
-+ if (val & SH_DMACHCR_CAE) {
-+ retval = -EFAULT;
-+ goto out;
-+ }
-+
-+ val = chan->rounds < SH_DMA_MAX_TC ? chan->rounds : SH_DMA_MAX_TC;
-+ val = chan->rounds - val;
-+ if (val) {
-+ puts("abnormal end\n");
-+ sh_dma_chan_start(chan, val << chan->bs, 0);
-+ return -EAGAIN;
-+ }
-+
-+out:
-+ sh_dma_chan_stop(chan);
-+ return retval;
-+}
-+
-+void sh_dma_chan_clr(struct sh_dma_chan *chan)
-+{
-+ chan->ts = 0;
-+ chan->bs = 0;
-+ chan->rounds = 0;
-+
-+ sh_dma_writel(chan->dma, SH_DMACHCL, 1 << chan->num);
-+}
-+
-+struct sh_dma_chan *sh_dma_chan_init(struct sh_dma *dma, int ch)
-+{
-+ struct sh_dma_chan *chan;
-+ u32 mask;
-+
-+ if (ch < 0) {
-+ if (!~dma->mask)
-+ return NULL;
-+
-+ ch = ffz(dma->mask);
-+ }
-+
-+ if (!dma || ch > dma->nch)
-+ return NULL;
-+
-+ mask = 1 << ch;
-+ if (dma->mask & mask)
-+ return NULL;
-+
-+ chan = malloc(sizeof(*chan));
-+ if (!chan)
-+ return NULL;
-+
-+ dma->mask |= mask;
-+ chan->dma = dma;
-+ chan->base = dma->base + SH_DMA_CHAN_OFFSET + ch * SH_DMA_CHAN_SIZE;
-+ chan->num = ch;
-+ sh_dma_chan_clr(chan);
-+
-+ return chan;
-+}
-+
-+void sh_dma_chan_release(struct sh_dma_chan *chan)
-+{
-+ struct sh_dma *dma = chan->dma;
-+
-+ dma->mask &= ~(1 << chan->num);
-+ free(chan);
-+}
-diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
-index ddad43a..80dc7a8 100644
---- a/drivers/mmc/sh_sdhi.c
-+++ b/drivers/mmc/sh_sdhi.c
-@@ -17,7 +17,6 @@
- #include <command.h>
- #include <mmc.h>
- #include <malloc.h>
--#include <mmc.h>
- #include <asm/errno.h>
- #include <asm/io.h>
-
-@@ -33,6 +32,111 @@
-
- #define DRIVER_NAME "sh-sdhi"
-
-+#ifdef CONFIG_SH_DMA
-+
-+#ifdef CONFIG_SYS_DCACHE_OFF
-+static inline void sh_sdhi_invalidate_dcache(u32 addr, int len) { }
-+#else /* CONFIG_SYS_DCACHE_OFF */
-+#define DCACHE_LINE_MASK (ARCH_DMA_MINALIGN - 1)
-+
-+static void sh_sdhi_invalidate_dcache(u32 addr, int len)
-+{
-+ u32 start, end;
-+
-+ start = addr & ~DCACHE_LINE_MASK;
-+ if (start != addr) {
-+ end = start + ARCH_DMA_MINALIGN;
-+ flush_dcache_range(start, end);
-+
-+ len -= end - addr;
-+ start = end;
-+ }
-+
-+ if (len >= ARCH_DMA_MINALIGN) {
-+ end = (start + len) & ~DCACHE_LINE_MASK;
-+ invalidate_dcache_range(start, end);
-+
-+ len &= DCACHE_LINE_MASK;
-+ start = end;
-+ }
-+
-+ if (len > 0) {
-+ end = start + ARCH_DMA_MINALIGN;
-+ flush_dcache_range(start, end);
-+ }
-+}
-+#endif /* CONFIG_SYS_DCACHE_OFF */
-+
-+static void sh_sdhi_dma_init(struct sdhi_host *host)
-+{
-+ struct sh_dma *dma;
-+
-+ dma = sh_dma_add(CONFIG_SH_SYS_DMAL_BASE, CONFIG_SH_SYS_DMAL_NCH);
-+ if (!dma)
-+ return;
-+
-+ host->dma_rx = sh_dma_chan_init(dma, 1);
-+ if (!host->dma_rx)
-+ return;
-+
-+ sh_dma_chan_cfg(host->dma_rx, SH_DMA_SDHI0_RX,
-+ SH_DMA_AM_FIX, SH_DMA_AM_INC);
-+ sh_dma_chan_src(host->dma_rx,
-+ host->addr + (SDHI_BUF0 << host->bus_shift) +
-+ 0x2000);
-+}
-+
-+static void sh_sdhi_dma_release(struct sdhi_host *host)
-+{
-+ if (host->dma_rx) {
-+ sh_dma_chan_release(host->dma_rx);
-+ host->dma_rx = NULL;
-+ }
-+}
-+
-+static void sh_sdhi_start_dma_rx(struct sdhi_host *host,
-+ struct mmc_data *data)
-+{
-+ int ret;
-+ u32 blocksize = data->blocksize;
-+ sh_sdhi_dma_init(host);
-+ sdhi_writew(host, SDHI_SD_DMACR, 0xa0);
-+ sdhi_writew(host, SDHI_CC_EXT_MODE, (1 << 1));
-+
-+ sh_sdhi_invalidate_dcache((u32)data->dest, blocksize);
-+
-+ sh_dma_chan_dst(host->dma_rx, (u32)data->dest);
-+
-+ /* sh_sdhi_bitset(BUF_ACC_DMAREN, &host->regs->ce_buf_acc); */
-+
-+ /* MMCIF is capable to transfer only 4 bytes at a time,
-+ * provide size order as a param */
-+ blocksize = sdhi_readw(host, SDHI_SIZE);
-+ sh_dma_chan_start(host->dma_rx, blocksize, 1);
-+
-+ do {
-+ ret = sh_dma_chan_wait(host->dma_rx);
-+ } while (ret == -EAGAIN);
-+ sdhi_writew(host, SDHI_CC_EXT_MODE, 0x0);
-+ sh_dma_chan_clr(host->dma_rx);
-+ sh_sdhi_dma_release(host);
-+}
-+
-+static void sdhi_dma_transfer(struct sdhi_host *host,
-+ struct mmc_data *data)
-+{
-+ sh_sdhi_start_dma_rx(host, data);
-+}
-+
-+
-+#else /* CONFIG_SH_DMA */
-+static inline void sh_sdhi_dma_init(struct sdhi_host *host) { }
-+static inline void sh_sdhi_dma_release(struct sdhi_host *host) { }
-+static inline void sh_sdhi_start_dma_rx(struct sdhi_host *host,
-+ struct mmc_data *data) { }
-+
-+#endif /* CONFIG_SH_DMA */
-+
- static void *mmc_priv(struct mmc *mmc)
- {
- return (void *)mmc->priv;
-@@ -253,7 +357,9 @@ static int sdhi_single_read(struct sdhi_host *host, struct mmc_data *data)
- {
- int ch = host->ch;
- long time;
-+#ifndef CONFIG_SH_DMA
- unsigned short blocksize, i;
-+#endif
- unsigned short *p = (unsigned short *)data->dest;
-
- if ((unsigned long)p & 0x00000001) {
-@@ -272,10 +378,14 @@ static int sdhi_single_read(struct sdhi_host *host, struct mmc_data *data)
- return sdhi_error_manage(host);
-
- g_wait_int[ch] = 0;
-+#ifdef CONFIG_SH_DMA
-+ sdhi_dma_transfer(host, data);
-+#else
- blocksize = sdhi_readw(host, SDHI_SIZE);
- for (i = 0; i < blocksize / 2; i++)
- *p++ = sdhi_readw(host, SDHI_BUF0);
-
-+#endif
- time = sdhi_wait_interrupt_flag(host);
- if (time == 0 || g_sd_error[ch] != 0)
- return sdhi_error_manage(host);
-@@ -537,7 +647,6 @@ static int sdhi_start_cmd(struct sdhi_host *host,
- ;
-
- sdhi_writew(host, SDHI_CMD, (unsigned short)(opc & CMD_MASK));
--
- g_wait_int[host->ch] = 0;
- sdhi_writew(host, SDHI_INFO1_MASK,
- ~INFO1M_RESP_END & sdhi_readw(host, SDHI_INFO1_MASK));
-@@ -546,7 +655,6 @@ static int sdhi_start_cmd(struct sdhi_host *host,
- INFO2M_END_ERROR | INFO2M_TIMEOUT |
- INFO2M_RESP_TIMEOUT | INFO2M_ILA) &
- sdhi_readw(host, SDHI_INFO2_MASK));
--
- time = sdhi_wait_interrupt_flag(host);
- if (time == 0)
- return sdhi_error_manage(host);
-@@ -578,7 +686,6 @@ static int sdhi_start_cmd(struct sdhi_host *host,
- }
- if (host->data)
- ret = sdhi_data_trans(host, data, opc);
--
- pr_debug("ret = %d, resp = %08x, %08x, %08x, %08x\n",
- ret, cmd->response[0], cmd->response[1],
- cmd->response[2], cmd->response[3]);
-@@ -697,3 +804,46 @@ int sdhi_mmc_init(unsigned long addr, int ch)
- return ret;
- }
-
-+
-+int sdhi_warmup_sdio(struct mmc *mmc)
-+{
-+ struct mmc_cmd cmd;
-+ int err;
-+ int32_t ocr;
-+
-+ udelay(10);
-+
-+ mmc->bus_width = 1;
-+ mmc->clock = mmc->f_min;
-+ sdhi_set_ios(mmc);
-+ udelay(10);
-+
-+ cmd.cmdidx = MMC_CMD_GO_IDLE_STATE;
-+ cmd.resp_type = MMC_RSP_NONE;
-+ cmd.cmdarg = 0;
-+ err = sdhi_request(mmc, &cmd, NULL);
-+ if (err)
-+ goto err_out;
-+ cmd.cmdidx = 0x5;
-+ cmd.resp_type = MMC_RSP_R4;
-+ cmd.cmdarg = 0;
-+ err = sdhi_request(mmc, &cmd, NULL);
-+ if (err)
-+ goto err_out;
-+ ocr = cmd.response[0];
-+ ocr |= (1 << 24);
-+ cmd.cmdidx = 0x05;
-+ cmd.resp_type = MMC_RSP_R4;
-+ cmd.cmdarg = ocr;
-+ err = sdhi_request(mmc, &cmd, NULL);
-+ if (err)
-+ goto err_out;
-+ printf("SDIO OCR:%08x\n", cmd.response[0]);
-+ return 0;
-+err_out:
-+ printf("cmd: CMD%02d err = %d, resp = %08x, %08x, %08x, %08x\n",
-+ err, cmd.cmdidx, cmd.response[0], cmd.response[1],
-+ cmd.response[2], cmd.response[3]);
-+ return err;
-+}
-+
-diff --git a/drivers/mmc/sh_sdhi.h b/drivers/mmc/sh_sdhi.h
-index 4deded2..7b5d421 100644
---- a/drivers/mmc/sh_sdhi.h
-+++ b/drivers/mmc/sh_sdhi.h
-@@ -15,6 +15,8 @@
- #ifndef _SH_SDHI_H_
- #define _SH_SDHI_H_
-
-+#include <sh_dma.h>
-+
- #define SDHI_CMD (0x0000 >> 1)
- #define SDHI_PORTSEL (0x0004 >> 1)
- #define SDHI_ARG0 (0x0008 >> 1)
-@@ -181,6 +183,9 @@ struct sdhi_host {
- unsigned int power_mode;
- int ch;
- int bus_shift;
-+#ifdef CONFIG_SH_DMA
-+ struct sh_dma_chan *dma_rx;
-+#endif
- };
-
- static unsigned short g_wait_int[CONFIG_MMC_SH_SDHI_NR_CHANNEL];
-diff --git a/include/sh_dma.h b/include/sh_dma.h
-new file mode 100644
-index 0000000..3f35c3a
---- /dev/null
-+++ b/include/sh_dma.h
-@@ -0,0 +1,58 @@
-+#ifndef __SH_DMA_H__
-+#define __SH_DMA_H__
-+
-+#include <asm/types.h>
-+#include <errno.h>
-+
-+#define SH_DMA_MMCIF0_RX 0xD2
-+#define SH_DMA_SDHI0_RX 0xCE
-+
-+/* Address mode */
-+#define SH_DMA_AM_FIX 0
-+#define SH_DMA_AM_INC 1
-+#define SH_DMA_AM_DEC 2
-+
-+struct sh_dma;
-+struct sh_dma_chan;
-+
-+#ifdef CONFIG_SH_DMA
-+struct sh_dma *sh_dma_add(u32 base, u32 nch);
-+struct sh_dma_chan *sh_dma_chan_init(struct sh_dma *dma, int ch);
-+void sh_dma_chan_release(struct sh_dma_chan *chan);
-+
-+void sh_dma_chan_src(struct sh_dma_chan *chan, u32 src);
-+void sh_dma_chan_dst(struct sh_dma_chan *chan, u32 dst);
-+void sh_dma_chan_cfg(struct sh_dma_chan *chan, u8 midrid, u8 sm, u8 dm);
-+void sh_dma_chan_start(struct sh_dma_chan *chan, u32 ts, u8 bs);
-+void sh_dma_chan_stop(struct sh_dma_chan *chan);
-+int sh_dma_chan_wait(struct sh_dma_chan *chan);
-+void sh_dma_chan_clr(struct sh_dma_chan *chan);
-+#else
-+static inline struct sh_dma *sh_dma_add(u32 base, u32 nch)
-+{
-+ return NULL;
-+}
-+
-+static inline struct sh_dma_chan *sh_dma_chan_init(struct sh_dma *dma,
-+ int ch)
-+{
-+ return NULL;
-+}
-+
-+static inline void sh_dma_chan_release(struct sh_dma_chan *chan) { }
-+static inline void sh_dma_chan_src(struct sh_dma_chan *chan, u32 src) { }
-+static inline void sh_dma_chan_dst(struct sh_dma_chan *chan, u32 dst) { }
-+static inline void sh_dma_chan_cfg(struct sh_dma_chan *chan,
-+ u8 midrid, u8 sm, u8 dm) { }
-+static inline void sh_dma_chan_start(struct sh_dma_chan *chan,
-+ u32 ts, u8 bs) { }
-+static inline void sh_dma_chan_stop(struct sh_dma_chan *chan) { }
-+static inline int sh_dma_chan_wait(struct sh_dma_chan *chan)
-+{
-+ return -ENOSYS;
-+}
-+
-+static inline void sh_dma_chan_clr(struct sh_dma_chan *chan) { }
-+#endif
-+
-+#endif /* __SH_DMA_H__ */
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Add-Hibernation-swsusp-command-support.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Add-Hibernation-swsusp-command-support.patch
deleted file mode 100755
index 7c4c65658..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Add-Hibernation-swsusp-command-support.patch
+++ /dev/null
@@ -1,909 +0,0 @@
-From 45b3abc592bd685726a6b55693ab95e4cb6065fc Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 19 May 2017 14:27:46 +0900
-Subject: [PATCH 2/4] Add Hibernation swsusp command support
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- common/cmd_swsusp.c | 889 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 889 insertions(+)
- create mode 100644 common/cmd_swsusp.c
-
-diff --git a/common/cmd_swsusp.c b/common/cmd_swsusp.c
-new file mode 100644
-index 0000000..ba05aa4
---- /dev/null
-+++ b/common/cmd_swsusp.c
-@@ -0,0 +1,889 @@
-+/*
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
-+
-+#include <common.h>
-+#include <command.h>
-+#include <part.h>
-+#include <malloc.h>
-+
-+#include <linux/lzo.h>
-+#include "../arch/arm/cpu/armv7/rmobile/crc32_word4.h"
-+#include <swsuspmem.h>
-+
-+/* Note for Renesas--based boards:
-+ * We have the following memory split here:
-+ * 0x40000000 - u_boot_lowest - used to store pfns at physical addresses
-+ * u_boot_lowest - 0x8000000 - pfns are relocated, and then later put
-+ * on physical addresses (swsusp_finish)
-+ * 0x8000000 - 0xc0000000 - used to store pfns with physical address
-+ * of 0x200000000 (long address), we have to change offset for them.
-+ * Any pfn with address > 0x8000000 but less than 0x200000000
-+ * is an error.
-+ * For boards which do not have memory above first GB, that will
-+ * still work, as they won't have anything above 0x80000000
-+ * in their image, so for standard 2GB setup ou should put
-+ * your secong GB in 0x80000000-0xC0000000 range, you can
-+ * use MMU for that or if your RAM is continous, it will
-+ * naturally be there. */
-+
-+DECLARE_GLOBAL_DATA_PTR;
-+
-+/* #define PAGEMAP_DEBUG */
-+
-+#ifdef PAGEMAP_DEBUG
-+#define SWSUSP_DEBUG_INFO
-+#endif
-+
-+#define SWSUSP_KEEP_IMAGE
-+
-+#ifndef likely
-+# define likely(x) __builtin_expect(!!(x), 1)
-+# define unlikely(x) __builtin_expect(!!(x), 0)
-+#endif
-+
-+#define HIBERNATE_SIG "S1SUSPEND"
-+#define PAGE_SIZE 4096
-+
-+/* Define depending on CONFIG_LBDAF in kernel */
-+typedef u64 sector_t;
-+
-+
-+struct swsusp_header {
-+ char reserved[PAGE_SIZE - 20 - sizeof(sector_t) -
-+ sizeof(int) - sizeof(u32) -
-+ sizeof(CRC32_WORD4_t) - sizeof(u32)];
-+ CRC32_WORD4_t comp_crc32;
-+ u32 img_size; /* append */
-+ u32 crc32;
-+ sector_t image;
-+ unsigned int flags;
-+ char orig_sig[10];
-+ char sig[10];
-+} __packed;
-+
-+#define __NEW_UTS_LEN 64
-+
-+struct new_utsname {
-+ char sysname[__NEW_UTS_LEN + 1];
-+ char nodename[__NEW_UTS_LEN + 1];
-+ char release[__NEW_UTS_LEN + 1];
-+ char version[__NEW_UTS_LEN + 1];
-+ char machine[__NEW_UTS_LEN + 1];
-+ char domainname[__NEW_UTS_LEN + 1];
-+};
-+
-+struct swsusp_archdata {
-+ u32 nosave_backup_phys;
-+ u32 nosave_begin_phys;
-+ u32 nosave_end_phys;
-+ void (*cpu_resume_restore_nosave)(u32, u32, u32);
-+};
-+
-+struct swsusp_info {
-+ struct new_utsname uts;
-+ u32 version_code;
-+ unsigned long num_physpages;
-+ int cpus;
-+ unsigned long image_pages;
-+ unsigned long pages;
-+ unsigned long size;
-+ char archdata[1024];
-+};
-+
-+struct swap_map_page {
-+ u64 entries[PAGE_SIZE / sizeof(u64) - 1];
-+ u64 next_swap;
-+};
-+
-+struct swsusp_finish_context {
-+ void *remap_orig_page;
-+ void *remap_temp_page;
-+ struct swsusp_archdata archdata;
-+};
-+
-+/* Do not specially exclude any bottom area */
-+#define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
-+#define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE)
-+
-+#define PG_UB2ZERO(pg) (pg - CONFIG_SYS_SDRAM_BASE / PAGE_SIZE)
-+static u32 const exclude_min_page =
-+ (USED_ADDRESS_TOP) / PAGE_SIZE;
-+static u32 const exclude_max_page =
-+ (USED_ADDRESS_END - 1) / PAGE_SIZE;
-+static u32 const exclude_min_page_ub =
-+ PG_UB2ZERO((USED_ADDRESS_TOP) / PAGE_SIZE);
-+static u32 const exclude_max_page_ub =
-+ PG_UB2ZERO((USED_ADDRESS_END-1) / PAGE_SIZE);
-+#define SF_NOCOMPRESS_MODE 2
-+
-+#define LZO_HEADER sizeof(size_t)
-+
-+/* Number of pages/bytes we'll compress at one time. */
-+#define LZO_UNC_PAGES 32
-+#define LZO_UNC_SIZE (LZO_UNC_PAGES * PAGE_SIZE)
-+
-+/* Number of pages/bytes we need for compressed data (worst case). */
-+#define LZO_CMP_PAGES DIV_ROUND_UP(lzo1x_worst_compress(LZO_UNC_SIZE) + \
-+ LZO_HEADER, PAGE_SIZE)
-+#define LZO_CMP_SIZE (LZO_CMP_PAGES * PAGE_SIZE)
-+
-+static block_dev_desc_t *swap_dev;
-+static disk_partition_t swap_info;
-+
-+static struct swap_map_page *meta_map;
-+static u64 meta_map_next;
-+static u64 meta_map_curr;
-+static u64 meta_map_start;
-+static int meta_idx;
-+
-+#ifdef PAGEMAP_DEBUG
-+static int debugout;
-+static int _last_read_pages;
-+#define PAGEMAP_INFO(_msg, ...) do { if (debugout == 1) \
-+ printf(_msg, ## __VA_ARGS__); } while (0)
-+#endif
-+
-+#define HIGHMEM_PHYS_ADDR 0x200000000ULL
-+#define HIGHMEM_VA 0x80000000UL
-+#define HIGHMEM_PFN (HIGHMEM_PHYS_ADDR / PAGE_SIZE)
-+#define LOW_TOP 0x80000000
-+#define LOW_TOP_PFN (LOW_TOP / PAGE_SIZE)
-+#define LOW_BOTTOM CONFIG_SYS_SDRAM_BASE
-+#define LOW_BOTTOM_PFN (LOW_BOTTOM / PAGE_SIZE)
-+#define TOP_ADDRESS 0x240000000ULL
-+
-+static int get_meta(void);
-+
-+static inline int pfn_is_low(u32 pfn)
-+{
-+ return ((pfn >= LOW_BOTTOM_PFN) && (pfn < LOW_TOP_PFN));
-+}
-+
-+static inline int pfn_is_high(u32 pfn)
-+{
-+ return (pfn >= HIGHMEM_PFN);
-+}
-+
-+#define pfn_is_valid(p) (pfn_is_low(p) || pfn_is_high(p))
-+
-+static inline int pfn_is_excluded(u32 pfn)
-+{
-+ /* Allow bottom 2 pages for exception vectors */
-+ if (pfn < (LOW_BOTTOM_PFN + 2))
-+ return 0;
-+ else if (exclude_min_page >= exclude_max_page)
-+ return 0;
-+ else
-+ return (pfn >= exclude_min_page) && (pfn <= exclude_max_page);
-+}
-+
-+/* PFN to zero-counted page */
-+static inline u32 pg_ub2zero(u32 pg)
-+{
-+ return pg - LOW_BOTTOM_PFN;
-+}
-+
-+/* zero-counted page to PFN */
-+static inline u32 pg_zero2ub(u32 pg)
-+{
-+ return pg + LOW_BOTTOM_PFN;
-+}
-+
-+/* PFN to physical address (64-bit (40-bit)) */
-+static inline u64 pg2phys(u32 page)
-+{
-+ return (u64) page * PAGE_SIZE;
-+}
-+
-+/* PFN to virtual address */
-+static inline void *pg2addr(u32 page)
-+{
-+ void *addr;
-+ if (page >= HIGHMEM_PFN)
-+ addr = (void *) (u32)(pg2phys(page - HIGHMEM_PFN) + HIGHMEM_VA);
-+ else
-+ addr = (void *) (u32)pg2phys(page);
-+
-+ return addr;
-+}
-+
-+#ifdef CONFIG_SH_DMA
-+static inline void *malloc_aligned(u32 size, u32 align)
-+{
-+ return (void *)(((u32)malloc(size + align) + align - 1) & ~(align - 1));
-+}
-+
-+#endif
-+
-+static int page_read(u32 page, void *addr)
-+{
-+ __u32 cnt;
-+ int blk_per_page;
-+
-+ blk_per_page = PAGE_SIZE / swap_dev->blksz;
-+ cnt = swap_dev->block_read(swap_dev->dev,
-+ swap_info.start + (page * blk_per_page),
-+ blk_per_page, addr);
-+ return cnt != blk_per_page;
-+}
-+
-+#ifndef SWSUSP_KEEP_IMAGE
-+static int page_write(u32 page, void *addr)
-+{
-+ __u32 cnt;
-+ int blk_per_page;
-+
-+ blk_per_page = PAGE_SIZE / swap_dev->blksz;
-+ cnt = swap_dev->block_write(swap_dev->dev,
-+ swap_info.start + (page * blk_per_page),
-+ blk_per_page, addr);
-+ return cnt != blk_per_page;
-+}
-+#endif
-+
-+#define FAST_COPY
-+void __attribute__((section(".rodata")))
-+ __attribute__((optimize("O6", "unroll-loops")))
-+swsusp_finish(void *userdata)
-+{
-+ struct swsusp_finish_context *context = userdata;
-+ u32 **remap_orig;
-+ u32 **remap_temp;
-+ int idx = 0;
-+ const int lastidx = PAGE_SIZE / sizeof(u32) - 1;
-+
-+ remap_orig = context->remap_orig_page;
-+ remap_temp = context->remap_temp_page;
-+
-+ __asm__ volatile ("" : : : "memory");
-+ for (;;) {
-+ u32 *orig, *temp;
-+ int count;
-+
-+ /* Linked list to next page */
-+ if (idx == lastidx) {
-+ remap_orig = (u32 **)remap_orig[idx];
-+ remap_temp = (u32 **)remap_temp[idx];
-+ idx = 0;
-+ }
-+ if (unlikely(!remap_orig || remap_orig[idx] == (u32 *)~0UL))
-+ break;
-+ orig = remap_orig[idx];
-+ temp = remap_temp[idx];
-+#ifdef FAST_COPY
-+ count = PAGE_SIZE / sizeof(u32) / 32;
-+ __asm__ volatile (
-+ "1:\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "subs %[count], %[count], #1\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "bgt 1b\n"
-+ : /* No outputs */
-+ :
-+ [rorig]"h" (orig),
-+ [rtemp]"h" (temp),
-+ [count]"h" (count)
-+ : "r0", "r1", "r2",
-+ "r3", "r4", "r5",
-+ "r6", "r7", "cc", "memory"
-+ );
-+#else
-+ count = PAGE_SIZE / sizeof(u32);
-+ while (count--)
-+ *orig++ = *temp++;
-+#endif
-+#ifdef SWSUSP_CHECK_COPY_RESULT
-+ count = PAGE_SIZE / sizeof(u32);
-+ orig = remap_orig[idx];
-+ temp = remap_temp[idx];
-+ __asm__ volatile (
-+ "1:\n"
-+ "ldr r3, [%[rorig]]\n"
-+ "ldr r4, [%[rtemp]]\n"
-+ "cmp r3, r4\n"
-+ "bne 2f\n"
-+ "add %[rorig], %[rorig], #4\n"
-+ "add %[rtemp], %[rtemp], #4\n"
-+ "subs %[count], %[count], #1\n"
-+ "bgt 1b\n"
-+ "b 3f\n"
-+ "2:b 2b\n"
-+ "3:\n"
-+ :
-+ [rorig]"+r" (orig),
-+ [rtemp]"+r" (temp),
-+ [count]"+r" (count)
-+ :
-+ : "r3", "r4", "cc", "memory"
-+ );
-+#endif
-+ idx++;
-+ }
-+ context->archdata.cpu_resume_restore_nosave(
-+ context->archdata.nosave_backup_phys,
-+ context->archdata.nosave_begin_phys,
-+ context->archdata.nosave_end_phys);
-+}
-+
-+static int raw_page_init(u64 start)
-+{
-+#ifdef CONFIG_SH_DMA
-+ meta_map = malloc_aligned(PAGE_SIZE, ARCH_DMA_MINALIGN);
-+#else
-+ meta_map = malloc(PAGE_SIZE);
-+#endif
-+ if (!meta_map)
-+ return -1;
-+ meta_map_next = 0;
-+ meta_map_curr = 0;
-+ meta_map_start = start;
-+ return 0;
-+}
-+
-+static void raw_page_start(void)
-+{
-+ meta_idx = ARRAY_SIZE(meta_map->entries);
-+ meta_map_next = meta_map_start;
-+}
-+
-+static int get_meta(void)
-+{
-+ if (meta_idx == ARRAY_SIZE(meta_map->entries)) {
-+ if (!meta_map_next)
-+ return 0;
-+ if (meta_map_curr != meta_map_next) {
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO("META: %d (%08x)\n",
-+ (int)meta_map_next,
-+ (unsigned int)
-+ (meta_map_next * PAGE_SIZE));
-+#endif
-+ if (page_read(meta_map_next, meta_map))
-+ return -1;
-+ meta_map_curr = meta_map_next;
-+ meta_map_next = meta_map->next_swap;
-+ }
-+ meta_idx = 0;
-+ }
-+#ifdef PAGEMAP_DEBUG
-+ {
-+ static unsigned int pre;
-+ if ((pre+1) != meta_map->entries[meta_idx]) {
-+ PAGEMAP_INFO("DATA-Skipped: %d->%d (%08x->%08x)\n",
-+ pre,
-+ (unsigned int)meta_map->entries[meta_idx],
-+ pre*PAGE_SIZE,
-+ (unsigned int)
-+ (meta_map->entries[meta_idx] *
-+ PAGE_SIZE));
-+ }
-+ pre = meta_map->entries[meta_idx];
-+ _last_read_pages = pre;
-+ }
-+#endif
-+ return 1;
-+}
-+
-+static int raw_page_get_next(void *buffer)
-+{
-+ if (!get_meta())
-+ return 0;
-+
-+ if (page_read(meta_map->entries[meta_idx++], buffer))
-+ return -1;
-+
-+ return 1;
-+}
-+
-+static void raw_page_exit(void)
-+{
-+ free(meta_map);
-+ meta_map = NULL;
-+}
-+
-+static int image_compressed;
-+static int image_pages_avail;
-+static unsigned char *unc_buf;
-+static unsigned char *cmp_buf;
-+static int unc_offset;
-+
-+static int image_page_init(int compressed)
-+{
-+ if (!compressed)
-+ return 1;
-+
-+#ifdef CONFIG_SH_DMA
-+ cmp_buf = malloc_aligned(LZO_CMP_SIZE, ARCH_DMA_MINALIGN);
-+#else
-+ cmp_buf = malloc(LZO_CMP_SIZE);
-+#endif
-+ unc_buf = malloc(LZO_UNC_SIZE);
-+ if (!unc_buf || !cmp_buf) {
-+ printf("not enogh memory\n");
-+ return 1;
-+ }
-+ image_compressed = compressed;
-+ return 0;
-+}
-+
-+static void image_page_start(void)
-+{
-+ image_pages_avail = 0;
-+}
-+
-+static int image_page_get_next(void *buffer)
-+{
-+ if (image_compressed) {
-+#ifdef CONFIG_LZO
-+ if (!image_pages_avail) {
-+ int ret;
-+ size_t unc_len, cmp_len, cmp_avail;
-+
-+ ret = raw_page_get_next(cmp_buf);
-+ if (ret <= 0)
-+ return ret;
-+
-+ cmp_len = *(size_t *) cmp_buf;
-+ cmp_avail = PAGE_SIZE;
-+
-+ while (cmp_avail < cmp_len + LZO_HEADER) {
-+ ret = raw_page_get_next(cmp_buf + cmp_avail);
-+ if (unlikely(ret <= 0))
-+ return ret;
-+ cmp_avail += PAGE_SIZE;
-+ }
-+ unc_len = LZO_UNC_SIZE;
-+ ret = lzo1x_decompress_safe(cmp_buf + LZO_HEADER,
-+ cmp_len, unc_buf, &unc_len);
-+ if (unlikely(ret != LZO_E_OK)) {
-+ printf("Decompression failure:\n");
-+ printf("ret = %d\n", ret);
-+ printf("cmp_buf = %p\n", cmp_buf + LZO_HEADER);
-+ printf("cmp_len = %zu\n", cmp_len);
-+ printf("unc_len = %zu\n", unc_len);
-+ return ret;
-+ }
-+ image_pages_avail = unc_len / PAGE_SIZE;
-+ unc_offset = 0;
-+ }
-+
-+ memcpy(buffer, unc_buf + unc_offset, PAGE_SIZE);
-+ unc_offset += PAGE_SIZE;
-+ image_pages_avail--;
-+ return 1;
-+#else
-+ printf("No LZO support in u-boot.\n");
-+ return -1;
-+#endif
-+ } else {
-+ return raw_page_get_next(buffer);
-+ }
-+}
-+
-+static void image_page_exit(void)
-+{
-+ free(unc_buf);
-+ free(cmp_buf);
-+ unc_buf = cmp_buf = NULL;
-+}
-+
-+static void bitmap_set(u32 *bm, unsigned int bit)
-+{
-+ bm[bit >> 5] |= (1 << (bit & 0x1f));
-+}
-+
-+static int bitmap_is_set(u32 *bm, unsigned int bit)
-+{
-+ return !!(bm[bit >> 5] & (1 << (bit & 0x1f)));
-+}
-+
-+static u32 *used_bitmap;
-+static u32 next_free_page;
-+static u32 total_pages;
-+
-+static int free_page_init(void)
-+{
-+ total_pages = (u32)((TOP_ADDRESS -
-+ LOW_BOTTOM) / PAGE_SIZE); /* 2GB */
-+ used_bitmap = malloc(total_pages * sizeof(u32) / 32);
-+ if (!used_bitmap)
-+ return -1;
-+ return 0;
-+}
-+
-+static void free_page_start(int offset)
-+{
-+ memset(used_bitmap, 0, total_pages * sizeof(u32) / 32);
-+ next_free_page = pg_ub2zero(offset);
-+}
-+
-+static void free_page_mark_used(u32 page);
-+/* Returns full-address based pages */
-+static int free_page_get_next(void)
-+{
-+ while (bitmap_is_set(used_bitmap, next_free_page))
-+ next_free_page++;
-+ free_page_mark_used(next_free_page);
-+ return pg_zero2ub(next_free_page++);
-+}
-+
-+static void free_page_mark_used(u32 page)
-+{
-+ bitmap_set(used_bitmap, page);
-+}
-+
-+static void free_page_exit(void)
-+{
-+ free(used_bitmap);
-+ used_bitmap = NULL;
-+}
-+
-+int do_swsusp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-+{
-+ int ret;
-+ __u32 offset = 0;
-+ void *spare_page = NULL;
-+ struct swsusp_header *swsusp_header;
-+ struct swsusp_info *swsusp_info;
-+ struct swsusp_finish_context *context;
-+ int max_page;
-+ int i;
-+ u32 nr_pfn_pages;
-+ u32 **pfn_pages = NULL;
-+ u32 *remap_orig_page;
-+ u32 *remap_temp_page;
-+ u32 **remap_orig;
-+ u32 **remap_temp;
-+ int remap_idx;
-+ int m;
-+ void (*swsusp_finish_copy)(void *);
-+ char *data_page;
-+ char *stack_addr;
-+ int high_page;
-+#ifdef USE_CRC_32x4
-+ CRC32_WORD4_t calc_crc;
-+#endif
-+#ifdef PAGEMAP_DEBUG
-+ int high_page_images = 0;
-+ int total_remap = 0;
-+ if (getenv("hybdebug") != NULL)
-+ debugout = 1;
-+#endif
-+ /* Address hack */
-+ void *swsusp_finish_p = (void *)((u32)swsusp_finish & ~0x1);
-+
-+ if (argc < 2) {
-+ printf("usage: swsusp <interface> "
-+ "[<dev[:part]>] [<offset>]\n");
-+ return 0;
-+ }
-+
-+ if (argc == 4) {
-+ char *ep;
-+ offset = simple_strtoul(argv[3], &ep, 16);
-+ if (*ep) {
-+ printf("Invalid block offset\n");
-+ return 1;
-+ }
-+ }
-+
-+ /* Allow for 32 pages of stack */
-+ max_page = gd->start_addr_sp / PAGE_SIZE - 32;
-+ high_page = (((gd->relocaddr
-+ + _bss_end_ofs)+(PAGE_SIZE-1)) / PAGE_SIZE) + 1;
-+#define pfn_is_occupied(pfn) (page > max_page && page <= high_page)
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO(" *gd->start_addr_sp:%p\n", (void *)gd->start_addr_sp);
-+ PAGEMAP_INFO(" *gd->relocaddr:%p\n", (void *)gd->relocaddr);
-+ PAGEMAP_INFO(" *bss_start_offset:%d bss_end_offset:%d\n",
-+ (int)_bss_start_ofs, (int)_bss_end_ofs);
-+ PAGEMAP_INFO(" UBOOT own memory [%p-%p]\n",
-+ pg2addr(max_page), pg2addr(high_page));
-+#endif
-+
-+ if (free_page_init())
-+ goto mem_err;
-+ free_page_start(exclude_max_page + 1);
-+
-+#ifdef CONFIG_SH_DMA
-+ spare_page = malloc_aligned(PAGE_SIZE, ARCH_DMA_MINALIGN);
-+#else
-+ spare_page = malloc(PAGE_SIZE);
-+#endif
-+ if (!spare_page)
-+ goto mem_err;
-+
-+ ret = get_device_and_partition(argv[1], argv[2], &swap_dev, &swap_info,
-+ 1);
-+ if (ret < 0)
-+ goto err;
-+
-+ swsusp_header = spare_page;
-+ if (page_read(offset, swsusp_header))
-+ goto read_err;
-+
-+#ifdef SWSUSP_DEBUG_INFO
-+ PAGEMAP_INFO("swssp_header:\n");
-+ PAGEMAP_INFO(" comp_crc: <snip>\n");
-+ PAGEMAP_INFO(" img_size: %d\n", swsusp_header->img_size);
-+ PAGEMAP_INFO(" image(swap firest sector): %08x\n",
-+ (unsigned int)swsusp_header->image);
-+ PAGEMAP_INFO(" flags: %08x\n", swsusp_header->flags);
-+ PAGEMAP_INFO(" orig_sig:%s\n", swsusp_header->orig_sig);
-+ PAGEMAP_INFO(" sig:%s\n", swsusp_header->sig);
-+#endif /* SWSUSP_DEBUG_INFO */
-+
-+ if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
-+ printf("No hibernation image present\n");
-+ return 0;
-+ }
-+
-+#ifdef USE_CRC_32x4
-+ memset(&calc_crc, 0, sizeof(calc_crc));
-+ calc_crc32x4((u8 *)((unsigned long)offt_addr + PAGE_SIZE),
-+ swsusp_header->img_size, &calc_crc);
-+
-+ if (memcmp(&calc_crc, &swsusp_header->comp_crc32,
-+ sizeof(CRC32_WORD4_t))) {
-+ printf("Bad CRC for image, image: %08x:%08x:%08x:%08x, calc: %08x:%08x:%08x:%08x\n",
-+ swsusp_header->comp_crc32.crc_w[0],
-+ swsusp_header->comp_crc32.crc_w[1],
-+ swsusp_header->comp_crc32.crc_w[2],
-+ swsusp_header->comp_crc32.crc_w[3],
-+ calc_crc.crc_w[0], calc_crc.crc_w[1],
-+ calc_crc.crc_w[2], calc_crc.crc_w[3]);
-+ return 0;
-+ }
-+#endif
-+
-+ /* Overwrite header if necessary */
-+#ifndef SWSUSP_KEEP_IMAGE
-+ if (memcmp(swsusp_header->sig, swsusp_header->orig_sig, 10)) {
-+ memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
-+ if (page_write(offset, swsusp_header))
-+ printf("Write error resetting header\n");
-+ }
-+#endif
-+
-+ if (raw_page_init(swsusp_header->image))
-+ goto mem_err;
-+ raw_page_start();
-+
-+ if (image_page_init(!(swsusp_header->flags & SF_NOCOMPRESS_MODE)))
-+ goto mem_err;
-+ image_page_start();
-+
-+ swsusp_info = spare_page;
-+ if (raw_page_get_next(swsusp_info) <= 0)
-+ goto read_err;
-+
-+#ifdef SWSUSP_DEBUG_INFO
-+ PAGEMAP_INFO("swsup_info:\n");
-+ PAGEMAP_INFO(" utsname.sysname:%s\n", swsusp_info->uts.sysname);
-+ PAGEMAP_INFO(" nodename:%s\n", swsusp_info->uts.nodename);
-+ PAGEMAP_INFO(" release:%s\n", swsusp_info->uts.release);
-+ PAGEMAP_INFO(" version:%s\n", swsusp_info->uts.version);
-+ PAGEMAP_INFO(" machine:%s\n", swsusp_info->uts.machine);
-+ PAGEMAP_INFO(" vesion_code:%#08x\n",
-+ (unsigned int)swsusp_info->version_code);
-+ PAGEMAP_INFO(" num_physpages:%d\n",
-+ (unsigned int)swsusp_info->num_physpages);
-+ PAGEMAP_INFO(" pages :%d\n",
-+ (unsigned int)swsusp_info->pages);
-+ PAGEMAP_INFO(" size :%d\n",
-+ (unsigned int)swsusp_info->size);
-+#endif
-+
-+ nr_pfn_pages = (swsusp_info->image_pages * 4 + PAGE_SIZE - 1) /
-+ PAGE_SIZE;
-+ pfn_pages = malloc(nr_pfn_pages * sizeof(u32 *));
-+ if (!pfn_pages)
-+ goto mem_err;
-+ memset(pfn_pages, 0, nr_pfn_pages * sizeof(u32 *));
-+
-+ /* UBOOT using memory */
-+ for (i = max_page; i <= high_page; i++)
-+ free_page_mark_used(pg_ub2zero(i));
-+
-+ printf("Allocating %u bytes (nr_pfn_pages %u)\n",
-+ nr_pfn_pages * PAGE_SIZE, nr_pfn_pages);
-+
-+ for (i = 0; i < nr_pfn_pages; i++) {
-+ u32 idx;
-+#ifdef CONFIG_SH_DMA
-+ pfn_pages[i] = malloc_aligned(PAGE_SIZE, ARCH_DMA_MINALIGN);
-+#else
-+ pfn_pages[i] = malloc(PAGE_SIZE);
-+#endif
-+ if (unlikely(!pfn_pages[i]))
-+ goto mem_err;
-+ if (unlikely(image_page_get_next(pfn_pages[i]) <= 0))
-+ goto read_err;
-+ for (idx = 0; idx < PAGE_SIZE / sizeof(u32); idx++) {
-+ u32 page = pfn_pages[i][idx];
-+ if (page == ~0UL)
-+ break;
-+ free_page_mark_used(pg_ub2zero(page));
-+ }
-+ }
-+
-+ printf("Loading image data pages (%lu pages)\n",
-+ swsusp_info->image_pages);
-+
-+ remap_orig_page = pg2addr(free_page_get_next());
-+ remap_temp_page = pg2addr(free_page_get_next());
-+
-+ remap_orig = (u32 **)remap_orig_page;
-+ remap_temp = (u32 **)remap_temp_page;
-+ remap_idx = 0;
-+
-+ m = (swsusp_info->image_pages / 10) ? : 1;
-+ for (i = 0; i < swsusp_info->image_pages; i++) {
-+ u32 page = pfn_pages[i >> 10][i & 0x3ff];
-+ if (unlikely(!pfn_is_valid(page))) {
-+ printf("Attempt to restore invalid address %llx\n",
-+ pg2phys(page));
-+ continue;
-+ } else if (unlikely(pfn_is_excluded(page))) {
-+ printf("Attempt to restore excluded address %llx\n",
-+ pg2phys(page));
-+ continue;
-+ } else if (unlikely(pfn_is_low(page) &&
-+ pfn_is_occupied(page))) {
-+ remap_orig[remap_idx] = pg2addr(page);
-+ page = free_page_get_next();
-+ remap_temp[remap_idx] = pg2addr(page);
-+ remap_idx++;
-+#ifdef PAGEMAP_DEBUG
-+ ++total_remap;
-+#endif
-+ /* If we fill our current page, allocate a new one */
-+ if (remap_idx + 1 == PAGE_SIZE / sizeof(u32)) {
-+ u32 *next;
-+
-+ next = pg2addr(free_page_get_next());
-+ remap_orig[remap_idx] = next;
-+ remap_orig = (u32 **)next;
-+
-+ next = pg2addr(free_page_get_next());
-+ remap_temp[remap_idx] = next;
-+ remap_temp = (u32 **)next;
-+
-+ remap_idx = 0;
-+ }
-+ }
-+ if (image_page_get_next(pg2addr(page)) <= 0)
-+ goto read_err;
-+ if (!(i % m))
-+ printf("Image loading progress: %3d%%\n", 10 * i / m);
-+ }
-+
-+ printf("Image loading done.\n");
-+ invalidate_icache_all();
-+
-+ /* put end markers on the remap list */
-+ remap_orig[remap_idx] = (void *) ~0UL;
-+ remap_temp[remap_idx] = (void *) ~0UL;
-+
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO("Number of remap pages:%d\n",
-+ total_remap);
-+ PAGEMAP_INFO("Number of high pages:%d\n",
-+ high_page_images);
-+ PAGEMAP_INFO("Last read page %d (%08x)\n",
-+ _last_read_pages,
-+ _last_read_pages * PAGE_SIZE);
-+#endif
-+ remap_orig = (u32 **)remap_orig_page;
-+ remap_temp = (u32 **)remap_temp_page;
-+
-+ /* Make a copy of swsusp_finish in a free data page */
-+ data_page = pg2addr(free_page_get_next());
-+ memcpy(data_page, swsusp_finish_p, PAGE_SIZE);
-+ swsusp_finish_copy = (void *) data_page;
-+
-+ /* Setup context for swsusp_finish at the end of the data_page */
-+ context = (struct swsusp_finish_context *) (data_page + PAGE_SIZE -
-+ sizeof(struct swsusp_finish_context));
-+ context->remap_orig_page = remap_orig_page;
-+ context->remap_temp_page = remap_temp_page;
-+ memcpy((void *)&context->archdata, (void *)swsusp_info->archdata,
-+ sizeof(struct swsusp_archdata));
-+
-+ /* Get a stack pointer for swsusp_finish, growing down from context */
-+ stack_addr = (char *) context;
-+
-+#ifdef CONFIG_NETCONSOLE
-+ /*
-+ * Stop the ethernet stack if NetConsole could have
-+ * left it up
-+ */
-+ eth_halt();
-+#endif
-+
-+#ifdef CONFIG_USB_DEVICE
-+ udc_disconnect();
-+#endif
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO("Execution routine: %08x\n",
-+ (u32)context->archdata.cpu_resume_restore_nosave);
-+#endif
-+ arch_preboot_os();
-+ cleanup_before_linux();
-+
-+ /* Copy the final data from a safe place */
-+ call_with_stack(swsusp_finish_copy, context, stack_addr);
-+
-+ return 0;
-+
-+mem_err:
-+ printf("Not enough memory.\n");
-+ goto err;
-+
-+read_err:
-+ printf("Read error while restoring image.\n");
-+
-+err:
-+ __asm__ volatile (
-+ "mov r0, #0\n"
-+ "mcr p15, 0, r0, c7, c5, 0 @ invalidate icache\n"
-+ "mcr p15, 0, r0, c7, c10, 4 @ DSB\n"
-+ "mcr p15, 0, r0, c7, c5, 4 @ ISB\n"
-+ : : : "r0", "memory");
-+
-+ raw_page_exit();
-+ image_page_exit();
-+ free_page_exit();
-+ if (pfn_pages) {
-+ for (i = 0; i < nr_pfn_pages; i++)
-+ free(pfn_pages[i]);
-+ free(pfn_pages);
-+ }
-+ free(spare_page);
-+
-+ return 1;
-+}
-+
-+U_BOOT_CMD(swsusp, 4, 0, do_swsusp,
-+ "Restore SWSUSP hibernation image",
-+ "<interface> [<dev[:part]>] [<offset>]"
-+);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch
deleted file mode 100644
index 2a525d39a..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0002-Enable-swsusp-DMA-support.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From 33dfe19185b35fc61613070032836beee0f48c45 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:45:39 +0900
-Subject: [PATCH 2/3] Enable swsusp DMA support
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- common/cmd_swsusp.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 58 insertions(+)
-
-diff --git a/common/cmd_swsusp.c b/common/cmd_swsusp.c
-index ba05aa4..b1d6c22 100644
---- a/common/cmd_swsusp.c
-+++ b/common/cmd_swsusp.c
-@@ -226,6 +226,53 @@ static inline void *malloc_aligned(u32 size, u32 align)
- return (void *)(((u32)malloc(size + align) + align - 1) & ~(align - 1));
- }
-
-+static int block_read(u32 page, void *addr, u32 count)
-+{
-+ __u32 cnt;
-+ int blk_per_page;
-+
-+ blk_per_page = PAGE_SIZE / swap_dev->blksz;
-+ cnt = swap_dev->block_read(swap_dev->dev,
-+ swap_info.start + (page * blk_per_page),
-+ count * blk_per_page, addr);
-+
-+ return cnt != count * blk_per_page;
-+}
-+
-+static int get_block(unsigned char *buffer, u32 size)
-+{
-+ int need_num_pages = size / PAGE_SIZE;
-+ int read_pages = 0;
-+ int count;
-+ u64 start;
-+
-+ do {
-+ u64 prev;
-+ count = 0;
-+
-+ if (!get_meta())
-+ goto exit;
-+
-+ prev = start = meta_map->entries[meta_idx];
-+ do {
-+ count++;
-+ meta_idx++;
-+ if (meta_map->entries[meta_idx] - prev > 1)
-+ break;
-+ prev = meta_map->entries[meta_idx];
-+ } while (read_pages + count < need_num_pages &&
-+ meta_idx < ARRAY_SIZE(meta_map->entries));
-+
-+ if (block_read(start, buffer, count))
-+ return -1;
-+ read_pages += count;
-+ buffer += count * PAGE_SIZE;
-+ } while (read_pages < need_num_pages);
-+
-+exit:
-+ return read_pages * PAGE_SIZE;
-+}
-+
- #endif
-
- static int page_read(u32 page, void *addr)
-@@ -465,12 +512,23 @@ static int image_page_get_next(void *buffer)
- cmp_len = *(size_t *) cmp_buf;
- cmp_avail = PAGE_SIZE;
-
-+#ifdef CONFIG_SH_DMA
-+ while (cmp_avail < cmp_len + LZO_HEADER) {
-+ /* try to DMA-read whole block */
-+ ret = get_block(cmp_buf + cmp_avail,
-+ cmp_len + LZO_HEADER);
-+ if (unlikely(ret <= 0))
-+ return ret;
-+ cmp_avail += ret;
-+ }
-+#else
- while (cmp_avail < cmp_len + LZO_HEADER) {
- ret = raw_page_get_next(cmp_buf + cmp_avail);
- if (unlikely(ret <= 0))
- return ret;
- cmp_avail += PAGE_SIZE;
- }
-+#endif
- unc_len = LZO_UNC_SIZE;
- ret = lzo1x_decompress_safe(cmp_buf + LZO_HEADER,
- cmp_len, unc_buf, &unc_len);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch
deleted file mode 100755
index 8bfcccbbf..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch
+++ /dev/null
@@ -1,1058 +0,0 @@
-From 4ce00daa904a40701ab6bed44506fe97b8f1da47 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 19 May 2017 14:48:38 +0900
-Subject: [PATCH 3/4] Add Hibernation swsuspmem command support
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- common/Makefile | 2 +
- common/cmd_swsuspmem.c | 944 +++++++++++++++++++++++++++++++++++++++++++++
- include/swsuspmem.h | 24 ++
- lib/lzo/lzo1x_decompress.c | 12 +-
- 4 files changed, 980 insertions(+), 2 deletions(-)
- create mode 100644 common/cmd_swsuspmem.c
- create mode 100644 include/swsuspmem.h
-
-diff --git a/common/Makefile b/common/Makefile
-index 54fcc81..7a18486 100644
---- a/common/Makefile
-+++ b/common/Makefile
-@@ -160,6 +160,8 @@ COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o
- COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o
- COBJS-$(CONFIG_CMD_SPIBOOTLDR) += cmd_spibootldr.o
- COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
-+COBJS-$(CONFIG_CMD_SWSUSP) += cmd_swsusp.o
-+COBJS-$(CONFIG_CMD_SWSUSPMEM) += cmd_swsuspmem.o
- COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
- COBJS-$(CONFIG_CMD_TIME) += cmd_time.o
- COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o
-diff --git a/common/cmd_swsuspmem.c b/common/cmd_swsuspmem.c
-new file mode 100644
-index 0000000..6980aaf
---- /dev/null
-+++ b/common/cmd_swsuspmem.c
-@@ -0,0 +1,944 @@
-+/*
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
-+
-+#include <common.h>
-+#include <command.h>
-+#include <part.h>
-+#include <malloc.h>
-+
-+#include <linux/lzo.h>
-+#include "../arch/arm/cpu/armv7/rmobile/crc32_word4.h"
-+#include <swsuspmem.h>
-+
-+/* Note for Renesas--based boards:
-+ * We have the following memory split here:
-+ * 0x40000000 - u_boot_lowest - used to store pfns at physical addresses
-+ * u_boot_lowest - 0x8000000 - pfns are relocated, and then later put
-+ * on physical addresses (swsusp_finish)
-+ * 0x8000000 - 0xc0000000 - used to store pfns with physical address
-+ * of 0x200000000 (long address), we have to change offset for them.
-+ * Any pfn with address > 0x8000000 but less than 0x200000000
-+ * is an error.
-+ * For boards which do not have memory above first GB, that will
-+ * still work, as they won't have anything above 0x80000000
-+ * in their image, so for standard 2GB setup ou should put
-+ * your secong GB in 0x80000000-0xC0000000 range, you can
-+ * use MMU for that or if your RAM is continous, it will
-+ * naturally be there. */
-+
-+DECLARE_GLOBAL_DATA_PTR;
-+
-+/* #define PAGEMAP_DEBUG */
-+
-+#ifdef PAGEMAP_DEBUG
-+#define SWSUSP_DEBUG_INFO
-+#endif
-+
-+#define SWSUSP_KEEP_IMAGE
-+
-+#ifndef likely
-+# define likely(x) __builtin_expect(!!(x), 1)
-+# define unlikely(x) __builtin_expect(!!(x), 0)
-+#endif
-+
-+#define HIBERNATE_SIG "S1SUSPEND"
-+#define PAGE_SIZE (4096)
-+/* Define depending on CONFIG_LBDAF in kernel */
-+
-+typedef u64 sector_t;
-+
-+struct swsusp_header {
-+ char reserved[PAGE_SIZE - 20
-+ - sizeof(sector_t) - sizeof(int) - sizeof(u32)
-+ - sizeof(CRC32_WORD4_t) - sizeof(u32)];
-+ CRC32_WORD4_t comp_crc32;
-+ u32 img_size; /* append */
-+ u32 crc32;
-+ sector_t image;
-+ unsigned int flags;
-+ char orig_sig[10];
-+ char sig[10];
-+} __packed;
-+
-+#define __NEW_UTS_LEN 64
-+
-+struct new_utsname {
-+ char sysname[__NEW_UTS_LEN + 1];
-+ char nodename[__NEW_UTS_LEN + 1];
-+ char release[__NEW_UTS_LEN + 1];
-+ char version[__NEW_UTS_LEN + 1];
-+ char machine[__NEW_UTS_LEN + 1];
-+ char domainname[__NEW_UTS_LEN + 1];
-+};
-+
-+struct swsusp_archdata {
-+ u32 nosave_backup_phys;
-+ u32 nosave_begin_phys;
-+ u32 nosave_end_phys;
-+ void (*cpu_resume_restore_nosave)(u32, u32, u32);
-+};
-+
-+struct swsusp_info {
-+ struct new_utsname uts;
-+ u32 version_code;
-+ unsigned long num_physpages;
-+ int cpus;
-+ unsigned long image_pages;
-+ unsigned long pages;
-+ unsigned long size;
-+ char archdata[1024];
-+};
-+
-+struct swap_map_page {
-+ u64 entries[PAGE_SIZE / sizeof(u64) - 1];
-+ u64 next_swap;
-+};
-+
-+struct swsusp_finish_context {
-+ void *remap_orig_page;
-+ void *remap_temp_page;
-+ struct swsusp_archdata archdata;
-+};
-+#ifdef FTEN_SPF_SDRAM_BASE
-+#define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
-+#define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_OFFSET)
-+#else
-+#define USED_ADDRESS_TOP (0x40000000)
-+#define USED_ADDRESS_END (0x48000000)
-+#endif
-+#define PG_UB2ZERO(pg) ((pg) - CONFIG_SYS_SDRAM_BASE / PAGE_SIZE)
-+static u32 const exclude_min_page =
-+ (USED_ADDRESS_TOP) / PAGE_SIZE;
-+static u32 const exclude_max_page =
-+ (USED_ADDRESS_END - 1) / PAGE_SIZE;
-+static u32 const exclude_min_page_ub =
-+ PG_UB2ZERO((USED_ADDRESS_TOP) / PAGE_SIZE);
-+static u32 const exclude_max_page_ub =
-+ PG_UB2ZERO((USED_ADDRESS_END-1) / PAGE_SIZE);
-+
-+/*
-+ #define SD_PLATFORM_MODE 1
-+ #define SD_CRC32_MODE 4
-+ */
-+#define SF_NOCOMPRESS_MODE 2
-+
-+#define LZO_HEADER sizeof(size_t)
-+
-+/* Number of pages/bytes we'll compress at one time. */
-+#define LZO_UNC_PAGES 32
-+#define LZO_UNC_SIZE (LZO_UNC_PAGES * PAGE_SIZE)
-+
-+/* Number of pages/bytes we need for compressed data (worst case). */
-+#define LZO_CMP_PAGES DIV_ROUND_UP(lzo1x_worst_compress(LZO_UNC_SIZE) + \
-+ LZO_HEADER, PAGE_SIZE)
-+#define LZO_CMP_SIZE (LZO_CMP_PAGES * PAGE_SIZE)
-+
-+static struct swsuspmem_hook *_hook;
-+
-+#define CALL_HOOK(f, param) \
-+ do { \
-+ if (_hook != NULL) { \
-+ if (_hook->f != NULL) \
-+ _hook->f(param); \
-+ } \
-+ } while (0)
-+
-+#ifdef PAGEMAP_DEBUG
-+static int debugout;
-+static int _last_read_pages;
-+#define PAGEMAP_INFO(_msg, ...) \
-+ do { \
-+ if (debugout == 1) \
-+ printf(_msg, ## __VA_ARGS__); \
-+ } while (0)
-+#endif
-+
-+#define HIGHMEM_PHYS_ADDR 0x200000000ULL
-+#define HIGHMEM_VA 0x80000000UL
-+#define HIGHMEM_PFN (HIGHMEM_PHYS_ADDR / PAGE_SIZE)
-+#define LOW_TOP 0x80000000
-+#define LOW_TOP_PFN (LOW_TOP / PAGE_SIZE)
-+#define LOW_BOTTOM CONFIG_SYS_SDRAM_BASE
-+#define LOW_BOTTOM_PFN (LOW_BOTTOM / PAGE_SIZE)
-+#define TOP_ADDRESS 0x240000000ULL
-+
-+static inline int pfn_is_low(u32 pfn)
-+{
-+ return ((pfn >= LOW_BOTTOM_PFN) && (pfn < LOW_TOP_PFN));
-+}
-+
-+static inline int pfn_is_high(u32 pfn)
-+{
-+ return (pfn >= HIGHMEM_PFN);
-+}
-+
-+#define pfn_is_valid(p) (pfn_is_low(p) || pfn_is_high(p))
-+
-+static inline int pfn_is_excluded(u32 pfn)
-+{
-+ /* Allow bottom 2 pages for exception vectors */
-+ if (pfn < (LOW_BOTTOM_PFN + 2))
-+ return 0;
-+ else if (exclude_min_page >= exclude_max_page)
-+ return 0;
-+ else
-+ return (pfn >= exclude_min_page) && (pfn <= exclude_max_page);
-+}
-+/* PFN to zero-counted page */
-+static inline u32 pg_ub2zero(u32 pg)
-+{
-+ return pg - LOW_BOTTOM_PFN;
-+}
-+
-+/* zero-counted page to PFN */
-+static inline u32 pg_zero2ub(u32 pg)
-+{
-+ return pg + LOW_BOTTOM_PFN;
-+}
-+
-+/* PFN to physical address (64-bit (40-bit)) */
-+static inline u64 pg2phys(u32 page)
-+{
-+ return (u64) page * PAGE_SIZE;
-+}
-+
-+/* PFN to virtual address */
-+static inline void *pg2addr(u32 page)
-+{
-+ void *addr;
-+ if (page >= HIGHMEM_PFN)
-+ addr = (void *) (u32)(pg2phys(page - HIGHMEM_PFN) + HIGHMEM_VA);
-+ else
-+ addr = (void *) (u32)pg2phys(page);
-+
-+ return addr;
-+}
-+/* Virtual address to PFN */
-+static inline u32 addr2pg(void *addr)
-+{
-+ return ((u32)(addr)) / PAGE_SIZE;
-+}
-+static void *offt_addr = (void *)0x44000000;
-+static int page_read_mem(u64 page, void *addr)
-+{
-+ memcpy(addr, (u8 *)offt_addr + page * PAGE_SIZE, PAGE_SIZE);
-+ return 0;
-+}
-+
-+#ifndef SWSUSP_KEEP_IMAGE
-+static int page_write_mem(u32 page, void *addr)
-+{
-+ memcpy((u8 *)offt_addr + page * PAGE_SIZE, addr, PAGE_SIZE);
-+ return 0;
-+}
-+#endif
-+
-+#define FAST_COPY
-+static void __attribute__((section(".rodata")))
-+ __attribute__((optimize("O6", "unroll-loops")))
-+swsusp_finish(void *userdata)
-+{
-+ struct swsusp_finish_context *context = userdata;
-+ u32 **remap_orig;
-+ u32 **remap_temp;
-+ int idx = 0;
-+ const int lastidx = PAGE_SIZE / sizeof(u32) - 1;
-+
-+ remap_orig = context->remap_orig_page;
-+ remap_temp = context->remap_temp_page;
-+
-+ __asm__ volatile ("" : : : "memory");
-+ for (;;) {
-+ u32 *orig, *temp;
-+ int count;
-+
-+ /* Linked list to next page */
-+ if (idx == lastidx) {
-+ remap_orig = (u32 **)remap_orig[idx];
-+ remap_temp = (u32 **)remap_temp[idx];
-+ idx = 0;
-+ }
-+ if (unlikely(!remap_orig || remap_orig[idx] == (u32 *)~0UL))
-+ break;
-+ orig = remap_orig[idx];
-+ temp = remap_temp[idx];
-+#ifdef FAST_COPY
-+ count = PAGE_SIZE / sizeof(u32) / 32;
-+ __asm__ volatile (
-+ "1:\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "ldmia %[rtemp]!, {r0-r7}\n"
-+ "subs %[count], %[count], #1\n"
-+ "stmia %[rorig]!, {r0-r7}\n"
-+ "bgt 1b\n"
-+ : /* No outputs */
-+ :
-+ [rorig]"h" (orig),
-+ [rtemp]"h" (temp),
-+ [count]"h" (count)
-+ : "r0", "r1", "r2", "r3",
-+ "r4", "r5", "r6", "r7",
-+ "cc", "memory"
-+ );
-+#else
-+ count = PAGE_SIZE / sizeof(u32);
-+ while (count--)
-+ *orig++ = *temp++;
-+#endif
-+#ifdef SWSUSP_CHECK_COPY_RESULT
-+ count = PAGE_SIZE / sizeof(u32);
-+ orig = remap_orig[idx];
-+ temp = remap_temp[idx];
-+ __asm__ volatile (
-+ "1:\n"
-+ "ldr r3, [%[rorig]]\n"
-+ "ldr r4, [%[rtemp]]\n"
-+ "cmp r3, r4\n"
-+ "bne 2f\n"
-+ "add %[rorig], %[rorig], #4\n"
-+ "add %[rtemp], %[rtemp], #4\n"
-+ "subs %[count], %[count], #1\n"
-+ "bgt 1b\n"
-+ "b 3f\n"
-+ "2:b 2b\n"
-+ "3:\n"
-+ :
-+ [rorig]"+r" (orig),
-+ [rtemp]"+r" (temp),
-+ [count]"+r" (count)
-+ :
-+ : "r3", "r4", "cc", "memory"
-+ );
-+#endif
-+ idx++;
-+ }
-+ context->archdata.cpu_resume_restore_nosave(
-+ context->archdata.nosave_backup_phys,
-+ context->archdata.nosave_begin_phys,
-+ context->archdata.nosave_end_phys);
-+}
-+
-+static struct swap_map_page *meta_map;
-+static u64 meta_map_next;
-+static u64 meta_map_curr;
-+static u64 meta_map_start;
-+static int meta_idx;
-+
-+static int raw_page_init(u64 start)
-+{
-+ meta_map = malloc(PAGE_SIZE);
-+ if (!meta_map)
-+ return -1;
-+ meta_map_next = 0;
-+ meta_map_curr = 0;
-+ meta_map_start = start;
-+ return 0;
-+}
-+
-+static void raw_page_start(void)
-+{
-+ meta_idx = ARRAY_SIZE(meta_map->entries);
-+ meta_map_next = meta_map_start;
-+}
-+
-+static int raw_page_get_next(void *buffer)
-+{
-+ if (meta_idx == ARRAY_SIZE(meta_map->entries)) {
-+ if (!meta_map_next)
-+ return 0;
-+ if (meta_map_curr != meta_map_next) {
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO("META: %d (%08x)\n", (int)meta_map_next,
-+ (unsigned int)(meta_map_next
-+ * PAGE_SIZE));
-+#endif
-+ if (page_read_mem(meta_map_next, meta_map))
-+ return -1;
-+ meta_map_curr = meta_map_next;
-+ meta_map_next = meta_map->next_swap;
-+ }
-+ meta_idx = 0;
-+ }
-+#ifdef PAGEMAP_DEBUG
-+ {
-+ static unsigned int pre;
-+ if ((pre + 1) != meta_map->entries[meta_idx]) {
-+ PAGEMAP_INFO("DATA-Skiped: %d->%d (%08x->%08x)\n",
-+ pre, (unsigned int)meta_map->entries[meta_idx],
-+ pre * PAGE_SIZE,
-+ (unsigned int)(meta_map->entries[meta_idx]
-+ * PAGE_SIZE));
-+ }
-+ pre = meta_map->entries[meta_idx];
-+ _last_read_pages = pre;
-+ }
-+#endif
-+ if (page_read_mem(meta_map->entries[meta_idx++], buffer))
-+ return -1;
-+
-+ return 1;
-+}
-+
-+static void raw_page_exit(void)
-+{
-+ free(meta_map);
-+ meta_map = NULL;
-+}
-+
-+static int image_pages_avail;
-+static unsigned char *unc_buf, *cmp_buf;
-+static int unc_offset;
-+
-+static int image_page_init(int compressed)
-+{
-+ if (!compressed)
-+ return 1;
-+
-+ unc_buf = malloc(LZO_UNC_SIZE);
-+ cmp_buf = malloc(LZO_CMP_SIZE);
-+ if (!unc_buf || !cmp_buf) {
-+ printf("not enogh memory\n");
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+static void image_page_start(void)
-+{
-+ image_pages_avail = 0;
-+}
-+
-+static int image_page_get_next(void *buffer)
-+{
-+#ifdef CONFIG_LZO
-+ if (!image_pages_avail) {
-+ int ret;
-+ size_t unc_len, cmp_len, cmp_avail;
-+
-+ ret = raw_page_get_next(cmp_buf);
-+ if (ret <= 0)
-+ return ret;
-+
-+ cmp_len = *(size_t *) cmp_buf;
-+ cmp_avail = PAGE_SIZE;
-+
-+ while (cmp_avail < cmp_len + LZO_HEADER) {
-+ ret = raw_page_get_next(cmp_buf + cmp_avail);
-+ if (unlikely(ret <= 0))
-+ return ret;
-+ cmp_avail += PAGE_SIZE;
-+ }
-+
-+ unc_len = LZO_UNC_SIZE;
-+ ret = lzo1x_decompress_safe(cmp_buf + LZO_HEADER,
-+ cmp_len, unc_buf, &unc_len);
-+ if (unlikely(ret != LZO_E_OK)) {
-+ printf("Decompression failure: %d,"
-+ " cmp_buf = %p,"
-+ " cmp_len = %d, unc_len = %d\n",
-+ ret, cmp_buf + LZO_HEADER, cmp_len,
-+ unc_len);
-+ return ret;
-+ }
-+ image_pages_avail = unc_len / PAGE_SIZE;
-+ unc_offset = 0;
-+ }
-+
-+ memcpy(buffer, unc_buf + unc_offset, PAGE_SIZE);
-+ unc_offset += PAGE_SIZE;
-+ image_pages_avail--;
-+ return 1;
-+#else
-+ printf("No LZO support in u-boot.\n");
-+ return -1;
-+#endif
-+}
-+
-+static void image_page_exit(void)
-+{
-+ free(unc_buf);
-+ free(cmp_buf);
-+ unc_buf = cmp_buf = NULL;
-+}
-+
-+static void bitmap_set(u32 *bm, unsigned int bit)
-+{
-+ bm[bit >> 5] |= (1 << (bit & 0x1f));
-+}
-+
-+static int bitmap_is_set(u32 *bm, unsigned int bit)
-+{
-+ return !!(bm[bit >> 5] & (1 << (bit & 0x1f)));
-+}
-+
-+static u32 *used_bitmap;
-+static u32 next_free_page;
-+static u32 total_pages;
-+
-+static int free_page_init(void)
-+{
-+ total_pages = (u32)((TOP_ADDRESS -
-+ LOW_BOTTOM) / PAGE_SIZE); /* 2GB */
-+ used_bitmap = malloc(total_pages * sizeof(u32) / 32);
-+ if (!used_bitmap)
-+ return -1;
-+ return 0;
-+}
-+
-+static void free_page_start(int offset)
-+{
-+ memset(used_bitmap, 0, total_pages * sizeof(u32) / 32);
-+ next_free_page = pg_ub2zero(offset);
-+}
-+
-+static void free_page_mark_used(u32 page);
-+/* Returns full-address based pages */
-+static int free_page_get_next(void)
-+{
-+ while (bitmap_is_set(used_bitmap, next_free_page))
-+ next_free_page++;
-+ free_page_mark_used(next_free_page);
-+ return pg_zero2ub(next_free_page++);
-+}
-+
-+static void free_page_mark_used(u32 page)
-+{
-+ bitmap_set(used_bitmap, page);
-+}
-+
-+static void free_page_exit(void)
-+{
-+ free(used_bitmap);
-+ used_bitmap = NULL;
-+}
-+
-+void set_swsuspmem_hook(struct swsuspmem_hook *hook)
-+{
-+ _hook = hook;
-+}
-+
-+/*
-+ * rtn = 1 : Hibernation image OK.
-+ * rtn = 0 : Hibernation image NG.
-+ * */
-+int do_checksnapimage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-+{
-+ __u32 offset = 0;
-+ void *spare_page = NULL;
-+ struct swsusp_header *swsusp_header;
-+ CRC32_WORD4_t calc_crc;
-+
-+ /* Address hack */
-+ if (argc > 1) {
-+ char *ep;
-+ offt_addr = (void *)simple_strtoul(argv[1], &ep, 16);
-+ if (*ep) {
-+ printf("Invalid address\n");
-+ return 0;
-+ }
-+ }
-+
-+ spare_page = malloc(PAGE_SIZE);
-+ if (!spare_page)
-+ goto mem_err;
-+
-+ swsusp_header = spare_page;
-+ if (page_read_mem(offset, swsusp_header))
-+ goto read_err;
-+
-+#ifdef SWSUSP_DEBUG_INFO
-+ PAGEMAP_INFO("swssp_header:%x\n", swsusp_header);
-+ PAGEMAP_INFO(" comp_crc: <snip>\n");
-+ PAGEMAP_INFO(" img_size: %d\n", swsusp_header->img_size);
-+ PAGEMAP_INFO(" image(swap firest sector): %08x\n",
-+ (unsigned int)swsusp_header->image);
-+ PAGEMAP_INFO(" flags: %08x\n", swsusp_header->flags);
-+ PAGEMAP_INFO(" orig_sig:%s\n", swsusp_header->orig_sig);
-+ PAGEMAP_INFO(" sig:%s\n", swsusp_header->sig);
-+#endif /* SWSUSP_DEBUG_INFO */
-+
-+ if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
-+ || (swsusp_header->img_size == 0)
-+ || (swsusp_header->img_size > 0x03fff000)) {
-+ printf("No hibernation image present\n");
-+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
-+ return 0;
-+ }
-+ memset(&calc_crc, 0, sizeof(calc_crc));
-+
-+ calc_crc32x4((u8 *)((unsigned long)offt_addr + PAGE_SIZE),
-+ swsusp_header->img_size, &calc_crc);
-+
-+ if (memcmp(&calc_crc, &swsusp_header->comp_crc32,
-+ sizeof(CRC32_WORD4_t))) {
-+ printf("Bad CRC for image, image: %08x:%08x:"
-+ "%08x:%08x, calc: %08x:%08x:%08x:%08x\n",
-+ swsusp_header->comp_crc32.crc_w[0],
-+ swsusp_header->comp_crc32.crc_w[1],
-+ swsusp_header->comp_crc32.crc_w[2],
-+ swsusp_header->comp_crc32.crc_w[3],
-+ calc_crc.crc_w[0], calc_crc.crc_w[1],
-+ calc_crc.crc_w[2], calc_crc.crc_w[3]);
-+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
-+ return 0;
-+ }
-+ free(spare_page);
-+ printf("Hibernation image OK!.\n");
-+
-+ return 1;
-+
-+mem_err:
-+ printf("Not enough memory.\n");
-+ CALL_HOOK(err_hook, SWSUSPMEM_ENOMEM);
-+ goto err;
-+
-+read_err:
-+ printf("Read error while restoring image.\n");
-+
-+err:
-+ __asm__ volatile (
-+ "mov r0, #0\n"
-+ "mcr p15, 0, r0, c7, c5, 0 @ invalidate icache\n"
-+ "mcr p15, 0, r0, c7, c10, 4 @ DSB\n"
-+ "mcr p15, 0, r0, c7, c5, 4 @ ISB\n"
-+ : : : "r0", "memory");
-+
-+ free(spare_page);
-+
-+ CALL_HOOK(err_hook, SWSUSPMEM_RESTOREFAIL);
-+ return 0;
-+}
-+
-+U_BOOT_CMD(checksnapimage, 2, 2, do_checksnapimage,
-+ "Check hibernation image data from memory",
-+ "<address>]"
-+);
-+
-+int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-+{
-+ __u32 offset = 0;
-+ void *spare_page = NULL;
-+ struct swsusp_header *swsusp_header;
-+ struct swsusp_info *swsusp_info;
-+ struct swsusp_finish_context *context;
-+ int max_page;
-+ int i;
-+ u32 nr_pfn_pages;
-+ u32 **pfn_pages = NULL;
-+ u32 *remap_orig_page;
-+ u32 *remap_temp_page;
-+ u32 **remap_orig;
-+ u32 **remap_temp;
-+ int remap_idx;
-+ void (*swsusp_finish_copy)(void *);
-+ char *data_page;
-+ char *stack_addr;
-+ CRC32_WORD4_t calc_crc;
-+ int high_page;
-+
-+#ifdef PAGEMAP_DEBUG
-+ int high_page_images = 0;
-+ int total_remap = 0;
-+ if (getenv("hybdebug") != NULL)
-+ debugout = 1;
-+#endif
-+ /* Address hack */
-+ void *swsusp_finish_p = (void *)((u32)swsusp_finish & ~0x1);
-+ if (argc > 1) {
-+ char *ep;
-+ offt_addr = (void *)simple_strtoul(argv[1], &ep, 16);
-+ if (*ep) {
-+ printf("Invalid address\n");
-+ return 1;
-+ }
-+ }
-+
-+ /* Allow for 16 pages of stack */
-+ max_page = gd->start_addr_sp / PAGE_SIZE - 32;
-+ high_page = (((gd->relocaddr + _bss_end_ofs)
-+ + (PAGE_SIZE - 1)) / PAGE_SIZE) + 1;
-+#define pfn_is_occupied(pfn) (page > max_page && page <= high_page)
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO(" *gd->start_addr_sp:%p\n",
-+ (void *)gd->start_addr_sp);
-+ PAGEMAP_INFO(" *gd->relocaddr:%p\n",
-+ (void *)gd->relocaddr);
-+ PAGEMAP_INFO(" *bss_start_offset:%d bss_end_offset:%d\n",
-+ (int)_bss_start_ofs, (int)_bss_end_ofs);
-+ PAGEMAP_INFO(" UBOOT own memory [%p-%p]\n",
-+ pg2addr(max_page), pg2addr(high_page));
-+#endif
-+ if (free_page_init())
-+ goto mem_err;
-+ free_page_start(exclude_max_page + 1);
-+
-+ spare_page = malloc(PAGE_SIZE);
-+ if (!spare_page)
-+ goto mem_err;
-+
-+ swsusp_header = spare_page;
-+ if (page_read_mem(offset, swsusp_header))
-+ goto read_err;
-+
-+#ifdef SWSUSP_DEBUG_INFO
-+ PAGEMAP_INFO("swssp_header:\n");
-+ PAGEMAP_INFO(" comp_crc: <snip>\n");
-+ PAGEMAP_INFO(" img_size: %d\n", swsusp_header->img_size);
-+ PAGEMAP_INFO(" image(swap firest sector): %08x\n",
-+ (unsigned int)swsusp_header->image);
-+ PAGEMAP_INFO(" flags: %08x\n", swsusp_header->flags);
-+ PAGEMAP_INFO(" orig_sig:%s\n", swsusp_header->orig_sig);
-+ PAGEMAP_INFO(" sig:%s\n", swsusp_header->sig);
-+#endif /* SWSUSP_DEBUG_INFO */
-+
-+ if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
-+ || (swsusp_header->img_size == 0)
-+ || (swsusp_header->img_size > 0x03fff000)) {
-+ printf("No hibernation image present\n");
-+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
-+ return 0;
-+ }
-+ memset(&calc_crc, 0, sizeof(calc_crc));
-+
-+ calc_crc32x4((u8 *)((unsigned long)offt_addr + PAGE_SIZE),
-+ swsusp_header->img_size, &calc_crc);
-+
-+ if (memcmp(&calc_crc, &swsusp_header->comp_crc32,
-+ sizeof(CRC32_WORD4_t))) {
-+ printf("Bad CRC for image, image: %08x:%08x:"
-+ "%08x:%08x, calc: %08x:%08x:%08x:%08x\n",
-+ swsusp_header->comp_crc32.crc_w[0],
-+ swsusp_header->comp_crc32.crc_w[1],
-+ swsusp_header->comp_crc32.crc_w[2],
-+ swsusp_header->comp_crc32.crc_w[3],
-+ calc_crc.crc_w[0], calc_crc.crc_w[1],
-+ calc_crc.crc_w[2], calc_crc.crc_w[3]);
-+ CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
-+ return 0;
-+ }
-+
-+ /* Overwrite header if necessary */
-+#ifndef SWSUSP_KEEP_IMAGE
-+ if (memcmp(swsusp_header->sig, swsusp_header->orig_sig, 10)) {
-+ memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
-+ if (page_write_mem(offset, swsusp_header))
-+ printf("Write error resetting header\n");
-+ }
-+#endif
-+
-+ if (raw_page_init(swsusp_header->image))
-+ goto mem_err;
-+ raw_page_start();
-+
-+ if (image_page_init(!(swsusp_header->flags & SF_NOCOMPRESS_MODE)))
-+ goto mem_err;
-+ image_page_start();
-+
-+ swsusp_info = spare_page;
-+ if (raw_page_get_next(swsusp_info) <= 0)
-+ goto read_err;
-+
-+#ifdef SWSUSP_DEBUG_INFO
-+ PAGEMAP_INFO("swsup_info:\n");
-+ PAGEMAP_INFO(" utsname.sysname:%s\n",
-+ swsusp_info->uts.sysname);
-+ PAGEMAP_INFO(" nodename:%s\n",
-+ swsusp_info->uts.nodename);
-+ PAGEMAP_INFO(" release:%s\n",
-+ swsusp_info->uts.release);
-+ PAGEMAP_INFO(" version:%s\n",
-+ swsusp_info->uts.version);
-+ PAGEMAP_INFO(" machine:%s\n",
-+ swsusp_info->uts.machine);
-+ PAGEMAP_INFO(" vesion_code:%#08x\n",
-+ (unsigned int)swsusp_info->version_code);
-+ PAGEMAP_INFO(" num_physpages:%d\n",
-+ (unsigned int)swsusp_info->num_physpages);
-+ PAGEMAP_INFO(" pages :%d\n",
-+ (unsigned int)swsusp_info->pages);
-+ PAGEMAP_INFO(" size :%d\n",
-+ (unsigned int)swsusp_info->size);
-+#endif
-+
-+ nr_pfn_pages = (swsusp_info->image_pages * 4 + PAGE_SIZE - 1) /
-+ PAGE_SIZE;
-+ pfn_pages = malloc(nr_pfn_pages * sizeof(u32 *));
-+ if (!pfn_pages)
-+ goto mem_err;
-+ memset(pfn_pages, 0, nr_pfn_pages * sizeof(u32 *));
-+
-+ /* UBOOT using memory */
-+ for (i = max_page; i <= high_page; i++)
-+ free_page_mark_used(pg_ub2zero(i));
-+
-+ printf("Allocating %u bytes (nr_pfn_pages %u)\n",
-+ nr_pfn_pages * PAGE_SIZE, nr_pfn_pages);
-+
-+ for (i = 0; i < nr_pfn_pages; i++) {
-+ u32 idx;
-+ pfn_pages[i] = malloc(PAGE_SIZE);
-+ memset(pfn_pages[i], 0xff, PAGE_SIZE);
-+ if (unlikely(!pfn_pages[i]))
-+ goto mem_err;
-+ if (unlikely(image_page_get_next(pfn_pages[i]) <= 0))
-+ goto read_err;
-+ for (idx = 0; idx < PAGE_SIZE / sizeof(u32); idx++) {
-+ u32 page = pfn_pages[i][idx];
-+ if (page == ~0UL) /* End of list of pages */
-+ break;
-+ free_page_mark_used(pg_ub2zero(page));
-+ }
-+ }
-+
-+ printf("Loading image data pages (%lu pages)\n",
-+ swsusp_info->image_pages);
-+
-+ remap_orig_page = pg2addr(free_page_get_next());
-+ remap_temp_page = pg2addr(free_page_get_next());
-+
-+ remap_orig = (u32 **)remap_orig_page;
-+ remap_temp = (u32 **)remap_temp_page;
-+ remap_idx = 0;
-+
-+ for (i = 0; i < swsusp_info->image_pages; i++) {
-+ u32 page = pfn_pages[i >> 10][i & 0x3ff];
-+ if (unlikely(!pfn_is_valid(page))) {
-+ printf("Attempt to restore invalid address %llx\n",
-+ pg2phys(page));
-+ continue;
-+ } else if (unlikely(pfn_is_excluded(page))) {
-+ printf("Attempt to restore excluded address %llx\n",
-+ pg2phys(page));
-+ continue;
-+ } else if (unlikely(pfn_is_low(page) &&
-+ pfn_is_occupied(page))) {
-+ remap_orig[remap_idx] = pg2addr(page);
-+ page = free_page_get_next();
-+ remap_temp[remap_idx] = pg2addr(page);
-+ remap_idx++;
-+#ifdef PAGEMAP_DEBUG
-+ ++total_remap;
-+#endif
-+ /* If we fill our current page, allocate a new one */
-+ if (remap_idx + 1 == PAGE_SIZE / sizeof(u32)) {
-+ u32 *next;
-+
-+ next = pg2addr(free_page_get_next());
-+ remap_orig[remap_idx] = next;
-+ remap_orig = (u32 **)next;
-+
-+ next = pg2addr(free_page_get_next());
-+ remap_temp[remap_idx] = next;
-+ remap_temp = (u32 **)next;
-+
-+ remap_idx = 0;
-+ }
-+ }
-+ if (image_page_get_next(pg2addr(page)) <= 0)
-+ goto read_err;
-+ }
-+
-+ printf("Image loading done.\n");
-+ invalidate_icache_all();
-+
-+ CALL_HOOK(resume_boot, SWSUSPMEM_IMAGEDONE);
-+ /* put end markers on the remap list */
-+ remap_orig[remap_idx] = (void *) ~0UL;
-+ remap_temp[remap_idx] = (void *) ~0UL;
-+
-+#ifdef PAGEMAP_DEBUG
-+ PAGEMAP_INFO("Number of remap pages:%d\n", total_remap);
-+ PAGEMAP_INFO("Number of high pages:%d\n", high_page_images);
-+ PAGEMAP_INFO("Last read page %d (%08x)\n",
-+ _last_read_pages, _last_read_pages * PAGE_SIZE);
-+#endif
-+ remap_orig = (u32 **)remap_orig_page;
-+ remap_temp = (u32 **)remap_temp_page;
-+
-+ /* Make a copy of swsusp_finish in a free data page */
-+ data_page = pg2addr(free_page_get_next());
-+ memcpy(data_page, swsusp_finish_p, PAGE_SIZE);
-+ swsusp_finish_copy = (void *) data_page;
-+
-+ /* Setup context for swsusp_finish at the end of the data_page */
-+ context = (struct swsusp_finish_context *) (data_page + PAGE_SIZE -
-+ sizeof(struct swsusp_finish_context));
-+ context->remap_orig_page = remap_orig_page;
-+ context->remap_temp_page = remap_temp_page;
-+ memcpy((void *)&context->archdata, (void *)swsusp_info->archdata,
-+ sizeof(struct swsusp_archdata));
-+
-+ /* Get a stack pointer for swsusp_finish, growing down from context */
-+ stack_addr = (char *) context;
-+
-+#ifdef CONFIG_NETCONSOLE
-+ /*
-+ * Stop the ethernet stack if NetConsole could have
-+ * left it up
-+ */
-+ eth_halt();
-+#endif
-+#ifdef CONFIG_USB_DEVICE
-+ udc_disconnect();
-+#endif
-+ arch_preboot_os();
-+ cleanup_before_linux();
-+
-+ CALL_HOOK(resume_boot, SWSUSPMEM_RESUME);
-+ /* Copy the final data from a safe place */
-+ call_with_stack(swsusp_finish_copy, context, stack_addr);
-+
-+ return 0;
-+
-+mem_err:
-+ printf("Not enough memory.\n");
-+ CALL_HOOK(err_hook, SWSUSPMEM_ENOMEM);
-+ goto err;
-+
-+read_err:
-+ printf("Read error while restoring image.\n");
-+
-+err:
-+ __asm__ volatile (
-+ "mov r0, #0\n"
-+ "mcr p15, 0, r0, c7, c5, 0 @ invalidate icache\n"
-+ "mcr p15, 0, r0, c7, c10, 4 @ DSB\n"
-+ "mcr p15, 0, r0, c7, c5, 4 @ ISB\n"
-+ : : : "r0", "memory");
-+
-+ raw_page_exit();
-+ image_page_exit();
-+ free_page_exit();
-+ if (pfn_pages) {
-+ for (i = 0; i < nr_pfn_pages; i++)
-+ free(pfn_pages[i]);
-+ free(pfn_pages);
-+ }
-+ free(spare_page);
-+
-+ CALL_HOOK(err_hook, SWSUSPMEM_RESTOREFAIL);
-+ return 1;
-+}
-+
-+U_BOOT_CMD(swsuspmem, 2, 2, do_swsuspmem,
-+ "Restore SWSUSP hibernation image from memory",
-+ "<address>]"
-+);
-diff --git a/include/swsuspmem.h b/include/swsuspmem.h
-new file mode 100644
-index 0000000..3b353ea
---- /dev/null
-+++ b/include/swsuspmem.h
-@@ -0,0 +1,24 @@
-+#ifndef _SWSUSPMEM_H_
-+#define _SWSUSPMEM_H_
-+
-+enum { SWSUSPMEM_NORM = 0,
-+ SWSUSPMEM_NOIMAGE = 0x01,
-+ SWSUSPMEM_BROKENIMAGE = 0x02,
-+ SWSUSPMEM_ENOMEM = 0x80,
-+ SWSUSPMEM_RESTOREFAIL = 0x81,
-+};
-+
-+enum { SWSUSPMEM_IMAGEDONE = 0x01,
-+ SWSUSPMEM_RESUME = 0x02
-+};
-+
-+struct swsuspmem_hook {
-+ void (*err_hook)(int errcode);
-+ void (*resume_boot)(int param);
-+};
-+
-+void set_swsuspmem_hook(struct swsuspmem_hook *hook);
-+void arch_preboot_os(void);
-+void call_with_stack(void (*fn)(void *),
-+ void *userdata, void *stack);
-+#endif
-diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
-index e6ff708..ebdf10b 100644
---- a/lib/lzo/lzo1x_decompress.c
-+++ b/lib/lzo/lzo1x_decompress.c
-@@ -68,13 +68,14 @@ int lzop_decompress(const unsigned char *src, size_t src_len,
- unsigned char *start = dst;
- const unsigned char *send = src + src_len;
- u32 slen, dlen;
-- size_t tmp;
-+ size_t tmp, remaining;
- int r;
-
- src = parse_header(src);
- if (!src)
- return LZO_E_ERROR;
-
-+ remaining = *dst_len;
- while (src < send) {
- /* read uncompressed block size */
- dlen = get_unaligned_be32(src);
-@@ -93,18 +94,25 @@ int lzop_decompress(const unsigned char *src, size_t src_len,
- if (slen <= 0 || slen > dlen)
- return LZO_E_ERROR;
-
-+ /* abort if buffer ran out of room */
-+ if (dlen > remaining)
-+ return LZO_E_OUTPUT_OVERRUN;
-+
- /* decompress */
- tmp = dlen;
- r = lzo1x_decompress_safe((u8 *) src, slen, dst, &tmp);
-
-- if (r != LZO_E_OK)
-+ if (r != LZO_E_OK) {
-+ *dst_len = dst - start;
- return r;
-+ }
-
- if (dlen != tmp)
- return LZO_E_ERROR;
-
- src += slen;
- dst += dlen;
-+ remaining -= dlen;
- }
-
- return LZO_E_INPUT_OVERRUN;
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch
deleted file mode 100644
index e6682354e..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0003-Add-hibernation-image-area.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From eae2ee2090f8c9c140a1b766bd7312be5f0f308d Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:46:54 +0900
-Subject: [PATCH 3/3] Add hibernation image area
-
-0x40000000 <-> 0x77FFFFFF : kernel
-0x78000000 <-> 0x7FFFFFFF : hibernation image area
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- common/cmd_swsuspmem.c | 20 +++++++++++++-------
- 1 file changed, 13 insertions(+), 7 deletions(-)
-
-diff --git a/common/cmd_swsuspmem.c b/common/cmd_swsuspmem.c
-index 6980aaf..dbc000c 100644
---- a/common/cmd_swsuspmem.c
-+++ b/common/cmd_swsuspmem.c
-@@ -116,8 +116,9 @@ struct swsusp_finish_context {
- #define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
- #define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_OFFSET)
- #else
--#define USED_ADDRESS_TOP (0x40000000)
--#define USED_ADDRESS_END (0x48000000)
-+#define CONFIG_SYS_LOAD_OFFSET 0x0
-+#define USED_ADDRESS_TOP (CONFIG_SYS_SDRAM_BASE)
-+#define USED_ADDRESS_END (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_OFFSET)
- #endif
- #define PG_UB2ZERO(pg) ((pg) - CONFIG_SYS_SDRAM_BASE / PAGE_SIZE)
- static u32 const exclude_min_page =
-@@ -157,7 +158,7 @@ static struct swsuspmem_hook *_hook;
- } while (0)
-
- #ifdef PAGEMAP_DEBUG
--static int debugout;
-+static int debugout = 1;
- static int _last_read_pages;
- #define PAGEMAP_INFO(_msg, ...) \
- do { \
-@@ -231,7 +232,7 @@ static inline u32 addr2pg(void *addr)
- {
- return ((u32)(addr)) / PAGE_SIZE;
- }
--static void *offt_addr = (void *)0x44000000;
-+static void *offt_addr = (void *)0x78000000;
- static int page_read_mem(u64 page, void *addr)
- {
- memcpy(addr, (u8 *)offt_addr + page * PAGE_SIZE, PAGE_SIZE);
-@@ -577,7 +578,7 @@ int do_checksnapimage(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-
- if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
- || (swsusp_header->img_size == 0)
-- || (swsusp_header->img_size > 0x03fff000)) {
-+ || (swsusp_header->img_size > 0x05fff000)) {
- printf("No hibernation image present\n");
- CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
- return 0;
-@@ -674,7 +675,9 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
- /* Allow for 16 pages of stack */
- max_page = gd->start_addr_sp / PAGE_SIZE - 32;
- high_page = (((gd->relocaddr + _bss_end_ofs)
-- + (PAGE_SIZE - 1)) / PAGE_SIZE) + 1;
-+ + (PAGE_SIZE - 1)) / PAGE_SIZE) + 1 + 0xf;
-+ if (high_page > 0x7ffff)
-+ high_page = 0x7ffff;
- #define pfn_is_occupied(pfn) (page > max_page && page <= high_page)
- #ifdef PAGEMAP_DEBUG
- PAGEMAP_INFO(" *gd->start_addr_sp:%p\n",
-@@ -711,7 +714,7 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-
- if (memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)
- || (swsusp_header->img_size == 0)
-- || (swsusp_header->img_size > 0x03fff000)) {
-+ || (swsusp_header->img_size > 0x05fff000)) {
- printf("No hibernation image present\n");
- CALL_HOOK(err_hook, SWSUSPMEM_BROKENIMAGE);
- return 0;
-@@ -830,8 +833,11 @@ int do_swsuspmem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
- continue;
- } else if (unlikely(pfn_is_low(page) &&
- pfn_is_occupied(page))) {
-+ /* Virtual 32-bit original address */
- remap_orig[remap_idx] = pg2addr(page);
-+ /* allocating new free page */
- page = free_page_get_next();
-+ /* Virtual 32-bit remap address */
- remap_temp[remap_idx] = pg2addr(page);
- remap_idx++;
- #ifdef PAGEMAP_DEBUG
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0004-Add-porter-board-Hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0004-Add-porter-board-Hibernation-code.patch
deleted file mode 100755
index 1b2278b2e..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot/hibernation/0004-Add-porter-board-Hibernation-code.patch
+++ /dev/null
@@ -1,1352 +0,0 @@
-From 80d5c1269bd16fedce41611e45f25d156425b0c9 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 19 May 2017 16:16:18 +0900
-Subject: [PATCH 4/4] Add porter board Hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- arch/arm/cpu/armv7/Makefile | 4 +
- arch/arm/cpu/armv7/arch_timer.c | 58 ++++++
- arch/arm/cpu/armv7/cache_v7.c | 14 +-
- arch/arm/cpu/armv7/rmobile/Makefile | 4 +
- arch/arm/cpu/armv7/rmobile/arm_arch_timer.c | 61 ++++++
- arch/arm/cpu/armv7/rmobile/crc32_word4.c | 299 ++++++++++++++++++++++++++++
- arch/arm/cpu/armv7/rmobile/crc32_word4.h | 23 +++
- arch/arm/cpu/armv7/rmobile/sh_timer.c | 209 +++++++++++++++++++
- arch/arm/include/asm/arch-rmobile/rmobile.h | 2 +
- arch/arm/include/asm/armv7.h | 16 +-
- arch/arm/include/asm/system.h | 136 ++++++++++++-
- arch/arm/lib/Makefile | 2 +
- arch/arm/lib/board.c | 2 +-
- arch/arm/lib/cache-cp15.c | 123 +++++++++++-
- arch/arm/lib/call_with_stack.S | 20 ++
- board/renesas/porter/porter.c | 10 +
- include/configs/porter.h | 19 +-
- 17 files changed, 977 insertions(+), 25 deletions(-)
- create mode 100644 arch/arm/cpu/armv7/arch_timer.c
- create mode 100644 arch/arm/cpu/armv7/rmobile/arm_arch_timer.c
- create mode 100644 arch/arm/cpu/armv7/rmobile/crc32_word4.c
- create mode 100644 arch/arm/cpu/armv7/rmobile/crc32_word4.h
- create mode 100644 arch/arm/cpu/armv7/rmobile/sh_timer.c
- create mode 100644 arch/arm/lib/call_with_stack.S
-
-diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
-index 4fdbee4..f68ce5c 100644
---- a/arch/arm/cpu/armv7/Makefile
-+++ b/arch/arm/cpu/armv7/Makefile
-@@ -32,6 +32,10 @@ COBJS += cache_v7.o
- COBJS += cpu.o
- COBJS += syslib.o
-
-+ifneq ($(CONFIG_SYS_ARCH_TIMER),)
-+COBJS += arch_timer.o
-+endif
-+
- ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
- SOBJS += lowlevel_init.o
- endif
-diff --git a/arch/arm/cpu/armv7/arch_timer.c b/arch/arm/cpu/armv7/arch_timer.c
-new file mode 100644
-index 0000000..747b6e9
---- /dev/null
-+++ b/arch/arm/cpu/armv7/arch_timer.c
-@@ -0,0 +1,58 @@
-+/*
-+ * (C) Copyright 2012-2014
-+ * Texas Instruments Incorporated, <www.ti.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0+
-+ */
-+
-+#include <common.h>
-+#include <asm/io.h>
-+#include <div64.h>
-+
-+DECLARE_GLOBAL_DATA_PTR;
-+
-+int timer_init(void)
-+{
-+ gd->tbl = 0;
-+ gd->tbu = 0;
-+
-+ gd->timer_rate_hz = CONFIG_SYS_HZ_CLOCK / CONFIG_SYS_HZ;
-+
-+ return 0;
-+}
-+
-+unsigned long long get_ticks(void)
-+{
-+ ulong nowl, nowu;
-+
-+ asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (nowl), "=r" (nowu));
-+
-+ gd->tbl = nowl;
-+ gd->tbu = nowu;
-+
-+ return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
-+}
-+
-+
-+ulong get_timer(ulong base)
-+{
-+ return lldiv(get_ticks(), gd->timer_rate_hz) - base;
-+}
-+
-+void __udelay(unsigned long usec)
-+{
-+ unsigned long long endtime;
-+
-+ endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz,
-+ 1000UL);
-+
-+ endtime += get_ticks();
-+
-+ while (get_ticks() < endtime)
-+ ;
-+}
-+
-+ulong get_tbclk(void)
-+{
-+ return gd->timer_rate_hz;
-+}
-diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
-index 5f6d039..5a0bdb8 100644
---- a/arch/arm/cpu/armv7/cache_v7.c
-+++ b/arch/arm/cpu/armv7/cache_v7.c
-@@ -82,7 +82,7 @@ static void v7_inval_dcache_level_setway(u32 level, u32 num_sets,
- }
- }
- /* DSB to make sure the operation is complete */
-- CP15DSB;
-+ DSB();
- }
-
- static void v7_clean_inval_dcache_level_setway(u32 level, u32 num_sets,
-@@ -109,7 +109,7 @@ static void v7_clean_inval_dcache_level_setway(u32 level, u32 num_sets,
- }
- }
- /* DSB to make sure the operation is complete */
-- CP15DSB;
-+ DSB();
- }
-
- static void v7_maint_dcache_level_setway(u32 level, u32 operation)
-@@ -230,7 +230,7 @@ static void v7_dcache_maint_range(u32 start, u32 stop, u32 range_op)
- }
-
- /* DSB to make sure the operation is complete */
-- CP15DSB;
-+ DSB();
- }
-
- /* Invalidate TLB */
-@@ -243,9 +243,9 @@ static void v7_inval_tlb(void)
- /* Invalidate entire instruction TLB */
- asm volatile ("mcr p15, 0, %0, c8, c5, 0" : : "r" (0));
- /* Full system DSB - make sure that the invalidation is complete */
-- CP15DSB;
-+ DSB();
- /* Full system ISB - make sure the instruction stream sees it */
-- CP15ISB;
-+ ISB();
- }
-
- void invalidate_dcache_all(void)
-@@ -356,10 +356,10 @@ void invalidate_icache_all(void)
- asm volatile ("mcr p15, 0, %0, c7, c5, 6" : : "r" (0));
-
- /* Full system DSB - make sure that the invalidation is complete */
-- CP15DSB;
-+ DSB();
-
- /* ISB - make sure the instruction stream sees it */
-- CP15ISB;
-+ ISB();
- }
- #else
- void invalidate_icache_all(void)
-diff --git a/arch/arm/cpu/armv7/rmobile/Makefile b/arch/arm/cpu/armv7/rmobile/Makefile
-index b8c04c6..0a3623a 100644
---- a/arch/arm/cpu/armv7/rmobile/Makefile
-+++ b/arch/arm/cpu/armv7/rmobile/Makefile
-@@ -46,6 +46,10 @@ COBJS-$(CONFIG_R8A7740) += pfc-r8a7740.o
- COBJS-$(CONFIG_SH73A0) += cpu_info-sh73a0.o
- COBJS-$(CONFIG_SH73A0) += pfc-sh73a0.o
- COBJS_LN-$(CONFIG_TMU_TIMER) += sh_timer.o
-+COBJS-$(CONFIG_SYS_ARCH_TIMER) += arm_arch_timer.o
-+ifeq ($(CONFIG_CMD_SWSUSP),y)
-+COBJS-y += crc32_word4.o
-+endif
-
- COBJS := $(COBJS-y)
- SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-diff --git a/arch/arm/cpu/armv7/rmobile/arm_arch_timer.c b/arch/arm/cpu/armv7/rmobile/arm_arch_timer.c
-new file mode 100644
-index 0000000..a499e71
---- /dev/null
-+++ b/arch/arm/cpu/armv7/rmobile/arm_arch_timer.c
-@@ -0,0 +1,61 @@
-+/*
-+ * Copyright (C) 2014 Cogent Embedded Inc.
-+ *
-+ * Licensed under the GPL-2 or later.
-+ */
-+
-+#include <common.h>
-+#include <asm/io.h>
-+
-+#define MODEMR 0xe6160060
-+#define MD(x) (1 << (x))
-+#define CNTCR 0xe6080000
-+#define CNTFID0 0xe6080020
-+
-+void arm_arch_timer_init(void)
-+{
-+ u32 mode = readl(MODEMR);
-+ u32 freq;
-+
-+ switch (mode & (MD(14) | MD(13))) {
-+ case MD(13):
-+ freq = 20;
-+ break;
-+ case MD(14):
-+ freq = 26;
-+ break;
-+ case MD(13) | MD(14):
-+ freq = 30;
-+ break;
-+ default:
-+ freq = 15;
-+ break;
-+ }
-+
-+ freq *= (1000000 / 2);
-+
-+#ifdef CONFIG_VE_ENABLED
-+ /* CNTVOFF has to be initialized either from non-secure Hypervisor
-+ * mode or secure Monitor mode with SCR.NS==1. If TrustZone is enabled
-+ * then it should be handled by the secure code
-+ */
-+ asm volatile(
-+ " cps 0x16\n"
-+ " mrc p15, 0, r1, c1, c1, 0\n"
-+ " orr r0, r1, #1\n"
-+ " mcr p15, 0, r0, c1, c1, 0\n"
-+ " isb\n"
-+ " mov r0, #0\n"
-+ " mcrr p15, 4, r0, r0, c14\n"
-+ " isb\n"
-+ " mcr p15, 0, r1, c1, c1, 0\n"
-+ " isb\n"
-+ " cps 0x13\n"
-+ : : : "r0", "r1");
-+#endif
-+
-+ /* Start Generic ARM timer */
-+ writel(freq, CNTFID0);
-+ asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
-+ writel(1, CNTCR);
-+}
-diff --git a/arch/arm/cpu/armv7/rmobile/crc32_word4.c b/arch/arm/cpu/armv7/rmobile/crc32_word4.c
-new file mode 100644
-index 0000000..b813899
---- /dev/null
-+++ b/arch/arm/cpu/armv7/rmobile/crc32_word4.c
-@@ -0,0 +1,299 @@
-+/*************************************************************************
-+ * crc32_word4.c: rapid CRC32
-+ * Coptright (C) FUJITSUTEN Limited, 2015 All Rights Reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2
-+ * as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *************************************************************************/
-+#ifdef OWNTEST
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <asm/types.h>
-+typedef unsigned int u_int32_t;
-+#else
-+#include <common.h>
-+#endif
-+
-+#include "crc32_word4.h"
-+
-+#define CRC_INIT_VALUE (-1)
-+#define CRC_FIX(_crc32) (~(_crc32))
-+
-+#define __HWDTPLS_OUT()
-+#define MEASURE(msg)
-+
-+/**** calc_crc32.c *****/
-+
-+/*
-+ * CRC32は、ISO 3309 で規程され
-+ * そのサンプルは
-+ * RFC 2083 :PNG(Poratble Network Graphics
-+ * で公になっています。本プログラムは、RFC2083 で掲示された
-+ * CRC32を独自に最適化したプログラムです。
-+ */
-+const static u_int32_t CRC_Table[256] = {
-+ 0x00000000 , 0x77073096 , 0xee0e612c , 0x990951ba , 0x076dc419 , 0x706af48f , 0xe963a535 , 0x9e6495a3 ,
-+ 0x0edb8832 , 0x79dcb8a4 , 0xe0d5e91e , 0x97d2d988 , 0x09b64c2b , 0x7eb17cbd , 0xe7b82d07 , 0x90bf1d91 ,
-+ 0x1db71064 , 0x6ab020f2 , 0xf3b97148 , 0x84be41de , 0x1adad47d , 0x6ddde4eb , 0xf4d4b551 , 0x83d385c7 ,
-+ 0x136c9856 , 0x646ba8c0 , 0xfd62f97a , 0x8a65c9ec , 0x14015c4f , 0x63066cd9 , 0xfa0f3d63 , 0x8d080df5 ,
-+ 0x3b6e20c8 , 0x4c69105e , 0xd56041e4 , 0xa2677172 , 0x3c03e4d1 , 0x4b04d447 , 0xd20d85fd , 0xa50ab56b ,
-+ 0x35b5a8fa , 0x42b2986c , 0xdbbbc9d6 , 0xacbcf940 , 0x32d86ce3 , 0x45df5c75 , 0xdcd60dcf , 0xabd13d59 ,
-+ 0x26d930ac , 0x51de003a , 0xc8d75180 , 0xbfd06116 , 0x21b4f4b5 , 0x56b3c423 , 0xcfba9599 , 0xb8bda50f ,
-+ 0x2802b89e , 0x5f058808 , 0xc60cd9b2 , 0xb10be924 , 0x2f6f7c87 , 0x58684c11 , 0xc1611dab , 0xb6662d3d ,
-+ 0x76dc4190 , 0x01db7106 , 0x98d220bc , 0xefd5102a , 0x71b18589 , 0x06b6b51f , 0x9fbfe4a5 , 0xe8b8d433 ,
-+ 0x7807c9a2 , 0x0f00f934 , 0x9609a88e , 0xe10e9818 , 0x7f6a0dbb , 0x086d3d2d , 0x91646c97 , 0xe6635c01 ,
-+ 0x6b6b51f4 , 0x1c6c6162 , 0x856530d8 , 0xf262004e , 0x6c0695ed , 0x1b01a57b , 0x8208f4c1 , 0xf50fc457 ,
-+ 0x65b0d9c6 , 0x12b7e950 , 0x8bbeb8ea , 0xfcb9887c , 0x62dd1ddf , 0x15da2d49 , 0x8cd37cf3 , 0xfbd44c65 ,
-+ 0x4db26158 , 0x3ab551ce , 0xa3bc0074 , 0xd4bb30e2 , 0x4adfa541 , 0x3dd895d7 , 0xa4d1c46d , 0xd3d6f4fb ,
-+ 0x4369e96a , 0x346ed9fc , 0xad678846 , 0xda60b8d0 , 0x44042d73 , 0x33031de5 , 0xaa0a4c5f , 0xdd0d7cc9 ,
-+ 0x5005713c , 0x270241aa , 0xbe0b1010 , 0xc90c2086 , 0x5768b525 , 0x206f85b3 , 0xb966d409 , 0xce61e49f ,
-+ 0x5edef90e , 0x29d9c998 , 0xb0d09822 , 0xc7d7a8b4 , 0x59b33d17 , 0x2eb40d81 , 0xb7bd5c3b , 0xc0ba6cad ,
-+ 0xedb88320 , 0x9abfb3b6 , 0x03b6e20c , 0x74b1d29a , 0xead54739 , 0x9dd277af , 0x04db2615 , 0x73dc1683 ,
-+ 0xe3630b12 , 0x94643b84 , 0x0d6d6a3e , 0x7a6a5aa8 , 0xe40ecf0b , 0x9309ff9d , 0x0a00ae27 , 0x7d079eb1 ,
-+ 0xf00f9344 , 0x8708a3d2 , 0x1e01f268 , 0x6906c2fe , 0xf762575d , 0x806567cb , 0x196c3671 , 0x6e6b06e7 ,
-+ 0xfed41b76 , 0x89d32be0 , 0x10da7a5a , 0x67dd4acc , 0xf9b9df6f , 0x8ebeeff9 , 0x17b7be43 , 0x60b08ed5 ,
-+ 0xd6d6a3e8 , 0xa1d1937e , 0x38d8c2c4 , 0x4fdff252 , 0xd1bb67f1 , 0xa6bc5767 , 0x3fb506dd , 0x48b2364b ,
-+ 0xd80d2bda , 0xaf0a1b4c , 0x36034af6 , 0x41047a60 , 0xdf60efc3 , 0xa867df55 , 0x316e8eef , 0x4669be79 ,
-+ 0xcb61b38c , 0xbc66831a , 0x256fd2a0 , 0x5268e236 , 0xcc0c7795 , 0xbb0b4703 , 0x220216b9 , 0x5505262f ,
-+ 0xc5ba3bbe , 0xb2bd0b28 , 0x2bb45a92 , 0x5cb36a04 , 0xc2d7ffa7 , 0xb5d0cf31 , 0x2cd99e8b , 0x5bdeae1d ,
-+ 0x9b64c2b0 , 0xec63f226 , 0x756aa39c , 0x026d930a , 0x9c0906a9 , 0xeb0e363f , 0x72076785 , 0x05005713 ,
-+ 0x95bf4a82 , 0xe2b87a14 , 0x7bb12bae , 0x0cb61b38 , 0x92d28e9b , 0xe5d5be0d , 0x7cdcefb7 , 0x0bdbdf21 ,
-+ 0x86d3d2d4 , 0xf1d4e242 , 0x68ddb3f8 , 0x1fda836e , 0x81be16cd , 0xf6b9265b , 0x6fb077e1 , 0x18b74777 ,
-+ 0x88085ae6 , 0xff0f6a70 , 0x66063bca , 0x11010b5c , 0x8f659eff , 0xf862ae69 , 0x616bffd3 , 0x166ccf45 ,
-+ 0xa00ae278 , 0xd70dd2ee , 0x4e048354 , 0x3903b3c2 , 0xa7672661 , 0xd06016f7 , 0x4969474d , 0x3e6e77db ,
-+ 0xaed16a4a , 0xd9d65adc , 0x40df0b66 , 0x37d83bf0 , 0xa9bcae53 , 0xdebb9ec5 , 0x47b2cf7f , 0x30b5ffe9 ,
-+ 0xbdbdf21c , 0xcabac28a , 0x53b39330 , 0x24b4a3a6 , 0xbad03605 , 0xcdd70693 , 0x54de5729 , 0x23d967bf ,
-+ 0xb3667a2e , 0xc4614ab8 , 0x5d681b02 , 0x2a6f2b94 , 0xb40bbe37 , 0xc30c8ea1 , 0x5a05df1b , 0x2d02ef8d ,
-+};
-+
-+/***
-+ * CRC Table creater.
-+ *
-+void make_crc_table(void) {
-+ u_int32_t c;
-+ u_int32_t n, k;
-+ for (n = 0; n < 256; n++)
-+ {
-+ c = (u_int32_t) n;
-+ for (k = 0; k < 8; k++)
-+ {
-+ if (c & 1)
-+ c = 0xedb88320L ^ (c >> 1);
-+ else
-+ c = c >> 1;
-+ }
-+ CRC_Table[n] = c;
-+ }
-+}
-+***/
-+#define NEXT_PTR (4)
-+
-+static __inline__
-+u_int32_t _update_crc(u_int32_t crc, unsigned char *buf, size_t len)
-+{
-+ u_int32_t c = crc;
-+ size_t n;
-+ for (n = 0; n < len; n++)
-+ c = CRC_Table[(c ^ buf[n]) & 0xff] ^ (c >> 8);
-+ return c;
-+}
-+/*********************************************************************
-+ * update_crc4x4()()
-+ * calc_crc32() をベースに、4 ワード毎に個別に CRC32 を計算する方法
-+ *
-+ * +0 +1 +2 +3
-+ * +0x00 AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-+ * +0x04 EEEEEEEE FFFFFFFF 00000000 11111111
-+ * : : : :
-+ * CRC32 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
-+ *
-+ *********************************************************************/
-+
-+static __inline__
-+void update_crc4x4(u_int32_t crc[4], unsigned char *buf)
-+{
-+ u_int32_t c1, c2, c3, c4;
-+ u_int32_t *p = (void *)buf;
-+
-+ c1 = crc[0] ^ p[0];
-+ c2 = crc[1] ^ p[1];
-+ c3 = crc[2] ^ p[2];
-+ c4 = crc[3] ^ p[3];
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ crc[0] = c1;
-+ crc[1] = c2;
-+ crc[2] = c3;
-+ crc[3] = c4;
-+}
-+
-+
-+void calc_crc32x4(unsigned char *buf, size_t len, CRC32_WORD4_t *result)
-+{
-+ unsigned int crc_tmp[4] = {CRC_INIT_VALUE, CRC_INIT_VALUE, CRC_INIT_VALUE, CRC_INIT_VALUE};
-+ u_int32_t i;
-+ int res;
-+ u_int32_t n4;
-+ int xlen = len;
-+#ifdef HWDPLS_ENABLE
-+ unsigned long plstout = 60;
-+ unsigned long plsstart = 0;
-+ if ((unsigned long)CONFIG_SYS_HZ > 100000)
-+ plstout *= (unsigned long)CONFIG_SYS_HZ / 1000;
-+ else
-+ plstout = DIV_ROUND_UP(plstout * (unsigned long)CONFIG_SYS_HZ, 1000);
-+#endif
-+
-+ /**
-+ * 4バイト境界に合わない開始アドレスの場合
-+ * 境界までのCRCを crc_tmp[0] に求める。
-+ */
-+ if ((unsigned long)buf & 3) {
-+ crc_tmp[0] = _update_crc(crc_tmp[0], buf, (unsigned long)buf & 3);
-+ buf = (unsigned char *)((unsigned long)buf & ~3);
-+ xlen -= (unsigned long)buf & 3;
-+ }
-+
-+ n4 = xlen/(NEXT_PTR*4);
-+ /**
-+ * 4バイト境界に合わない開始アドレスの場合
-+ * 境界までのCRCを crc_tmp[0] に求める。
-+ */
-+#ifdef HWDPLS_ENABLE
-+ reset_timer();
-+ plsstart = get_timer(0);
-+#endif
-+ for (i = 0; i < n4 ; i++) {
-+ update_crc4x4(crc_tmp, buf);
-+ buf += NEXT_PTR * 4;
-+#ifdef HWDPLS_ENABLE
-+ /**
-+ * WDを考慮
-+ */
-+ if (__builtin_expect((int)((i & 0x1f) == 0), 0)) {
-+ if ((get_timer(plsstart)) > plstout) {
-+ __HWDTPLS_OUT();
-+ MEASURE("crc plsout")
-+ plsstart += plstout;
-+ }
-+ }
-+#endif /*HWPLS_ENABLE*/
-+ }
-+
-+ res = xlen % (NEXT_PTR * 4);
-+ if (res > 0)
-+ crc_tmp[3] = _update_crc(crc_tmp[3], buf, res);
-+
-+ result->crc_w[0] = CRC_FIX(crc_tmp[0]);
-+ result->crc_w[1] = CRC_FIX(crc_tmp[1]);
-+ result->crc_w[2] = CRC_FIX(crc_tmp[2]);
-+ result->crc_w[3] = CRC_FIX(crc_tmp[3]);
-+
-+ MEASURE("calc_crc32x4 finish")
-+}
-+
-+#if defined(OWNTEST)
-+#define BUFSIZE (2 * 1024 * 1024)
-+#include <sys/time.h>
-+#include <malloc.h>
-+
-+int main()
-+{
-+ unsigned char *buf, *buf2;
-+ struct timeval start, end;
-+ unsigned long long diff;
-+ int i;
-+
-+ CRC32_WORD4_t result = { .crc_w = {0, 0, 0, 0 } };
-+ CRC32_WORD4_t result2 = { .crc_w = {0, 0, 0, 0 } };
-+
-+ buf = malloc(BUFSIZE);
-+ if (!buf) {
-+ perror("malloc");
-+ return 1;
-+ }
-+ printf("Generate %dMB random data..\n", BUFSIZE / 1024 / 1024);
-+ srand(0);
-+ for (i = 0; i < BUFSIZE / 4; i++)
-+ ((int *)buf)[i] = rand();
-+
-+ /* Memory dup */
-+ buf2 = memalign(NEXT_PTR, BUFSIZE);
-+ if (!buf2) {
-+ perror("malloc");
-+ return 1;
-+ }
-+ memcpy(buf2, buf, BUFSIZE);
-+
-+
-+ gettimeofday(&start, NULL);
-+ calc_crc32x4(buf, BUFSIZE, &result);
-+ gettimeofday(&end, NULL);
-+
-+ diff = (end.tv_sec - start.tv_sec) * 1000000;
-+ diff += end.tv_usec - start.tv_usec;
-+
-+ printf("time=%lluus\n", diff);
-+ printf(" result.word[0] = %x\n", result.crc_w[0]);
-+ printf(" result.word[1] = %x\n", result.crc_w[1]);
-+ printf(" result.word[2] = %x\n", result.crc_w[2]);
-+ printf(" result.word[3] = %x\n", result.crc_w[3]);
-+
-+ /* Broken test */
-+#if 0 /* Destory test */
-+ buf[rand() % BUFSIZE] ^= 1 << (rand()%7);
-+#endif
-+ for (i = 0; i < BUFSIZE ; i++) {
-+ if (buf[i] != buf2[i])
-+ printf("buf[%d] %02x : %02x\n", i, buf[i], buf2[i]);
-+ }
-+
-+ gettimeofday(&start, NULL);
-+ calc_crc32x4(buf, BUFSIZE, &result2);
-+ gettimeofday(&end, NULL);
-+
-+ diff = (end.tv_sec - start.tv_sec) * 1000000;
-+ diff += end.tv_usec - start.tv_usec;
-+
-+ printf("time=%lluus\n", diff);
-+ printf(" result.word[0] = %x:%s\n", result2.crc_w[0] ,
-+ result.crc_w[0] == result2.crc_w[0] ? "OK" : "NG");
-+ printf(" result.word[1] = %x:%s\n", result2.crc_w[1] ,
-+ result.crc_w[1] == result2.crc_w[1] ? "OK" : "NG");
-+ printf(" result.word[2] = %x:%s\n", result2.crc_w[2] ,
-+ result.crc_w[2] == result2.crc_w[2] ? "OK" : "NG");
-+ printf(" result.word[3] = %x:%s\n", result2.crc_w[3] ,
-+ result.crc_w[3] == result2.crc_w[3] ? "OK" : "NG");
-+ return 0;
-+}
-+#endif /* TEST */
-diff --git a/arch/arm/cpu/armv7/rmobile/crc32_word4.h b/arch/arm/cpu/armv7/rmobile/crc32_word4.h
-new file mode 100644
-index 0000000..2b64218
---- /dev/null
-+++ b/arch/arm/cpu/armv7/rmobile/crc32_word4.h
-@@ -0,0 +1,23 @@
-+/*************************************************************************
-+ * Coptright (C) FUJITSUTEN Limited, 2012 All Rights Reserved.
-+ *
-+ *************************************************************************/
-+#ifndef __CRC32_WORD4_H__
-+#define __CRC32_WORD4_H__
-+
-+typedef struct {
-+ unsigned int crc_w[4];
-+} CRC32_WORD4_t;
-+
-+void calc_crc32x4(unsigned char *buf, size_t len, CRC32_WORD4_t *result);
-+
-+typedef struct {
-+ unsigned int size;
-+ CRC32_WORD4_t chksum;
-+ unsigned int dummy[3];
-+} CRC32_WORD4_TICKET_t;
-+
-+#define IS_CRC_WORD4_OK(_res1, _res2) (!memcmp((_res1), (_res2), sizeof(CRC32_WORD4_t)))
-+#define IS_CRC_WORD4_ZERO(_w4) (((_w4)->crc_w[0] == 0) && ((_w4)->crc_w[1] == 0) && ((_w4)->crc_w[2] == 0) && ((_w4)->crc_w[3] == 0))
-+#define IS_CRC_WORD4_ALL_F(_w4) (((_w4)->crc_w[0] == 0xffffffff) && ((_w4)->crc_w[1] == 0xffffffff) && ((_w4)->crc_w[2] == 0xffffffff) && ((_w4)->crc_w[3] == 0xffffffff))
-+#endif
-diff --git a/arch/arm/cpu/armv7/rmobile/sh_timer.c b/arch/arm/cpu/armv7/rmobile/sh_timer.c
-new file mode 100644
-index 0000000..1c64950
---- /dev/null
-+++ b/arch/arm/cpu/armv7/rmobile/sh_timer.c
-@@ -0,0 +1,209 @@
-+/*
-+ * Copyright (C) 2013-2014 Renesas Electronics Corporation
-+ *
-+ * (C) Copyright 2009
-+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
-+ *
-+ * (C) Copyright 2007-2012
-+ * Nobobuhiro Iwamatsu <iwamatsu@nigauri.org>
-+ *
-+ * (C) Copyright 2003
-+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-+ *
-+ * See file CREDITS for list of people who contributed to this
-+ * project.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License as
-+ * published by the Free Software Foundation; either version 2 of
-+ * the License, or (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-+ * MA 02111-1307 USA
-+ */
-+
-+#include <common.h>
-+#include <div64.h>
-+#include <asm/processor.h>
-+#include <asm/io.h>
-+#include <sh_tmu.h>
-+
-+#if defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
-+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
-+
-+DECLARE_GLOBAL_DATA_PTR;
-+
-+#endif
-+
-+static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
-+
-+static u16 bit;
-+static unsigned long last_tcnt;
-+static unsigned long long overflow_ticks;
-+
-+#if defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
-+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
-+
-+unsigned long get_tbclk(void)
-+{
-+ if (gd->flags & GD_FLG_RELOC)
-+ return get_tmu0_clk_rate() >> ((bit + 1) * 2);
-+ else {
-+ u16 bit;
-+
-+ bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
-+ return get_tmu0_clk_rate() >> ((bit + 1) * 2);
-+ }
-+}
-+
-+#else
-+
-+unsigned long get_tbclk(void)
-+{
-+ return get_tmu0_clk_rate() >> ((bit + 1) * 2);
-+}
-+
-+#endif
-+
-+static inline unsigned long long tick_to_time(unsigned long long tick)
-+{
-+ tick *= CONFIG_SYS_HZ;
-+ do_div(tick, get_tbclk());
-+
-+ return tick;
-+}
-+
-+static inline unsigned long long usec_to_tick(unsigned long long usec)
-+{
-+ usec *= get_tbclk();
-+ do_div(usec, 1000000);
-+
-+ return usec;
-+}
-+
-+static void tmu_timer_start(unsigned int timer)
-+{
-+ if (timer > 2)
-+ return;
-+ writeb(readb(&tmu->tstr) | (1 << timer), &tmu->tstr);
-+}
-+
-+static void tmu_timer_stop(unsigned int timer)
-+{
-+ if (timer > 2)
-+ return;
-+ writeb(readb(&tmu->tstr) & ~(1 << timer), &tmu->tstr);
-+}
-+
-+#if defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
-+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
-+
-+int sh_timer_init(void)
-+{
-+ bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
-+ writew((readw(&tmu->tcr0) & ~0x7) | bit, &tmu->tcr0);
-+
-+ tmu_timer_stop(0);
-+ tmu_timer_start(0);
-+
-+ last_tcnt = 0;
-+ overflow_ticks = 0;
-+
-+ return 0;
-+}
-+
-+int timer_init(void)
-+{
-+ tmu_timer_stop(0);
-+ tmu_timer_start(0);
-+
-+ return 0;
-+}
-+
-+#else
-+
-+int timer_init(void)
-+{
-+ bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
-+ writew((readw(&tmu->tcr0) & ~0x7) | bit, &tmu->tcr0);
-+
-+ tmu_timer_stop(0);
-+ tmu_timer_start(0);
-+
-+ last_tcnt = 0;
-+ overflow_ticks = 0;
-+
-+ return 0;
-+}
-+
-+#endif
-+
-+#if defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) || \
-+ defined(CONFIG_R8A7793) || defined(CONFIG_R8A7794)
-+
-+unsigned long long get_ticks(void)
-+{
-+ unsigned long tcnt = 0 - readl(&tmu->tcnt0);
-+
-+ if (gd->flags & GD_FLG_RELOC) {
-+ if (last_tcnt > tcnt) /* overflow */
-+ overflow_ticks++;
-+ last_tcnt = tcnt;
-+
-+ return (overflow_ticks << 32) | tcnt;
-+ }
-+ else
-+ return tcnt;
-+}
-+
-+#else
-+
-+unsigned long long get_ticks(void)
-+{
-+ unsigned long tcnt = 0 - readl(&tmu->tcnt0);
-+
-+ if (last_tcnt > tcnt) /* overflow */
-+ overflow_ticks++;
-+ last_tcnt = tcnt;
-+
-+ return (overflow_ticks << 32) | tcnt;
-+}
-+
-+#endif
-+
-+void __udelay(unsigned long usec)
-+{
-+ unsigned long long tmp;
-+ ulong tmo;
-+
-+ tmo = usec_to_tick(usec);
-+ tmp = get_ticks() + tmo; /* get current timestamp */
-+
-+ while (get_ticks() < tmp) /* loop till event */
-+ /*NOP*/;
-+}
-+
-+unsigned long get_timer(unsigned long base)
-+{
-+ /* return msec */
-+ return tick_to_time(get_ticks()) - base;
-+}
-+
-+void set_timer(unsigned long t)
-+{
-+ writel((0 - t), &tmu->tcnt0);
-+}
-+
-+void reset_timer(void)
-+{
-+ tmu_timer_stop(0);
-+ set_timer(0);
-+ tmu_timer_start(0);
-+}
-diff --git a/arch/arm/include/asm/arch-rmobile/rmobile.h b/arch/arm/include/asm/arch-rmobile/rmobile.h
-index 33a302e..12276e0 100644
---- a/arch/arm/include/asm/arch-rmobile/rmobile.h
-+++ b/arch/arm/include/asm/arch-rmobile/rmobile.h
-@@ -26,6 +26,8 @@ u32 rmobile_get_cpu_type(void);
- u32 rmobile_get_cpu_rev_integer(void);
- u32 rmobile_get_cpu_rev_fraction(void);
-
-+void arm_arch_timer_init(void);
-+
- #endif /* __ASSEMBLY__ */
-
- #endif /* __KERNEL__ */
-diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
-index ad9a875..aad5bf7 100644
---- a/arch/arm/include/asm/armv7.h
-+++ b/arch/arm/include/asm/armv7.h
-@@ -62,9 +62,19 @@
- * However, we use the CP15 based instructtions because we use
- * -march=armv5 in U-Boot
- */
--#define CP15ISB asm volatile ("mcr p15, 0, %0, c7, c5, 4" : : "r" (0))
--#define CP15DSB asm volatile ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0))
--#define CP15DMB asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0))
-+#define CP15ISB() asm volatile ("mcr p15, 0, %0, c7, c5, 4" : : "r" (0))
-+#define CP15DSB() asm volatile ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0))
-+#define CP15DMB() asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0))
-+
-+#ifdef __ARM_ARCH_7A__
-+#define ISB() asm volatile ("isb" : : : "memory")
-+#define DSB() asm volatile ("dsb" : : : "memory")
-+#define DMB() asm volatile ("dmb" : : : "memory")
-+#else
-+#define ISB() CP15ISB
-+#define DSB() CP15DSB
-+#define DMB() CP15DMB
-+#endif
-
- void v7_outer_cache_enable(void);
- void v7_outer_cache_disable(void);
-diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
-index cd0de6b..3906646 100644
---- a/arch/arm/include/asm/system.h
-+++ b/arch/arm/include/asm/system.h
-@@ -45,6 +45,12 @@
- #define CR_AFE (1 << 29) /* Access flag enable */
- #define CR_TE (1 << 30) /* Thumb exception enable */
-
-+#if defined(CONFIG_ARMV7_LPAE) && !defined(PGTABLE_SIZE)
-+#define PGTABLE_SIZE (4096 * 5)
-+#elif !defined(PGTABLE_SIZE)
-+#define PGTABLE_SIZE (4096 * 4)
-+#endif
-+
- /*
- * This is used to ensure the compiler did actually allocate the register we
- * asked it for some inline assembly sequences. Apparently we can't trust
-@@ -61,17 +67,50 @@
-
- #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
-
-+static inline unsigned long get_cpsr(void)
-+{
-+ unsigned long cpsr;
-+
-+ asm volatile("mrs %0, cpsr" : "=r"(cpsr): );
-+ return cpsr;
-+}
-+
-+static inline int is_hyp(void)
-+{
-+#ifdef CONFIG_ARMV7_LPAE
-+ /* HYP mode requires LPAE ... */
-+ return ((get_cpsr() & 0x1f) == 0x1a);
-+#else
-+ /* ... so without LPAE support we can optimize all hyp code away */
-+ return 0;
-+#endif
-+}
-+
- static inline unsigned int get_cr(void)
- {
- unsigned int val;
-- asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
-+
-+ if (is_hyp())
-+ asm volatile("mrc p15, 4, %0, c1, c0, 0 @ get CR" : "=r" (val)
-+ :
-+ : "cc");
-+ else
-+ asm volatile("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val)
-+ :
-+ : "cc");
- return val;
- }
-
- static inline void set_cr(unsigned int val)
- {
-- asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
-- : : "r" (val) : "cc");
-+ if (is_hyp())
-+ asm volatile("mcr p15, 4, %0, c1, c0, 0 @ set CR" :
-+ : "r" (val)
-+ : "cc");
-+ else
-+ asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR" :
-+ : "r" (val)
-+ : "cc");
- isb();
- }
-
-@@ -105,19 +144,108 @@ static inline void set_actlr(unsigned int val)
- isb();
- }
-
-+#ifdef CONFIG_ARMV7_LPAE
-+/* Long-Descriptor Translation Table Level 1/2 Bits */
-+#define TTB_SECT_XN_MASK (1ULL << 54)
-+#define TTB_SECT_NG_MASK (1 << 11)
-+#define TTB_SECT_AF (1 << 10)
-+#define TTB_SECT_SH_MASK (3 << 8)
-+#define TTB_SECT_NS_MASK (1 << 5)
-+#define TTB_SECT_AP (1 << 6)
-+/* Note: TTB AP bits are set elsewhere */
-+#define TTB_SECT_MAIR(x) ((x & 0x7) << 2) /* Index into MAIR */
-+#define TTB_SECT (1 << 0)
-+#define TTB_PAGETABLE (3 << 0)
-+
-+/* TTBCR flags */
-+#define TTBCR_EAE (1 << 31)
-+#define TTBCR_T0SZ(x) ((x) << 0)
-+#define TTBCR_T1SZ(x) ((x) << 16)
-+#define TTBCR_USING_TTBR0 (TTBCR_T0SZ(0) | TTBCR_T1SZ(0))
-+#define TTBCR_IRGN0_NC (0 << 8)
-+#define TTBCR_IRGN0_WBWA (1 << 8)
-+#define TTBCR_IRGN0_WT (2 << 8)
-+#define TTBCR_IRGN0_WBNWA (3 << 8)
-+#define TTBCR_IRGN0_MASK (3 << 8)
-+#define TTBCR_ORGN0_NC (0 << 10)
-+#define TTBCR_ORGN0_WBWA (1 << 10)
-+#define TTBCR_ORGN0_WT (2 << 10)
-+#define TTBCR_ORGN0_WBNWA (3 << 10)
-+#define TTBCR_ORGN0_MASK (3 << 10)
-+#define TTBCR_SHARED_NON (0 << 12)
-+#define TTBCR_SHARED_OUTER (2 << 12)
-+#define TTBCR_SHARED_INNER (3 << 12)
-+#define TTBCR_EPD0 (0 << 7)
-+
-+/*
-+ * Memory types
-+ */
-+#define MEMORY_ATTRIBUTES ((0x00 << (0 * 8)) | (0x88 << (1 * 8)) | \
-+ (0xcc << (2 * 8)) | (0xff << (3 * 8)))
-+
-+/* options available for data cache on each page */
-+enum dcache_option {
-+ DCACHE_OFF = TTB_SECT | TTB_SECT_MAIR(0),
-+ DCACHE_WRITETHROUGH = TTB_SECT | TTB_SECT_MAIR(1),
-+ DCACHE_WRITEBACK = TTB_SECT | TTB_SECT_MAIR(2),
-+ DCACHE_WRITEALLOC = TTB_SECT | TTB_SECT_MAIR(3),
-+};
-+#elif defined(CONFIG_ARMV7)
-+/* Short-Descriptor Translation Table Level 1 Bits */
-+#define TTB_SECT_NS_MASK (1 << 19)
-+#define TTB_SECT_NG_MASK (1 << 17)
-+#define TTB_SECT_S_MASK (1 << 16)
-+/* Note: TTB AP bits are set elsewhere */
-+#define TTB_SECT_AP (3 << 10)
-+#define TTB_SECT_TEX(x) ((x & 0x7) << 12)
-+#define TTB_SECT_DOMAIN(x) ((x & 0xf) << 5)
-+#define TTB_SECT_XN_MASK (1 << 4)
-+#define TTB_SECT_C_MASK (1 << 3)
-+#define TTB_SECT_B_MASK (1 << 2)
-+#define TTB_SECT (2 << 0)
-+
-+/* options available for data cache on each page */
-+enum dcache_option {
-+ DCACHE_OFF = TTB_SECT_DOMAIN(0) | TTB_SECT_XN_MASK | TTB_SECT,
-+ DCACHE_WRITETHROUGH = DCACHE_OFF | TTB_SECT_C_MASK,
-+ DCACHE_WRITEBACK = DCACHE_WRITETHROUGH | TTB_SECT_B_MASK,
-+ DCACHE_WRITEALLOC = DCACHE_WRITEBACK | TTB_SECT_TEX(1),
-+};
-+#else
-+#define TTB_SECT_AP (3 << 10)
- /* options available for data cache on each page */
- enum dcache_option {
- DCACHE_OFF = 0x12,
- DCACHE_WRITETHROUGH = 0x1a,
- DCACHE_WRITEBACK = 0x1e,
-+ DCACHE_WRITEALLOC = 0x16,
- };
-+#endif
-
- /* Size of an MMU section */
- enum {
-- MMU_SECTION_SHIFT = 20,
-+#ifdef CONFIG_ARMV7_LPAE
-+ MMU_SECTION_SHIFT = 21, /* 2MB */
-+#else
-+ MMU_SECTION_SHIFT = 20, /* 1MB */
-+#endif
- MMU_SECTION_SIZE = 1 << MMU_SECTION_SHIFT,
- };
-
-+#ifdef CONFIG_ARMV7
-+/* TTBR0 bits */
-+#define TTBR0_BASE_ADDR_MASK 0xFFFFC000
-+#define TTBR0_RGN_NC (0 << 3)
-+#define TTBR0_RGN_WBWA (1 << 3)
-+#define TTBR0_RGN_WT (2 << 3)
-+#define TTBR0_RGN_WB (3 << 3)
-+/* TTBR0[6] is IRGN[0] and TTBR[0] is IRGN[1] */
-+#define TTBR0_IRGN_NC (0 << 0 | 0 << 6)
-+#define TTBR0_IRGN_WBWA (0 << 0 | 1 << 6)
-+#define TTBR0_IRGN_WT (1 << 0 | 0 << 6)
-+#define TTBR0_IRGN_WB (1 << 0 | 1 << 6)
-+#endif
-+
- /**
- * Change the cache settings for a region.
- *
-diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
-index 57111af..d8634be 100644
---- a/arch/arm/lib/Makefile
-+++ b/arch/arm/lib/Makefile
-@@ -54,6 +54,8 @@ COBJS-y += reset.o
- COBJS-y += cache.o
- COBJS-y += cache-cp15.o
-
-+COBJS-y += call_with_stack.o
-+
- SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
- $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
- OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
-diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
-index 9f861cc..3c2bf55 100644
---- a/arch/arm/lib/board.c
-+++ b/arch/arm/lib/board.c
-@@ -355,7 +355,7 @@ void board_init_f(ulong bootflag)
-
- #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
- /* reserve TLB table */
-- gd->tlb_size = 4096 * 4;
-+ gd->tlb_size = PGTABLE_SIZE;
- addr -= gd->tlb_size;
-
- /* round down to next 64 kB limit */
-diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
-index 75cf7b1..aefa2ae 100644
---- a/arch/arm/lib/cache-cp15.c
-+++ b/arch/arm/lib/cache-cp15.c
-@@ -44,13 +44,50 @@ static void cp_delay (void)
- asm volatile("" : : : "memory");
- }
-
-+#ifdef CONFIG_ARMV7_LPAE
-+struct special_addr {
-+ u32 page;
-+ u32 size;
-+ u64 addr;
-+};
-+
-+/* This hack is for 2GB board with second GB attached
-+ * to LPAE-only address at 0x200000000ULL */
-+#define SDRAM2_ADDR 0x200000000ULL
-+#define SDRAM2_SIZE 0x40000000 /* 1G */
-+static struct special_addr offsets[] = {
-+ { 0x80000000 >> MMU_SECTION_SHIFT, SDRAM2_SIZE >> MMU_SECTION_SHIFT, SDRAM2_ADDR, },
-+};
-+#endif
-+
- void set_section_dcache(int section, enum dcache_option option)
- {
-+#ifdef CONFIG_ARMV7_LPAE
-+ int i;
-+ u64 *page_table = (u64 *)gd->tlb_addr;
-+ /* Need to set the access flag to not fault */
-+ u64 value = TTB_SECT_AP | TTB_SECT_AF;
-+#else
- u32 *page_table = (u32 *)gd->tlb_addr;
-- u32 value;
-+ u32 value = TTB_SECT_AP;
-+#endif
-+
-+ /* Add the page offset */
-+#ifdef CONFIG_ARMV7_LPAE
-+ for (i = 0; i < ARRAY_SIZE(offsets); i++)
-+ if (section >= offsets[i].page &&
-+ section < offsets[i].page + offsets[i].size)
-+ value |= offsets[i].addr + ((section - offsets[i].page) << MMU_SECTION_SHIFT);
-+ else
-+ value |= ((u32)section << MMU_SECTION_SHIFT);
-+#else
-+ value |= ((u32)section << MMU_SECTION_SHIFT);
-+#endif
-
-- value = (section << MMU_SECTION_SHIFT) | (3 << 10);
-+ /* Add caching bits */
- value |= option;
-+
-+ /* Set PTE */
- page_table[section] = value;
- }
-
-@@ -66,11 +103,11 @@ void mmu_set_region_dcache_behaviour(u32 start, int size,
- enum dcache_option option)
- {
- u32 *page_table = (u32 *)gd->tlb_addr;
-- u32 upto, end;
-+ unsigned long upto, end;
-
- end = ALIGN(start + size, MMU_SECTION_SIZE) >> MMU_SECTION_SHIFT;
- start = start >> MMU_SECTION_SHIFT;
-- debug("%s: start=%x, size=%x, option=%d\n", __func__, start, size,
-+ debug("%s: start=%pa, size=%zu, option=%d\n", __func__, &start, size,
- option);
- for (upto = start; upto < end; upto++)
- set_section_dcache(upto, option);
-@@ -83,11 +120,14 @@ static inline void dram_bank_mmu_setup(int bank)
- int i;
-
- debug("%s: bank: %d\n", __func__, bank);
-- for (i = bd->bi_dram[bank].start >> 20;
-- i < (bd->bi_dram[bank].start + bd->bi_dram[bank].size) >> 20;
-+ for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT;
-+ i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) +
-+ (bd->bi_dram[bank].size >> MMU_SECTION_SHIFT);
- i++) {
- #if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
- set_section_dcache(i, DCACHE_WRITETHROUGH);
-+#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
-+ set_section_dcache(i, DCACHE_WRITEALLOC);
- #else
- set_section_dcache(i, DCACHE_WRITEBACK);
- #endif
-@@ -102,19 +142,88 @@ static inline void mmu_setup(void)
-
- arm_init_before_mmu();
- /* Set up an identity-mapping for all 4GB, rw for everyone */
-- for (i = 0; i < 4096; i++)
-+ for (i = 0; i < ((4096ULL * 1024 * 1024) >> MMU_SECTION_SHIFT); i++)
- set_section_dcache(i, DCACHE_OFF);
-
- for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
- dram_bank_mmu_setup(i);
- }
-+ /* Enabling d-cache for remapped region of memory
-+ *
-+ */
-+ for (i = (0x80000000 >> MMU_SECTION_SHIFT);
-+ i < 0xc0000000 >> MMU_SECTION_SHIFT; i++)
-+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-+ set_section_dcache(i, DCACHE_WRITETHROUGH);
-+#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
-+ set_section_dcache(i, DCACHE_WRITEALLOC);
-+#else
-+ set_section_dcache(i, DCACHE_WRITEBACK);
-+#endif
-+
-+#ifdef CONFIG_ARMV7_LPAE
-+ /* Set up 4 PTE entries pointing to our 4 1GB page tables */
-+ for (i = 0; i < 4; i++) {
-+ u64 *page_table = (u64 *)(gd->tlb_addr + (4096 * 4));
-+ u64 tpt = gd->tlb_addr + (4096 * i);
-+ page_table[i] = tpt | TTB_PAGETABLE;
-+ }
-
-+ reg = TTBCR_EAE;
-+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-+ reg |= TTBCR_ORGN0_WT | TTBCR_IRGN0_WT;
-+#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
-+ reg |= TTBCR_ORGN0_WBWA | TTBCR_IRGN0_WBWA;
-+#else
-+ reg |= TTBCR_ORGN0_WBNWA | TTBCR_IRGN0_WBNWA;
-+#endif
-+
-+ if (is_hyp()) {
-+ /* Set HCTR to enable LPAE */
-+ asm volatile("mcr p15, 4, %0, c2, c0, 2"
-+ : : "r" (reg) : "memory");
-+ /* Set HTTBR0 */
-+ asm volatile("mcrr p15, 4, %0, %1, c2"
-+ :
-+ : "r"(gd->tlb_addr + (4096 * 4)), "r"(0)
-+ : "memory");
-+ /* Set HMAIR */
-+ asm volatile("mcr p15, 4, %0, c10, c2, 0"
-+ : : "r" (MEMORY_ATTRIBUTES) : "memory");
-+ } else {
-+ /* Set TTBCR to enable LPAE */
-+ asm volatile("mcr p15, 0, %0, c2, c0, 2"
-+ : : "r" (reg) : "memory");
-+ /* Set 64-bit TTBR0 */
-+ asm volatile("mcrr p15, 0, %0, %1, c2"
-+ :
-+ : "r"(gd->tlb_addr + (4096 * 4)), "r"(0)
-+ : "memory");
-+ /* Set MAIR */
-+ asm volatile("mcr p15, 0, %0, c10, c2, 0"
-+ : : "r" (MEMORY_ATTRIBUTES) : "memory");
-+ }
-+#elif defined(CONFIG_ARMV7)
-+ /* Set TTBR0 */
-+ reg = gd->tlb_addr & TTBR0_BASE_ADDR_MASK;
-+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
-+ reg |= TTBR0_RGN_WT | TTBR0_IRGN_WT;
-+#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
-+ reg |= TTBR0_RGN_WBWA | TTBR0_IRGN_WBWA;
-+#else
-+ reg |= TTBR0_RGN_WB | TTBR0_IRGN_WB;
-+#endif
-+ asm volatile("mcr p15, 0, %0, c2, c0, 0"
-+ : : "r" (reg) : "memory");
-+#else
- /* Copy the page table address to cp15 */
- asm volatile("mcr p15, 0, %0, c2, c0, 0"
- : : "r" (gd->tlb_addr) : "memory");
-+#endif
- /* Set the access control to all-supervisor */
- asm volatile("mcr p15, 0, %0, c3, c0, 0"
- : : "r" (~0));
-+
- /* and enable the mmu */
- reg = get_cr(); /* get control reg. */
- cp_delay();
-diff --git a/arch/arm/lib/call_with_stack.S b/arch/arm/lib/call_with_stack.S
-new file mode 100644
-index 0000000..651d869
---- /dev/null
-+++ b/arch/arm/lib/call_with_stack.S
-@@ -0,0 +1,20 @@
-+.globl call_with_stack
-+.syntax unified /* use unified assembler syntax */
-+#ifdef __thumb__
-+.thumb /* assemble in Thumb-2 (.thumb" can also be used) */
-+#endif
-+call_with_stack:
-+ str sp, [r2, #-4]!
-+ str lr, [r2, #-4]!
-+
-+ mov sp, r2
-+ mov r2, r0
-+ mov r0, r1
-+
-+ adr lr, 1f
-+ mov pc, r2
-+
-+1: ldr lr, [sp]
-+ ldr sp, [sp, #4]
-+ mov pc, lr
-+
-diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
-index 71836e2..6c4fd1a 100644
---- a/board/renesas/porter/porter.c
-+++ b/board/renesas/porter/porter.c
-@@ -42,6 +42,10 @@ void s_init(void)
- struct r8a7791_swdt *swdt = (struct r8a7791_swdt *)SWDT_BASE;
- u32 val;
-
-+#ifdef CONFIG_SYS_ARCH_TIMER
-+ arm_arch_timer_init();
-+#endif
-+
- /* Watchdog init */
- writel(0xA5A5A500, &rwdt->rwtcsra);
- writel(0xA5A5A500, &swdt->swtcsra);
-@@ -71,10 +75,12 @@ int board_early_init_f(void)
- {
- u32 val;
-
-+#ifdef CONFIG_TMU_TIMER
- /* TMU0 */
- val = readl(MSTPSR1);
- val &= ~TMU0_MSTP125;
- writel(val, SMSTPCR1);
-+#endif
-
- val = readl(MSTPSR7);
- val &= ~SCIF0_MSTP721;
-@@ -114,7 +120,9 @@ int board_init(void)
- /* Init PFC controller */
- r8a7791_pinmux_init();
-
-+#ifdef CONFIG_TMU_TIMER
- sh_timer_init();
-+#endif
-
- /* ETHER Enable */
- gpio_request(GPIO_FN_ETH_CRS_DV, NULL);
-@@ -288,10 +296,12 @@ void arch_preboot_os()
- u32 val;
- int i;
-
-+#ifdef CONFIG_TMU_TIMER
- /* stop TMU0 */
- val = readb(TMU_BASE + TSTR0);
- val &= ~TSTR0_STR0;
- writeb(val, TMU_BASE + TSTR0);
-+#endif
-
- /* stop all module clock*/
- for (i = MSTP00; i < MSTP_NR; i++) {
-diff --git a/include/configs/porter.h b/include/configs/porter.h
-index 7ab0643..5567c7c 100644
---- a/include/configs/porter.h
-+++ b/include/configs/porter.h
-@@ -53,6 +53,9 @@
- #define CONFIG_CMD_EXT4_WRITE
- #define CONFIG_CMD_SF
- #define CONFIG_CMD_SPI
-+#define CONFIG_CMD_SWSUSP
-+#define CONFIG_CMD_SWSUSPMEM
-+#define CONFIG_LZO
-
- #define CONFIG_CMDLINE_TAG
- #define CONFIG_SETUP_MEMORY_TAGS
-@@ -75,7 +78,6 @@
- #define CONFIG_BOARD_EARLY_INIT_F
- #define CONFIG_USE_ARCH_MEMSET
- #define CONFIG_USE_ARCH_MEMCPY
--#define CONFIG_TMU_TIMER
-
- /* STACK */
- #if defined(CONFIG_EXTRAM_BOOT)
-@@ -89,8 +91,8 @@
-
- /* MEMORY */
- #define PORTER_SDRAM_BASE 0x40000000
--#define PORTER_SDRAM_SIZE 0x40000000
--#define PORTER_UBOOT_SDRAM_SIZE 0x20000000
-+#define PORTER_SDRAM_SIZE 0x48000000
-+#define PORTER_UBOOT_SDRAM_SIZE 0x40000000
-
- #define CONFIG_SYS_LONGHELP
- #define CONFIG_SYS_PROMPT "=> "
-@@ -203,4 +205,15 @@
- #define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
- #define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
-
-+#define CONFIG_ARMV7_LPAE /* 64-bit MMU descriptors */
-+#define CONFIG_SYS_ARM_CACHE_WRITEALLOC /* Make memory operations faster */
-+
-+#define CONFIG_SYS_ARCH_TIMER /* Init arch timer */
-+#define CONFIG_VE_ENABLED /* Virtualization Extensions are enabled*/
-+#define CONFIG_SYS_HZ_CLOCK CONFIG_SYS_CLK_FREQ
-+
-+#define CONFIG_SH_DMA
-+#define CONFIG_SH_SYS_DMAL_BASE 0xE6700000
-+#define CONFIG_SH_SYS_DMAL_NCH 15
-+
- #endif /* __PORTER_H */
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend b/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend
deleted file mode 100644
index 9535e174d..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-bsp/u-boot/u-boot_2013.01.01.bbappend
+++ /dev/null
@@ -1,13 +0,0 @@
-FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
-
-SRC_URI_append_porter_sota = "file://0001-Autoload-uEnv.txt-on-boot.patch"
-
-SRC_URI_append_agl-porter-hibernate = " file://hibernation/0001-Add-rcar-sdhi-DMA-support.patch \
- file://hibernation/0002-Add-Hibernation-swsusp-command-support.patch \
- file://hibernation/0003-Add-Hibernation-swsuspmem-command-support.patch \
- file://hibernation/0004-Add-porter-board-Hibernation-code.patch \
- file://hibernation/0001-Add-hibernation-image-area.patch \
- file://hibernation/0002-Enable-swsusp-DMA-support.patch \
- file://hibernation/0003-Add-hibernation-image-area.patch \
- "
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf.bbappend
deleted file mode 100644
index d92f7846e..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-# Disable LVDS
-SRC_URI += "file://lvds-off.cfg"
diff --git a/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf/lvds-off.cfg b/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf/lvds-off.cfg
deleted file mode 100644
index 8c141139d..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-graphics/wayland/weston-ini-conf/lvds-off.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-[output]
-name=LVDS-1
-mode=off
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module.bbappend
deleted file mode 100755
index 589ed87dc..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module.bbappend
+++ /dev/null
@@ -1,7 +0,0 @@
-FILESEXTRAPATHS_prepend := '${THISDIR}/${PN}:'
-SRC_URI_r8a7791_append_agl-porter-hibernate = ' file://hibernation/0001-Add-gles-hibernation-code-for-M2W-only.patch \
- '
-python __anonymous () {
- d.delVarFlag('do_patch', 'noexec')
-}
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module/hibernation/0001-Add-gles-hibernation-code-for-M2W-only.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module/hibernation/0001-Add-gles-hibernation-code-for-M2W-only.patch
deleted file mode 100644
index a3dd6089c..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/gles-module/gles-kernel-module/hibernation/0001-Add-gles-hibernation-code-for-M2W-only.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 600612d670639fc74135a4f15a79d411931b39a8 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Sun, 21 May 2017 12:14:03 +0900
-Subject: [PATCH] Add gles hibernation code for M2W only
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- services4/srvkm/env/linux/module.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/services4/srvkm/env/linux/module.c b/services4/srvkm/env/linux/module.c
-index f3f22b0..85ac24f 100644
---- a/services4/srvkm/env/linux/module.c
-+++ b/services4/srvkm/env/linux/module.c
-@@ -284,9 +284,18 @@ static struct platform_device_id powervr_id_table[] __devinitdata = {
- };
- #endif
-
-+int pvrsrv_restore_noirq(struct device *dev)
-+{
-+#if defined(CONFIG_ARM_LPAE) && defined(SUPPORT_RCAR_IPMMU)
-+ extern int r8a779x_ipmmu_initialize(void);
-+ r8a779x_ipmmu_initialize();
-+#endif
-+ return 0;
-+}
-+
- static struct dev_pm_ops powervr_dev_pm_ops = {
-- .suspend = PVRSRVDriverSuspend,
-- .resume = PVRSRVDriverResume,
-+ SET_SYSTEM_SLEEP_PM_OPS(PVRSRVDriverSuspend, PVRSRVDriverResume)
-+ .restore_noirq = pvrsrv_restore_noirq,
- };
-
- static LDM_DRV powervr_driver = {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend
deleted file mode 100755
index 08831a365..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend
+++ /dev/null
@@ -1,45 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
-
-# Enable support for TP-Link TL-W722N USB Wifi adapter and RTL2832U DVB USB and USB Audio
-# adapter.
-SRC_URI += " file://disable_delay_printk.patch \
- file://cfg_mac_80211.cfg \
- file://ra2x00.cfg \
- file://0001-media-r820t-do-not-double-free-fe-tuner_priv-in-r820.patch \
- file://0002-media-r820t-remove-redundant-initializations-in-r820.patch \
- file://0003-media-r820t-avoid-potential-memcpy-buffer-overflow-i.patch \
- file://hciattach.cfg \
- file://pppd-rcar.cfg \
- "
-
-SRC_URI_append_agl-porter-hibernate = " file://hibernation/0001-Add-Hibernation-kernel-base-code.patch \
- file://hibernation/0002-Add-Hibernation-arch-code-Only-R-CAR-M2W.patch \
- file://hibernation/0003-Add-sata-hibernation-code.patch \
- file://hibernation/0004-Add-firmware-hibernation-code.patch \
- file://hibernation/0005-Add-rcar-dma-hibernation-code.patch \
- file://hibernation/0006-Add-rcar-du-hibernation-code.patch \
- file://hibernation/0007-Add-rcar-i2c-hibernation-code.patch \
- file://hibernation/0008-Add-rcar-mmc-hibernation-code.patch \
- file://hibernation/0009-Add-hibernation-store-area.patch \
- file://hibernation/0010-Add-rcar-eth-hibernation-code.patch \
- file://hibernation/0011-Add-rcar-pci-hibernation-code.patch \
- file://hibernation/0012-Add-rcar-gpio-hibernation-code.patch \
- file://hibernation/0013-Add-rcar-spi-hibernation-code.patch \
- file://hibernation/0014-Add-rcar-sci-hibernation-code.patch \
- file://hibernation/0015-Add-rcar-usbphy-hibernation-code.patch \
- file://hibernation/0001-Add-shdmac-hibernation-code.patch \
- file://hibernation/0002-Fix-Black-blink-correction-of-display.patch \
- file://hibernation/0003-Add-hibernation-image-area.patch \
- file://hibernation/hibernation.cfg \
- "
-
-KERNEL_CONFIG_FRAGMENTS_append_agl-porter-hibernate += " ${WORKDIR}/hibernation/hibernation.cfg"
-
-# file comes out of meta-agl-bsp/recipes-kernel/linux/linux_%.bbappend
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/can-bus.cfg"
-
-# Enable support for usb video class for usb camera devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/uvc.cfg"
-
-# Enable support for joystick devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/joystick.cfg"
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0001-media-r820t-do-not-double-free-fe-tuner_priv-in-r820.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0001-media-r820t-do-not-double-free-fe-tuner_priv-in-r820.patch
deleted file mode 100644
index 61542556d..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0001-media-r820t-do-not-double-free-fe-tuner_priv-in-r820.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4aab0398e003ac2effae98ba66a012ed715967ba Mon Sep 17 00:00:00 2001
-From: Gianluca Gennari <gennarone@gmail.com>
-Date: Sun, 2 Jun 2013 14:26:15 -0300
-Subject: [PATCH 1/3] [media] r820t: do not double-free fe->tuner_priv in
- r820t_release()
-
-fe->tuner_priv is already freed by hybrid_tuner_release_state().
-
-Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
-Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
----
- drivers/media/tuners/r820t.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
-index 4835021..64f9738 100644
---- a/drivers/media/tuners/r820t.c
-+++ b/drivers/media/tuners/r820t.c
-@@ -2256,7 +2256,6 @@ static int r820t_release(struct dvb_frontend *fe)
-
- mutex_unlock(&r820t_list_mutex);
-
-- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
-
- return 0;
---
-2.9.2
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0002-media-r820t-remove-redundant-initializations-in-r820.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0002-media-r820t-remove-redundant-initializations-in-r820.patch
deleted file mode 100644
index 596dd6bee..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0002-media-r820t-remove-redundant-initializations-in-r820.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From e2e324d70defce7ffc4668085dc3c8ae580074e5 Mon Sep 17 00:00:00 2001
-From: Gianluca Gennari <gennarone@gmail.com>
-Date: Sun, 2 Jun 2013 14:30:09 -0300
-Subject: [PATCH 2/3] [media] r820t: remove redundant initializations in
- r820t_attach()
-
-fe->tuner_priv and fe->ops.tuner_ops are initialized twice in r820t_attach().
-Remove the redundant initializations and also move fe->ops.tuner_ops
-initialization outside of the mutex lock (as in the xc4000 tuner code for example).
-
-Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
-Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
----
- drivers/media/tuners/r820t.c | 9 +++------
- 1 file changed, 3 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
-index 64f9738..63062a9 100644
---- a/drivers/media/tuners/r820t.c
-+++ b/drivers/media/tuners/r820t.c
-@@ -2310,8 +2310,6 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe,
- break;
- }
-
-- memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops, sizeof(r820t_tuner_ops));
--
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
-
-@@ -2326,15 +2324,14 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe,
-
- tuner_info("Rafael Micro r820t successfully identified\n");
-
-- fe->tuner_priv = priv;
-- memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops,
-- sizeof(struct dvb_tuner_ops));
--
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0);
-
- mutex_unlock(&r820t_list_mutex);
-
-+ memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops,
-+ sizeof(struct dvb_tuner_ops));
-+
- return fe;
- err:
- if (fe->ops.i2c_gate_ctrl)
---
-2.9.2
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0003-media-r820t-avoid-potential-memcpy-buffer-overflow-i.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0003-media-r820t-avoid-potential-memcpy-buffer-overflow-i.patch
deleted file mode 100644
index fac5c2171..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/0003-media-r820t-avoid-potential-memcpy-buffer-overflow-i.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 757d7ace565c06e1302ba7c9244d839455e13881 Mon Sep 17 00:00:00 2001
-From: Gianluca Gennari <gennarone@gmail.com>
-Date: Sun, 2 Jun 2013 14:31:19 -0300
-Subject: [PATCH 3/3] [media] r820t: avoid potential memcpy buffer overflow in
- shadow_store()
-
-The memcpy in shadow_store() could exceed buffer limits when r > 0.
-
-Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
-Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
----
- drivers/media/tuners/r820t.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
-index 63062a9..0a5f96b 100644
---- a/drivers/media/tuners/r820t.c
-+++ b/drivers/media/tuners/r820t.c
-@@ -364,8 +364,8 @@ static void shadow_store(struct r820t_priv *priv, u8 reg, const u8 *val,
- }
- if (len <= 0)
- return;
-- if (len > NUM_REGS)
-- len = NUM_REGS;
-+ if (len > NUM_REGS - r)
-+ len = NUM_REGS - r;
-
- tuner_dbg("%s: prev reg=%02x len=%d: %*ph\n",
- __func__, r + REG_SHADOW_START, len, len, val);
---
-2.9.2
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/cfg_mac_80211.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/cfg_mac_80211.cfg
deleted file mode 100644
index 559f3e7af..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/cfg_mac_80211.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_CFG80211=m
-CONFIG_MAC80211=m
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/disable_delay_printk.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/disable_delay_printk.patch
deleted file mode 100755
index 28acf1e08..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/disable_delay_printk.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
-old mode 100644
-new mode 100755
-index 93b6e32..2e9dd36
---- a/sound/usb/pcm.c
-+++ b/sound/usb/pcm.c
-@@ -1420,8 +1420,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
- * on two reads of a counter updated every ms.
- */
- if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
-- snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
-- est_delay, subs->last_delay);
-+// snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
-+// est_delay, subs->last_delay);
-
- if (!subs->running) {
- /* update last_frame_number for delay counting here since
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hciattach.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hciattach.cfg
deleted file mode 100755
index 95ee2d7fc..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hciattach.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_ATH3K=y
-CONFIG_BT_HCIUART_LL=y
-CONFIG_BT_HCIUART_3WIRE=y
-CONFIG_USB_SERIAL=y
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_SERIAL_CP210X=y
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-Hibernation-kernel-base-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-Hibernation-kernel-base-code.patch
deleted file mode 100755
index 87cd2863a..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-Hibernation-kernel-base-code.patch
+++ /dev/null
@@ -1,853 +0,0 @@
-From 60123966221b74199e4cf0c18d43396b4f00a94a Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 16:44:34 +0900
-Subject: [PATCH 01/15] Add Hibernation kernel base code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- include/linux/sched.h | 1 +
- include/linux/suspend.h | 2 +
- kernel/auditfilter.c | 2 +-
- kernel/power/console.c | 2 +
- kernel/power/hibernate.c | 146 +++++++++++++++++++++++++++++++----------------
- kernel/power/main.c | 4 --
- kernel/power/power.h | 8 ++-
- kernel/power/process.c | 35 ++++++++----
- kernel/power/snapshot.c | 33 +++++++----
- kernel/power/suspend.c | 4 +-
- kernel/power/swap.c | 50 ++++++++++++++--
- 11 files changed, 201 insertions(+), 86 deletions(-)
-
-diff --git a/include/linux/sched.h b/include/linux/sched.h
-index f87e9a8..8e3270c 100644
---- a/include/linux/sched.h
-+++ b/include/linux/sched.h
-@@ -1644,6 +1644,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
- #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
- #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
- #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
-+#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
-
- /*
- * Only the _current_ task can read/write to tsk->flags, but other
-diff --git a/include/linux/suspend.h b/include/linux/suspend.h
-index d4e3f16..243ff56 100644
---- a/include/linux/suspend.h
-+++ b/include/linux/suspend.h
-@@ -320,6 +320,8 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
- extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
- extern int hibernate(void);
- extern bool system_entering_hibernation(void);
-+asmlinkage int swsusp_save(void);
-+extern struct pbe *restore_pblist;
- #else /* CONFIG_HIBERNATION */
- static inline void register_nosave_region(unsigned long b, unsigned long e) {}
- static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
-diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
-index 6bd4a90..ac08a9a 100644
---- a/kernel/auditfilter.c
-+++ b/kernel/auditfilter.c
-@@ -423,7 +423,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
- f->lsm_rule = NULL;
-
- /* Support legacy tests for a valid loginuid */
-- if ((f->type == AUDIT_LOGINUID) && (f->val == 4294967295)) {
-+ if ((f->type == AUDIT_LOGINUID) && (f->val == 0xFFFFFFFF)) {
- f->type = AUDIT_LOGINUID_SET;
- f->val = 0;
- }
-diff --git a/kernel/power/console.c b/kernel/power/console.c
-index 463aa67..aba9c54 100644
---- a/kernel/power/console.c
-+++ b/kernel/power/console.c
-@@ -9,6 +9,7 @@
- #include <linux/kbd_kern.h>
- #include <linux/vt.h>
- #include <linux/module.h>
-+#include <linux/slab.h>
- #include "power.h"
-
- #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
-@@ -81,6 +82,7 @@ void pm_vt_switch_unregister(struct device *dev)
- list_for_each_entry(tmp, &pm_vt_switch_list, head) {
- if (tmp->dev == dev) {
- list_del(&tmp->head);
-+ kfree(tmp);
- break;
- }
- }
-diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
-index b26f5f1..524dcf5 100644
---- a/kernel/power/hibernate.c
-+++ b/kernel/power/hibernate.c
-@@ -34,12 +34,13 @@
-
- static int nocompress;
- static int noresume;
-+static int nohibernate;
- static int resume_wait;
--static int resume_delay;
-+static unsigned int resume_delay;
- static char resume_file[256] = CONFIG_PM_STD_PARTITION;
- dev_t swsusp_resume_device;
- sector_t swsusp_resume_block;
--int in_suspend __nosavedata;
-+__visible int in_suspend __nosavedata;
-
- enum {
- HIBERNATION_INVALID,
-@@ -61,6 +62,11 @@ bool freezer_test_done;
-
- static const struct platform_hibernation_ops *hibernation_ops;
-
-+bool hibernation_available(void)
-+{
-+ return (nohibernate == 0);
-+}
-+
- /**
- * hibernation_set_ops - Set the global hibernate operations.
- * @ops: Hibernation operations to use in subsequent hibernation transitions.
-@@ -82,6 +88,7 @@ void hibernation_set_ops(const struct platform_hibernation_ops *ops)
-
- unlock_system_sleep();
- }
-+EXPORT_SYMBOL_GPL(hibernation_set_ops);
-
- static bool entering_platform_hibernation;
-
-@@ -227,19 +234,23 @@ static void platform_recover(int platform_mode)
- void swsusp_show_speed(struct timeval *start, struct timeval *stop,
- unsigned nr_pages, char *msg)
- {
-- s64 elapsed_centisecs64;
-- int centisecs;
-- int k;
-- int kps;
-+ u64 elapsed_centisecs64;
-+ unsigned int centisecs;
-+ unsigned int k;
-+ unsigned int kps;
-
- elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start);
-+ /*
-+ * If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time,
-+ * it is obvious enough for what went wrong.
-+ */
- do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
- centisecs = elapsed_centisecs64;
- if (centisecs == 0)
- centisecs = 1; /* avoid div-by-zero */
- k = nr_pages * (PAGE_SIZE / 1024);
- kps = (k * 100) / centisecs;
-- printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n",
-+ pr_info("PM: %s %u kbytes in %u.%02u seconds (%u.%02u MB/s)\n",
- msg, k,
- centisecs / 100, centisecs % 100,
- kps / 1000, (kps % 1000) / 10);
-@@ -293,10 +304,10 @@ static int create_image(int platform_mode)
- error);
- /* Restore control flow magically appears here */
- restore_processor_state();
-- if (!in_suspend) {
-+ if (!in_suspend)
- events_check_enabled = false;
-- platform_leave(platform_mode);
-- }
-+
-+ platform_leave(platform_mode);
-
- Power_up:
- syscore_resume();
-@@ -594,7 +605,8 @@ static void power_down(void)
- case HIBERNATION_PLATFORM:
- hibernation_platform_enter();
- case HIBERNATION_SHUTDOWN:
-- kernel_power_off();
-+ if (pm_power_off)
-+ kernel_power_off();
- break;
- #ifdef CONFIG_SUSPEND
- case HIBERNATION_SUSPEND:
-@@ -622,7 +634,8 @@ static void power_down(void)
- * corruption after resume.
- */
- printk(KERN_CRIT "PM: Please power down manually\n");
-- while(1);
-+ while (1)
-+ cpu_relax();
- }
-
- /**
-@@ -632,6 +645,11 @@ int hibernate(void)
- {
- int error;
-
-+ if (!hibernation_available()) {
-+ pr_debug("PM: Hibernation not available.\n");
-+ return -EPERM;
-+ }
-+
- lock_system_sleep();
- /* The snapshot device should not be opened while we're running */
- if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
-@@ -644,22 +662,22 @@ int hibernate(void)
- if (error)
- goto Exit;
-
-- /* Allocate memory management structures */
-- error = create_basic_memory_bitmaps();
-- if (error)
-- goto Exit;
--
- printk(KERN_INFO "PM: Syncing filesystems ... ");
- sys_sync();
- printk("done.\n");
-
- error = freeze_processes();
- if (error)
-- goto Free_bitmaps;
-+ goto Exit;
-+
-+ /* Allocate memory management structures */
-+ error = create_basic_memory_bitmaps();
-+ if (error)
-+ goto Thaw;
-
- error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
- if (error || freezer_test_done)
-- goto Thaw;
-+ goto Free_bitmaps;
-
- if (in_suspend) {
- unsigned int flags = 0;
-@@ -682,14 +700,13 @@ int hibernate(void)
- pr_debug("PM: Image restored successfully.\n");
- }
-
-+ Free_bitmaps:
-+ free_basic_memory_bitmaps();
- Thaw:
- thaw_processes();
-
- /* Don't bother checking whether freezer_test_done is true */
- freezer_test_done = false;
--
-- Free_bitmaps:
-- free_basic_memory_bitmaps();
- Exit:
- pm_notifier_call_chain(PM_POST_HIBERNATION);
- pm_restore_console();
-@@ -723,7 +740,7 @@ static int software_resume(void)
- /*
- * If the user said "noresume".. bail out early.
- */
-- if (noresume)
-+ if (noresume || !hibernation_available())
- return 0;
-
- /*
-@@ -806,21 +823,19 @@ static int software_resume(void)
- pm_prepare_console();
- error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
- if (error)
-- goto close_finish;
--
-- error = create_basic_memory_bitmaps();
-- if (error)
-- goto close_finish;
-+ goto Close_Finish;
-
- pr_debug("PM: Preparing processes for restore.\n");
- error = freeze_processes();
-- if (error) {
-- swsusp_close(FMODE_READ);
-- goto Done;
-- }
-+ if (error)
-+ goto Close_Finish;
-
- pr_debug("PM: Loading hibernation image.\n");
-
-+ error = create_basic_memory_bitmaps();
-+ if (error)
-+ goto Thaw;
-+
- error = swsusp_read(&flags);
- swsusp_close(FMODE_READ);
- if (!error)
-@@ -828,9 +843,9 @@ static int software_resume(void)
-
- printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n");
- swsusp_free();
-- thaw_processes();
-- Done:
- free_basic_memory_bitmaps();
-+ Thaw:
-+ thaw_processes();
- Finish:
- pm_notifier_call_chain(PM_POST_RESTORE);
- pm_restore_console();
-@@ -840,12 +855,12 @@ static int software_resume(void)
- mutex_unlock(&pm_mutex);
- pr_debug("PM: Hibernation image not present or could not be loaded.\n");
- return error;
--close_finish:
-+ Close_Finish:
- swsusp_close(FMODE_READ);
- goto Finish;
- }
-
--late_initcall(software_resume);
-+late_initcall_sync(software_resume);
-
-
- static const char * const hibernation_modes[] = {
-@@ -889,6 +904,9 @@ static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr,
- int i;
- char *start = buf;
-
-+ if (!hibernation_available())
-+ return sprintf(buf, "[disabled]\n");
-+
- for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {
- if (!hibernation_modes[i])
- continue;
-@@ -923,6 +941,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
- char *p;
- int mode = HIBERNATION_INVALID;
-
-+ if (!hibernation_available())
-+ return -EPERM;
-+
- p = memchr(buf, '\n', n);
- len = p ? p - buf : n;
-
-@@ -971,16 +992,20 @@ static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
- static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t n)
- {
-- unsigned int maj, min;
- dev_t res;
-- int ret = -EINVAL;
-+ int len = n;
-+ char *name;
-
-- if (sscanf(buf, "%u:%u", &maj, &min) != 2)
-- goto out;
-+ if (len && buf[len-1] == '\n')
-+ len--;
-+ name = kstrndup(buf, len, GFP_KERNEL);
-+ if (!name)
-+ return -ENOMEM;
-
-- res = MKDEV(maj,min);
-- if (maj != MAJOR(res) || min != MINOR(res))
-- goto out;
-+ res = name_to_dev_t(name);
-+ kfree(name);
-+ if (!res)
-+ return -EINVAL;
-
- lock_system_sleep();
- swsusp_resume_device = res;
-@@ -988,20 +1013,20 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
- printk(KERN_INFO "PM: Starting manual resume from disk\n");
- noresume = 0;
- software_resume();
-- ret = n;
-- out:
-- return ret;
-+ return n;
- }
-
- power_attr(resume);
-
--static ssize_t image_size_show(struct kobject *kobj, struct kobj_attribute *attr,
-+static ssize_t image_size_show(struct kobject *kobj,
-+ struct kobj_attribute *attr,
- char *buf)
- {
- return sprintf(buf, "%lu\n", image_size);
- }
-
--static ssize_t image_size_store(struct kobject *kobj, struct kobj_attribute *attr,
-+static ssize_t image_size_store(struct kobject *kobj,
-+ struct kobj_attribute *attr,
- const char *buf, size_t n)
- {
- unsigned long size;
-@@ -1065,7 +1090,7 @@ static int __init resume_setup(char *str)
- if (noresume)
- return 1;
-
-- strncpy( resume_file, str, 255 );
-+ strncpy(resume_file, str, 255);
- return 1;
- }
-
-@@ -1088,6 +1113,10 @@ static int __init hibernate_setup(char *str)
- noresume = 1;
- else if (!strncmp(str, "nocompress", 10))
- nocompress = 1;
-+ else if (!strncmp(str, "no", 2)) {
-+ noresume = 1;
-+ nohibernate = 1;
-+ }
- return 1;
- }
-
-@@ -1105,13 +1134,30 @@ static int __init resumewait_setup(char *str)
-
- static int __init resumedelay_setup(char *str)
- {
-- resume_delay = simple_strtoul(str, NULL, 0);
-+ int rc = kstrtouint(str, 0, &resume_delay);
-+
-+ if (rc)
-+ return rc;
-+ return 1;
-+}
-+
-+static int __init nohibernate_setup(char *str)
-+{
-+ noresume = 1;
-+ nohibernate = 1;
- return 1;
- }
-
-+static int __init kaslr_nohibernate_setup(char *str)
-+{
-+ return nohibernate_setup(str);
-+}
-+
- __setup("noresume", noresume_setup);
- __setup("resume_offset=", resume_offset_setup);
- __setup("resume=", resume_setup);
- __setup("hibernate=", hibernate_setup);
- __setup("resumewait", resumewait_setup);
- __setup("resumedelay=", resumedelay_setup);
-+__setup("nohibernate", nohibernate_setup);
-+__setup("kaslr", kaslr_nohibernate_setup);
-diff --git a/kernel/power/main.c b/kernel/power/main.c
-index d77663b..ac615e4 100644
---- a/kernel/power/main.c
-+++ b/kernel/power/main.c
-@@ -610,7 +610,6 @@ static struct attribute_group attr_group = {
- .attrs = g,
- };
-
--#ifdef CONFIG_PM_RUNTIME
- struct workqueue_struct *pm_wq;
- EXPORT_SYMBOL_GPL(pm_wq);
-
-@@ -620,9 +619,6 @@ static int __init pm_start_workqueue(void)
-
- return pm_wq ? 0 : -ENOMEM;
- }
--#else
--static inline int pm_start_workqueue(void) { return 0; }
--#endif
-
- static int __init pm_init(void)
- {
-diff --git a/kernel/power/power.h b/kernel/power/power.h
-index 7d4b7ff..c5821ca 100644
---- a/kernel/power/power.h
-+++ b/kernel/power/power.h
-@@ -2,6 +2,7 @@
- #include <linux/suspend_ioctls.h>
- #include <linux/utsname.h>
- #include <linux/freezer.h>
-+#include <linux/compiler.h>
-
- struct swsusp_info {
- struct new_utsname uts;
-@@ -11,7 +12,8 @@ struct swsusp_info {
- unsigned long image_pages;
- unsigned long pages;
- unsigned long size;
--} __attribute__((aligned(PAGE_SIZE)));
-+ char archdata[1024];
-+} __aligned(PAGE_SIZE);
-
- #ifdef CONFIG_HIBERNATION
- /* kernel/power/snapshot.c */
-@@ -37,6 +39,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
- }
- #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
-
-+extern void __weak swsusp_arch_add_info(char *archdata);
-+
- /*
- * Keep some memory free so that I/O operations can succeed without paging
- * [Might this be more than 4 MB?]
-@@ -49,6 +53,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
- */
- #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
-
-+asmlinkage int swsusp_save(void);
-+
- /* kernel/power/hibernate.c */
- extern bool freezer_test_done;
-
-diff --git a/kernel/power/process.c b/kernel/power/process.c
-index 0695319..04559b4 100644
---- a/kernel/power/process.c
-+++ b/kernel/power/process.c
-@@ -30,9 +30,10 @@ static int try_to_freeze_tasks(bool user_only)
- unsigned int todo;
- bool wq_busy = false;
- struct timeval start, end;
-- u64 elapsed_csecs64;
-- unsigned int elapsed_csecs;
-+ u64 elapsed_msecs64;
-+ unsigned int elapsed_msecs;
- bool wakeup = false;
-+ int sleep_usecs = USEC_PER_MSEC;
-
- do_gettimeofday(&start);
-
-@@ -68,22 +69,25 @@ static int try_to_freeze_tasks(bool user_only)
-
- /*
- * We need to retry, but first give the freezing tasks some
-- * time to enter the refrigerator.
-+ * time to enter the refrigerator. Start with an initial
-+ * 1 ms sleep followed by exponential backoff until 8 ms.
- */
-- msleep(10);
-+ usleep_range(sleep_usecs / 2, sleep_usecs);
-+ if (sleep_usecs < 8 * USEC_PER_MSEC)
-+ sleep_usecs *= 2;
- }
-
- do_gettimeofday(&end);
-- elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
-- do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
-- elapsed_csecs = elapsed_csecs64;
-+ elapsed_msecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
-+ do_div(elapsed_msecs64, NSEC_PER_MSEC);
-+ elapsed_msecs = elapsed_msecs64;
-
- if (todo) {
- printk("\n");
-- printk(KERN_ERR "Freezing of tasks %s after %d.%02d seconds "
-+ printk(KERN_ERR "Freezing of tasks %s after %d.%03d seconds "
- "(%d tasks refusing to freeze, wq_busy=%d):\n",
- wakeup ? "aborted" : "failed",
-- elapsed_csecs / 100, elapsed_csecs % 100,
-+ elapsed_msecs / 1000, elapsed_msecs % 1000,
- todo - wq_busy, wq_busy);
-
- if (!wakeup) {
-@@ -96,8 +100,8 @@ static int try_to_freeze_tasks(bool user_only)
- read_unlock(&tasklist_lock);
- }
- } else {
-- printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
-- elapsed_csecs % 100);
-+ printk("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
-+ elapsed_msecs % 1000);
- }
-
- return todo ? -EBUSY : 0;
-@@ -139,6 +143,9 @@ int freeze_processes(void)
- if (error)
- return error;
-
-+ /* Make sure this task doesn't get frozen */
-+ current->flags |= PF_SUSPEND_TASK;
-+
- if (!pm_freezing)
- atomic_inc(&system_freezing_cnt);
-
-@@ -202,6 +209,7 @@ int freeze_kernel_threads(void)
- void thaw_processes(void)
- {
- struct task_struct *g, *p;
-+ struct task_struct *curr = current;
-
- if (pm_freezing)
- atomic_dec(&system_freezing_cnt);
-@@ -217,10 +225,15 @@ void thaw_processes(void)
-
- read_lock(&tasklist_lock);
- do_each_thread(g, p) {
-+ /* No other threads should have PF_SUSPEND_TASK set */
-+ WARN_ON((p != curr) && (p->flags & PF_SUSPEND_TASK));
- __thaw_task(p);
- } while_each_thread(g, p);
- read_unlock(&tasklist_lock);
-
-+ WARN_ON(!(curr->flags & PF_SUSPEND_TASK));
-+ curr->flags &= ~PF_SUSPEND_TASK;
-+
- usermodehelper_enable();
-
- schedule();
-diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
-index 91c04f1..a673f7b 100644
---- a/kernel/power/snapshot.c
-+++ b/kernel/power/snapshot.c
-@@ -27,6 +27,7 @@
- #include <linux/highmem.h>
- #include <linux/list.h>
- #include <linux/slab.h>
-+#include <linux/compiler.h>
-
- #include <asm/uaccess.h>
- #include <asm/mmu_context.h>
-@@ -155,7 +156,7 @@ static inline void free_image_page(void *addr, int clear_nosave_free)
- struct linked_page {
- struct linked_page *next;
- char data[LINKED_PAGE_DATA_SIZE];
--} __attribute__((packed));
-+} __packed;
-
- static inline void
- free_list_of_pages(struct linked_page *list, int clear_page_nosave)
-@@ -352,7 +353,7 @@ static int create_mem_extents(struct list_head *list, gfp_t gfp_mask)
- struct mem_extent *ext, *cur, *aux;
-
- zone_start = zone->zone_start_pfn;
-- zone_end = zone->zone_start_pfn + zone->spanned_pages;
-+ zone_end = zone_end_pfn(zone);
-
- list_for_each_entry(ext, list, hook)
- if (zone_start <= ext->end)
-@@ -642,8 +643,9 @@ __register_nosave_region(unsigned long start_pfn, unsigned long end_pfn,
- region->end_pfn = end_pfn;
- list_add_tail(&region->list, &nosave_regions);
- Report:
-- printk(KERN_INFO "PM: Registered nosave memory: %016lx - %016lx\n",
-- start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT);
-+ printk(KERN_INFO "PM: Registered nosave memory: [mem %#010llx-%#010llx]\n",
-+ (unsigned long long) start_pfn << PAGE_SHIFT,
-+ ((unsigned long long) end_pfn << PAGE_SHIFT) - 1);
- }
-
- /*
-@@ -742,7 +744,10 @@ int create_basic_memory_bitmaps(void)
- struct memory_bitmap *bm1, *bm2;
- int error = 0;
-
-- BUG_ON(forbidden_pages_map || free_pages_map);
-+ if (forbidden_pages_map && free_pages_map)
-+ return 0;
-+ else
-+ BUG_ON(forbidden_pages_map || free_pages_map);
-
- bm1 = kzalloc(sizeof(struct memory_bitmap), GFP_KERNEL);
- if (!bm1)
-@@ -788,7 +793,8 @@ void free_basic_memory_bitmaps(void)
- {
- struct memory_bitmap *bm1, *bm2;
-
-- BUG_ON(!(forbidden_pages_map && free_pages_map));
-+ if (WARN_ON(!(forbidden_pages_map && free_pages_map)))
-+ return;
-
- bm1 = forbidden_pages_map;
- bm2 = free_pages_map;
-@@ -883,7 +889,7 @@ static unsigned int count_highmem_pages(void)
- continue;
-
- mark_free_pages(zone);
-- max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
-+ max_zone_pfn = zone_end_pfn(zone);
- for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
- if (saveable_highmem_page(zone, pfn))
- n++;
-@@ -947,7 +953,7 @@ static unsigned int count_data_pages(void)
- continue;
-
- mark_free_pages(zone);
-- max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
-+ max_zone_pfn = zone_end_pfn(zone);
- for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
- if (saveable_page(zone, pfn))
- n++;
-@@ -1040,7 +1046,7 @@ copy_data_pages(struct memory_bitmap *copy_bm, struct memory_bitmap *orig_bm)
- unsigned long max_zone_pfn;
-
- mark_free_pages(zone);
-- max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
-+ max_zone_pfn = zone_end_pfn(zone);
- for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
- if (page_is_saveable(zone, pfn))
- memory_bm_set_bit(orig_bm, pfn);
-@@ -1092,7 +1098,7 @@ void swsusp_free(void)
- unsigned long pfn, max_zone_pfn;
-
- for_each_populated_zone(zone) {
-- max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
-+ max_zone_pfn = zone_end_pfn(zone);
- for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
- if (pfn_valid(pfn)) {
- struct page *page = pfn_to_page(pfn);
-@@ -1580,7 +1586,7 @@ swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,
- return -ENOMEM;
- }
-
--asmlinkage int swsusp_save(void)
-+asmlinkage __visible int swsusp_save(void)
- {
- unsigned int nr_pages, nr_highmem;
-
-@@ -1628,6 +1634,7 @@ static int init_header_complete(struct swsusp_info *info)
- {
- memcpy(&info->uts, init_utsname(), sizeof(struct new_utsname));
- info->version_code = LINUX_VERSION_CODE;
-+ swsusp_arch_add_info(info->archdata);
- return 0;
- }
-
-@@ -1647,6 +1654,8 @@ static char *check_image_kernel(struct swsusp_info *info)
- }
- #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
-
-+void __weak swsusp_arch_add_info(char *archdata) {}
-+
- unsigned long snapshot_get_image_size(void)
- {
- return nr_copy_pages + nr_meta_pages + 1;
-@@ -1758,7 +1767,7 @@ static int mark_unsafe_pages(struct memory_bitmap *bm)
-
- /* Clear page flags */
- for_each_populated_zone(zone) {
-- max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
-+ max_zone_pfn = zone_end_pfn(zone);
- for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
- if (pfn_valid(pfn))
- swsusp_unset_page_free(pfn_to_page(pfn));
-diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
-index bef86d1..deec937 100644
---- a/kernel/power/suspend.c
-+++ b/kernel/power/suspend.c
-@@ -156,13 +156,13 @@ static int suspend_prepare(suspend_state_t state)
- }
-
- /* default implementation */
--void __attribute__ ((weak)) arch_suspend_disable_irqs(void)
-+void __weak arch_suspend_disable_irqs(void)
- {
- local_irq_disable();
- }
-
- /* default implementation */
--void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
-+void __weak arch_suspend_enable_irqs(void)
- {
- local_irq_enable();
- }
-diff --git a/kernel/power/swap.c b/kernel/power/swap.c
-index 7c33ed2..a6a1c55 100644
---- a/kernel/power/swap.c
-+++ b/kernel/power/swap.c
-@@ -91,17 +91,28 @@ struct swap_map_handle {
- unsigned int k;
- unsigned long reqd_free_pages;
- u32 crc32;
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ unsigned int img_size; /* add */
-+#endif
- };
-
- struct swsusp_header {
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int) -
-+ sizeof(u32) - (sizeof(unsigned int)*4) - sizeof(u32)];
-+ unsigned int comp_crc32[4];
-+ u32 img_size;
-+#else
- char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int) -
-- sizeof(u32)];
-+ sizeof(u32) - sizeof(u32)];
-+ u32 comp_crc32;
-+#endif
- u32 crc32;
- sector_t image;
- unsigned int flags; /* Flags to pass to the "boot" kernel */
- char orig_sig[10];
- char sig[10];
--} __attribute__((packed));
-+} __packed;
-
- static struct swsusp_header *swsusp_header;
-
-@@ -230,6 +241,11 @@ static int mark_swapfiles(struct swap_map_handle *handle, unsigned int flags)
- swsusp_header->flags = flags;
- if (flags & SF_CRC32_MODE)
- swsusp_header->crc32 = handle->crc32;
-+
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ swsusp_header->img_size = handle->img_size;
-+#endif
-+
- error = hib_bio_write_page(swsusp_resume_block,
- swsusp_header, NULL);
- } else {
-@@ -587,7 +603,11 @@ static int save_image_lzo(struct swap_map_handle *handle,
- unsigned char *page = NULL;
- struct cmp_data *data = NULL;
- struct crc_data *crc = NULL;
-+ int compr = 0;
-
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ unsigned int comp_imgtotal = 0;
-+#endif
- /*
- * We'll limit the number of threads for compression to limit memory
- * footprint.
-@@ -733,7 +753,12 @@ static int save_image_lzo(struct swap_map_handle *handle,
- }
-
- *(size_t *)data[thr].cmp = data[thr].cmp_len;
--
-+ compr += data[thr].cmp_len;
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ comp_imgtotal += (data[thr].cmp_len
-+ + LZO_HEADER + (PAGE_SIZE - 1))
-+ & ~(PAGE_SIZE - 1);
-+#endif
- /*
- * Given we are writing one page at a time to disk, we
- * copy that much from the buffer, although the last
-@@ -746,7 +771,6 @@ static int save_image_lzo(struct swap_map_handle *handle,
- off < LZO_HEADER + data[thr].cmp_len;
- off += PAGE_SIZE) {
- memcpy(page, data[thr].cmp + off, PAGE_SIZE);
--
- ret = swap_write_page(handle, page, &bio);
- if (ret)
- goto out_finish;
-@@ -762,8 +786,24 @@ out_finish:
- do_gettimeofday(&stop);
- if (!ret)
- ret = err2;
-- if (!ret)
-+ if (!ret) {
-+#ifdef CONFIG_ARCH_SHMOBILE
-+ const unsigned int ds = comp_imgtotal +
-+ ((comp_imgtotal
-+ / ((2 * 1024 * 1024)
-+ - PAGE_SIZE)) * PAGE_SIZE);
-+ const unsigned int swaped =
-+ (swp_offset(get_swap_page_of_type(root_swap))
-+ - 2) * PAGE_SIZE;
-+ if (ds < swaped)
-+ handle->img_size = swaped;
-+ else
-+ handle->img_size = ds;
-+#endif
- printk(KERN_INFO "PM: Image saving done.\n");
-+ printk(KERN_INFO "PM: Compressed output size: %d [%d] (imgsize=%d/swaped size=%d)\n",
-+ compr, handle->img_size, ds, swaped);
-+ }
- swsusp_show_speed(&start, &stop, nr_to_write, "Wrote");
- out_clean:
- if (crc) {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch
deleted file mode 100644
index ad4e4bc03..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From dfc07c05c50155420e47f85442d099d433db869b Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:11:49 +0900
-Subject: [PATCH 1/3] Add shdmac hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/dma/sh/shdmac.c | 36 ++++++++++++++++++++++++------------
- 1 file changed, 24 insertions(+), 12 deletions(-)
-
-diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
-index 1c97cc5..d084437 100644
---- a/drivers/dma/sh/shdmac.c
-+++ b/drivers/dma/sh/shdmac.c
-@@ -743,11 +743,20 @@ static int sh_dmae_resume(struct device *dev)
- #define sh_dmae_resume NULL
- #endif
-
-+static int sh_dmae_restore(struct device *dev)
-+{
-+#ifdef CONFIG_PM
-+ return sh_dmae_resume(dev);
-+#else
-+ return 0;
-+#endif
-+}
-+
- const struct dev_pm_ops sh_dmae_pm = {
-- .suspend = sh_dmae_suspend,
-- .resume = sh_dmae_resume,
-- .runtime_suspend = sh_dmae_runtime_suspend,
-- .runtime_resume = sh_dmae_runtime_resume,
-+ SET_SYSTEM_SLEEP_PM_OPS(sh_dmae_suspend, sh_dmae_resume)
-+ SET_RUNTIME_PM_OPS(sh_dmae_runtime_suspend, sh_dmae_runtime_resume,
-+ NULL)
-+ .restore_noirq = sh_dmae_restore,
- };
-
- static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan)
-@@ -798,7 +807,6 @@ static int sh_dmae_probe(struct platform_device *pdev)
- struct sh_dmae_device *shdev;
- struct dma_device *dma_dev;
- struct resource *chan, *dmars, *errirq_res, *chanirq_res;
-- unsigned long flags;
-
- if (pdev->dev.of_node)
- pdata = of_match_device(sh_dmae_of_match, &pdev->dev)->data;
-@@ -885,9 +893,9 @@ static int sh_dmae_probe(struct platform_device *pdev)
- if (err < 0)
- dev_err(&pdev->dev, "%s(): GET = %d\n", __func__, err);
-
-- spin_lock_irqsave(&sh_dmae_lock, flags);
-+ spin_lock_irq(&sh_dmae_lock);
- list_add_tail_rcu(&shdev->node, &sh_dmae_devices);
-- spin_unlock_irqrestore(&sh_dmae_lock, flags);
-+ spin_unlock_irq(&sh_dmae_lock);
-
- /* reset dma controller - only needed as a test */
- err = sh_dmae_rst(shdev);
-@@ -981,6 +989,7 @@ static int sh_dmae_probe(struct platform_device *pdev)
- return err;
-
- edmadevreg:
-+ pm_runtime_get(&pdev->dev);
- chan_probe_err:
- sh_dmae_chan_remove(shdev);
-
-@@ -988,9 +997,9 @@ chan_probe_err:
- eirq_err:
- #endif
- rst_err:
-- spin_lock_irqsave(&sh_dmae_lock, flags);
-+ spin_lock_irq(&sh_dmae_lock);
- list_del_rcu(&shdev->node);
-- spin_unlock_irqrestore(&sh_dmae_lock, flags);
-+ spin_unlock_irq(&sh_dmae_lock);
-
- pm_runtime_put(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
-@@ -1007,13 +1016,12 @@ static int sh_dmae_remove(struct platform_device *pdev)
- {
- struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
- struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev;
-- unsigned long flags;
-
- dma_async_device_unregister(dma_dev);
-
-- spin_lock_irqsave(&sh_dmae_lock, flags);
-+ spin_lock_irq(&sh_dmae_lock);
- list_del_rcu(&shdev->node);
-- spin_unlock_irqrestore(&sh_dmae_lock, flags);
-+ spin_unlock_irq(&sh_dmae_lock);
-
- pm_runtime_disable(&pdev->dev);
-
-@@ -1047,7 +1055,11 @@ static int __init sh_dmae_init(void)
-
- return platform_driver_probe(&sh_dmae_driver, sh_dmae_probe);
- }
-+#ifdef MODULE
- module_init(sh_dmae_init);
-+#else
-+subsys_initcall(sh_dmae_init);
-+#endif
-
- static void __exit sh_dmae_exit(void)
- {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Add-Hibernation-arch-code-Only-R-CAR-M2W.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Add-Hibernation-arch-code-Only-R-CAR-M2W.patch
deleted file mode 100755
index 4db90e4e0..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Add-Hibernation-arch-code-Only-R-CAR-M2W.patch
+++ /dev/null
@@ -1,1529 +0,0 @@
-From 34a419b3fd88a2275ca681c99a5787b937e0f39d Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 16:47:29 +0900
-Subject: [PATCH 02/15] Add Hibernation arch code(Only R-CAR M2W)
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- arch/arm/Kconfig | 5 +
- arch/arm/include/asm/memory.h | 1 +
- arch/arm/include/asm/smp.h | 4 +
- arch/arm/include/asm/suspend.h | 3 +
- arch/arm/kernel/Makefile | 1 +
- arch/arm/kernel/hibernate.c | 139 ++++++++++++++
- arch/arm/kernel/process.c | 7 +-
- arch/arm/kernel/sleep.S | 8 +
- arch/arm/kernel/smp.c | 6 +
- arch/arm/kernel/suspend.c | 64 ++++---
- arch/arm/mach-shmobile/Kconfig | 65 +++++++
- arch/arm/mach-shmobile/Makefile | 1 +
- arch/arm/mach-shmobile/common.h | 8 +
- arch/arm/mach-shmobile/crc32_word4.c | 299 +++++++++++++++++++++++++++++++
- arch/arm/mach-shmobile/crc32_word4.h | 23 +++
- arch/arm/mach-shmobile/headsmp.S | 2 -
- arch/arm/mach-shmobile/hibernation.c | 243 +++++++++++++++++++++++++
- arch/arm/mach-shmobile/platsmp-apmu.c | 13 +-
- arch/arm/mach-shmobile/platsmp-rst.c | 3 +-
- arch/arm/mach-shmobile/pm-r8a7791.c | 27 +--
- arch/arm/mach-shmobile/rcar-gen2.h | 39 ++++
- arch/arm/mach-shmobile/setup-r8a7791.c | 10 +-
- arch/arm/mach-shmobile/setup-rcar-gen2.c | 14 +-
- arch/arm/mach-shmobile/smp-r8a7791.c | 8 +-
- arch/arm/mm/proc-v7.S | 31 ++--
- 25 files changed, 947 insertions(+), 77 deletions(-)
- create mode 100644 arch/arm/kernel/hibernate.c
- create mode 100644 arch/arm/mach-shmobile/crc32_word4.c
- create mode 100644 arch/arm/mach-shmobile/crc32_word4.h
- create mode 100644 arch/arm/mach-shmobile/hibernation.c
-
-diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index 4dd95dd..eb76182 100644
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -2232,6 +2232,11 @@ config ARCH_SUSPEND_POSSIBLE
- config ARM_CPU_SUSPEND
- def_bool PM_SLEEP
-
-+config ARCH_HIBERNATION_POSSIBLE
-+ bool
-+ depends on MMU
-+ default y if ARCH_SUSPEND_POSSIBLE
-+
- endmenu
-
- source "net/Kconfig"
-diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
-index 48cb2b3..01158e7 100644
---- a/arch/arm/include/asm/memory.h
-+++ b/arch/arm/include/asm/memory.h
-@@ -241,6 +241,7 @@ static inline void *phys_to_virt(phys_addr_t x)
- #define __pa(x) __virt_to_phys((unsigned long)(x))
- #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
- #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
-+#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
-
- /*
- * Virtual <-> DMA view memory address translations
-diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
-index d3a22be..b718040 100644
---- a/arch/arm/include/asm/smp.h
-+++ b/arch/arm/include/asm/smp.h
-@@ -42,6 +42,10 @@ void handle_IPI(int ipinr, struct pt_regs *regs);
- */
- extern void smp_init_cpus(void);
-
-+/*
-+ * Provide a function to call machine specific cpu initialization sequence
-+ */
-+extern void arch_smp_prepare_cpus(unsigned int max_cpus);
-
- /*
- * Provide a function to raise an IPI cross call on CPUs in callmap.
-diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h
-index 1c0a551..709afa4 100644
---- a/arch/arm/include/asm/suspend.h
-+++ b/arch/arm/include/asm/suspend.h
-@@ -3,5 +3,8 @@
-
- extern void cpu_resume(void);
- extern int cpu_suspend(unsigned long, int (*)(unsigned long));
-+extern const void __nosave_begin, __nosave_end;
-+extern void cpu_resume_restore_nosave(u32, u32, u32);
-+extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
-
- #endif
-diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
-index 5f3338e..70f439f 100644
---- a/arch/arm/kernel/Makefile
-+++ b/arch/arm/kernel/Makefile
-@@ -32,6 +32,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o
- obj-$(CONFIG_ISA_DMA) += dma-isa.o
- obj-$(CONFIG_PCI) += bios32.o isa.o
- obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
-+obj-$(CONFIG_HIBERNATION) += hibernate.o
- obj-$(CONFIG_SMP) += smp.o smp_tlb.o
- obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
- obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
-diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
-new file mode 100644
-index 0000000..9380fe2
---- /dev/null
-+++ b/arch/arm/kernel/hibernate.c
-@@ -0,0 +1,139 @@
-+/*
-+ * Hibernation support specific for ARM
-+ *
-+ * Derived from work on ARM hibernation support by:
-+ *
-+ * Ubuntu project, hibernation support for mach-dove
-+ * Copyright (C) 2010 Nokia Corporation (Hiroshi Doyu)
-+ * Copyright (C) 2010 Texas Instruments, Inc. (Teerth Reddy et al.)
-+ * https://lkml.org/lkml/2010/6/18/4
-+ * https://lists.linux-foundation.org/pipermail/linux-pm/2010-June/027422.html
-+ * https://patchwork.kernel.org/patch/96442/
-+ *
-+ * Copyright (C) 2006 Rafael J. Wysocki <rjw at sisk.pl>
-+ *
-+ * License terms: GNU General Public License (GPL) version 2
-+ */
-+
-+#include <linux/mm.h>
-+#include <linux/suspend.h>
-+#include <asm/system_misc.h>
-+#include <asm/idmap.h>
-+#include <asm/suspend.h>
-+#include <asm/memory.h>
-+
-+struct swsusp_archdata {
-+ u32 nosave_backup_phys;
-+ u32 nosave_begin_phys;
-+ u32 nosave_end_phys;
-+ /* Function pointer */
-+ u32 cpu_resume_restore_nosave;
-+};
-+
-+static struct swsusp_archdata __archdata;
-+
-+void swsusp_arch_add_info(char *archdata)
-+{
-+ memcpy((void *)archdata, (void *)&__archdata,
-+ sizeof(struct swsusp_archdata));
-+}
-+
-+int pfn_is_nosave(unsigned long pfn)
-+{
-+ unsigned long nosave_begin_pfn = virt_to_pfn(&__nosave_begin);
-+ unsigned long nosave_end_pfn = virt_to_pfn(&__nosave_end - 1);
-+
-+ return (pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn);
-+}
-+
-+void notrace save_processor_state(void)
-+{
-+ WARN_ON(num_online_cpus() != 1);
-+ local_fiq_disable();
-+}
-+
-+void notrace restore_processor_state(void)
-+{
-+ local_fiq_enable();
-+}
-+
-+/*
-+ * Snapshot kernel memory and reset the system.
-+ *
-+ * swsusp_save() is executed in the suspend finisher so that the CPU
-+ * context pointer and memory are part of the saved image, which is
-+ * required by the resume kernel image to restart execution from
-+ * swsusp_arch_suspend().
-+ *
-+ * soft_restart is not technically needed, but is used to get success
-+ * returned from cpu_suspend.
-+ *
-+ * When soft reboot completes, the hibernation snapshot is written out.
-+ */
-+static int notrace arch_save_image(unsigned long unused)
-+{
-+ int ret;
-+ ret = swsusp_save();
-+ if (ret == 0)
-+ soft_restart(virt_to_phys(cpu_resume));
-+ return ret;
-+}
-+
-+/*
-+ * Save the current CPU state before suspend / poweroff.
-+ */
-+int notrace swsusp_arch_suspend(void)
-+{
-+ return cpu_suspend(0, arch_save_image);
-+}
-+
-+/*
-+ * Restore page contents for physical pages that were in use during loading
-+ * hibernation image. Switch to idmap_pgd so the physical page tables
-+ * are overwritten with the same contents.
-+ */
-+static void notrace arch_restore_image(void *unused)
-+{
-+ struct pbe *pbe;
-+
-+
-+ cpu_switch_mm(idmap_pgd, &init_mm);
-+ for (pbe = restore_pblist; pbe; pbe = pbe->next)
-+ copy_page(pbe->orig_address, pbe->address);
-+
-+ soft_restart(virt_to_phys(cpu_resume));
-+}
-+static u64 resume_stack[PAGE_SIZE/2/sizeof(u64)] __nosavedata;
-+
-+/*
-+ * Resume from the hibernation image.
-+ * Due to the kernel heap / data restore, stack contents change underneath
-+ * and that would make function calls impossible; switch to a temporary
-+ * stack within the nosave region to avoid that problem.
-+ */
-+int swsusp_arch_resume(void)
-+{
-+ call_with_stack(arch_restore_image, 0,
-+ resume_stack + ARRAY_SIZE(resume_stack));
-+ return 0;
-+}
-+
-+static int __init swsusp_arch_init(void)
-+{
-+ char *backup;
-+ size_t len;
-+
-+ len = &__nosave_end - &__nosave_begin;
-+ backup = kmalloc(len, GFP_KERNEL);
-+ if (backup)
-+ memcpy(backup, &__nosave_begin, len);
-+
-+ __archdata.nosave_backup_phys = virt_to_phys(backup);
-+ __archdata.nosave_begin_phys = virt_to_phys(&__nosave_begin);
-+ __archdata.nosave_end_phys = virt_to_phys(&__nosave_end);
-+ __archdata.cpu_resume_restore_nosave =
-+ virt_to_phys(cpu_resume_restore_nosave);
-+
-+ return 0;
-+}
-+late_initcall(swsusp_arch_init);
-diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index 7927629..ae56f0b 100644
---- a/arch/arm/kernel/process.c
-+++ b/arch/arm/kernel/process.c
-@@ -98,7 +98,7 @@ void soft_restart(unsigned long addr)
- u64 *stack = soft_restart_stack + ARRAY_SIZE(soft_restart_stack);
-
- /* Disable interrupts first */
-- local_irq_disable();
-+ raw_local_irq_disable();
- local_fiq_disable();
-
- /* Disable the L2 if we're the last man standing. */
-@@ -284,12 +284,17 @@ void __show_regs(struct pt_regs *regs)
- buf[3] = flags & PSR_V_BIT ? 'V' : 'v';
- buf[4] = '\0';
-
-+#ifndef CONFIG_CPU_V7M
- printk("Flags: %s IRQs o%s FIQs o%s Mode %s ISA %s Segment %s\n",
- buf, interrupts_enabled(regs) ? "n" : "ff",
- fast_interrupts_enabled(regs) ? "n" : "ff",
- processor_modes[processor_mode(regs)],
- isa_modes[isa_mode(regs)],
- get_fs() == get_ds() ? "kernel" : "user");
-+#else
-+ printk("xPSR: %08lx\n", regs->ARM_cpsr);
-+#endif
-+
- #ifdef CONFIG_CPU_CP15
- {
- unsigned int ctrl;
-diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
-index 987dcf3..e4d092f 100644
---- a/arch/arm/kernel/sleep.S
-+++ b/arch/arm/kernel/sleep.S
-@@ -98,6 +98,14 @@ THUMB( mov sp, r2 )
- THUMB( bx r3 )
- ENDPROC(cpu_resume)
-
-+ .align
-+ENTRY(cpu_resume_restore_nosave)
-+1: ldmia r0!, {r3-r10}
-+ stmia r1!, {r3-r10}
-+ cmp r1, r2
-+ bne 1b
-+ b cpu_resume
-+
- sleep_save_sp:
- .rept CONFIG_NR_CPUS
- .long 0 @ preserve stack phys ptr here
-diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index 5919eb4..c9a2991 100644
---- a/arch/arm/kernel/smp.c
-+++ b/arch/arm/kernel/smp.c
-@@ -125,6 +125,12 @@ void __init smp_init_cpus(void)
- smp_ops.smp_init_cpus();
- }
-
-+void arch_smp_prepare_cpus(unsigned int max_cpus)
-+{
-+ if (smp_ops.smp_prepare_cpus)
-+ smp_ops.smp_prepare_cpus(max_cpus);
-+}
-+
- int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
- {
- if (smp_ops.smp_boot_secondary)
-diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
-index c59c97e..38a5067 100644
---- a/arch/arm/kernel/suspend.c
-+++ b/arch/arm/kernel/suspend.c
-@@ -10,6 +10,42 @@
- extern int __cpu_suspend(unsigned long, int (*)(unsigned long));
- extern void cpu_resume_mmu(void);
-
-+#ifdef CONFIG_MMU
-+/*
-+ * Hide the first two arguments to __cpu_suspend - these are an implementation
-+ * detail which platform code shouldn't have to know about.
-+ */
-+int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
-+{
-+ struct mm_struct *mm = current->active_mm;
-+ int ret;
-+
-+ if (!idmap_pgd)
-+ return -EINVAL;
-+
-+ /*
-+ * Provide a temporary page table with an identity mapping for
-+ * the MMU-enable code, required for resuming. On successful
-+ * resume (indicated by a zero return code), we need to switch
-+ * back to the correct page tables.
-+ */
-+ ret = __cpu_suspend(arg, fn);
-+ if (ret == 0) {
-+ cpu_switch_mm(mm->pgd, mm);
-+ local_flush_bp_all();
-+ local_flush_tlb_all();
-+ }
-+
-+ return ret;
-+}
-+#else
-+int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
-+{
-+ return __cpu_suspend(arg, fn);
-+}
-+#define idmap_pgd NULL
-+#endif
-+
- /*
- * This is called by __cpu_suspend() to save the state, and do whatever
- * flushing is required to ensure that when the CPU goes to sleep we have
-@@ -46,31 +82,3 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
- outer_clean_range(virt_to_phys(save_ptr),
- virt_to_phys(save_ptr) + sizeof(*save_ptr));
- }
--
--/*
-- * Hide the first two arguments to __cpu_suspend - these are an implementation
-- * detail which platform code shouldn't have to know about.
-- */
--int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
--{
-- struct mm_struct *mm = current->active_mm;
-- int ret;
--
-- if (!idmap_pgd)
-- return -EINVAL;
--
-- /*
-- * Provide a temporary page table with an identity mapping for
-- * the MMU-enable code, required for resuming. On successful
-- * resume (indicated by a zero return code), we need to switch
-- * back to the correct page tables.
-- */
-- ret = __cpu_suspend(arg, fn);
-- if (ret == 0) {
-- cpu_switch_mm(mm->pgd, mm);
-- local_flush_bp_all();
-- local_flush_tlb_all();
-- }
--
-- return ret;
--}
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 7c15245..73371de 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -64,6 +64,25 @@ config MACH_KOELSCH
- select MICREL_PHY if SH_ETH
- select SND_SOC_AK4642 if SND_SIMPLE_CARD
-
-+config MACH_KOELSCH_FTEN
-+ bool "FTEN spf development environment"
-+ depends on MACH_KOELSCH
-+
-+config MACH_FTEN
-+ bool
-+
-+config MACH_FTEN_DT
-+ bool
-+
-+config MACH_FTEN_M2W
-+ bool "FTEN R-Car M2W board"
-+ depends on ARCH_R8A7791
-+ select MACH_FTEN
-+ select MACH_FTEN_DT
-+ select HAVE_IDE
-+ select FIQ
-+ select SND_SOC_DIRANA3 if SND_SIMPLE_CARD
-+
- config MACH_LAGER
- bool "Lager board"
- depends on ARCH_R8A7790
-@@ -76,6 +95,15 @@ config MACH_GOSE
- select MICREL_PHY if SH_ETH
- select SND_SOC_AK4642 if SND_SIMPLE_CARD
-
-+config MACH_FTEN_M2N
-+ bool "FTEN R-Car M2N board"
-+ depends on ARCH_R8A7793
-+ select MACH_FTEN
-+ select MACH_FTEN_DT
-+ select HAVE_IDE
-+ select FIQ
-+ select SND_SOC_DIRANA3 if SND_SIMPLE_CARD
-+
- config MACH_ALT
- bool "Alt board"
- depends on ARCH_R8A7794
-@@ -287,6 +315,19 @@ config MACH_KOELSCH
- select USE_OF
- select MICREL_PHY if SH_ETH
-
-+config MACH_FTEN
-+ bool "FTEN strawberry board"
-+ depends on ARCH_R8A7791
-+ select USE_OF
-+ select HAVE_IDE
-+
-+config MACH_FTEN_DT
-+ bool "FTEN strawberry board - Device Tree Implementation"
-+ depends on ARCH_R8A7791
-+ select USE_OF
-+ select HAVE_IDE
-+ select SND_SOC_DIRANA3 if SND_SIMPLE_CARD
-+
- config MACH_KZM9G
- bool "KZM-A9-GT board"
- depends on ARCH_SH73A0
-@@ -360,4 +401,28 @@ config EM_TIMER_STI
-
- endmenu
-
-+if HIBERNATION
-+
-+menu "Hibernation area parameters"
-+
-+config SWSUSP_AREA
-+ hex "RAM hibernation area address"
-+ default "0x44000000"
-+ depends on HIBERNATION
-+ ---help---
-+ RAM hibernation area address, this is required for CRC
-+ calculation of final compressed hibernation image
-+
-+config SWSUSP_AREA_SIZE
-+ hex "RAM hibernation area size"
-+ default "0x4000000"
-+ depends on HIBERNATION
-+ ---help---
-+ RAM hibernation area size, this is required for CRC
-+ calculation of final compressed hibernation image
-+
-+endmenu
-+
-+endif
-+
- endif
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 43b4025..71cfcfa 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -55,6 +55,7 @@ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
-
- # PM objects
- obj-$(CONFIG_SUSPEND) += suspend.o
-+obj-$(CONFIG_HIBERNATION) += hibernation.o
- obj-$(CONFIG_CPU_IDLE) += cpuidle.o
- obj-$(CONFIG_CPU_FREQ) += cpufreq.o
- obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
-diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
-index 95a77a0..37c7f87 100644
---- a/arch/arm/mach-shmobile/common.h
-+++ b/arch/arm/mach-shmobile/common.h
-@@ -25,6 +25,7 @@ struct clk;
- extern int shmobile_clk_init(void);
- extern void shmobile_handle_irq_intc(struct pt_regs *);
- extern struct platform_suspend_ops shmobile_suspend_ops;
-+extern const struct platform_hibernation_ops shmobile_hibernation_ops;
- struct cpuidle_driver;
- extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
- extern void shmobile_smp_apmu_enter_cpuidle(void);
-@@ -37,6 +38,12 @@ static inline int shmobile_suspend_init(void) { return 0; }
- static inline void shmobile_smp_apmu_suspend_init(void) { }
- #endif
-
-+#ifdef CONFIG_HIBERNATION
-+int shmobile_hibernation_init(void);
-+#else
-+static inline int shmobile_hibernation_init(void) { return 0; }
-+#endif
-+
- #ifdef CONFIG_CPU_IDLE
- int shmobile_cpuidle_init(void);
- #else
-@@ -59,6 +66,7 @@ extern unsigned int l2actlr_value;
- static inline void __init shmobile_init_late(void)
- {
- shmobile_suspend_init();
-+ shmobile_hibernation_init();
- shmobile_cpuidle_init();
- shmobile_cpufreq_init();
- }
-diff --git a/arch/arm/mach-shmobile/crc32_word4.c b/arch/arm/mach-shmobile/crc32_word4.c
-new file mode 100644
-index 0000000..8aaefc6
---- /dev/null
-+++ b/arch/arm/mach-shmobile/crc32_word4.c
-@@ -0,0 +1,299 @@
-+/*************************************************************************
-+ * crc32_word4.c: rapid CRC32
-+ * Coptright (C) FUJITSUTEN Limited, 2015 All Rights Reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2
-+ * as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *************************************************************************/
-+#ifdef OWNTEST
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <asm/types.h>
-+typedef unsigned int u_int32_t;
-+#else
-+#endif
-+
-+#include "crc32_word4.h"
-+
-+#define CRC_INIT_VALUE (-1)
-+#define CRC_FIX(_crc32) (~(_crc32))
-+
-+/* #define HWDPLS_ENABLE */
-+#define __HWDTPLS_OUT()
-+#define MEASURE(msg)
-+
-+/**** calc_crc32.c *****/
-+
-+/*
-+ * CRC32は、ISO 3309 で規程され
-+ * そのサンプルは
-+ * RFC 2083 :PNG(Poratble Network Graphics
-+ * で公になっています。本プログラムは、RFC2083 で掲示された
-+ * CRC32を独自に最適化したプログラムです。
-+ */
-+const static u_int32_t CRC_Table[256] = {
-+ 0x00000000 , 0x77073096 , 0xee0e612c , 0x990951ba , 0x076dc419 , 0x706af48f , 0xe963a535 , 0x9e6495a3 ,
-+ 0x0edb8832 , 0x79dcb8a4 , 0xe0d5e91e , 0x97d2d988 , 0x09b64c2b , 0x7eb17cbd , 0xe7b82d07 , 0x90bf1d91 ,
-+ 0x1db71064 , 0x6ab020f2 , 0xf3b97148 , 0x84be41de , 0x1adad47d , 0x6ddde4eb , 0xf4d4b551 , 0x83d385c7 ,
-+ 0x136c9856 , 0x646ba8c0 , 0xfd62f97a , 0x8a65c9ec , 0x14015c4f , 0x63066cd9 , 0xfa0f3d63 , 0x8d080df5 ,
-+ 0x3b6e20c8 , 0x4c69105e , 0xd56041e4 , 0xa2677172 , 0x3c03e4d1 , 0x4b04d447 , 0xd20d85fd , 0xa50ab56b ,
-+ 0x35b5a8fa , 0x42b2986c , 0xdbbbc9d6 , 0xacbcf940 , 0x32d86ce3 , 0x45df5c75 , 0xdcd60dcf , 0xabd13d59 ,
-+ 0x26d930ac , 0x51de003a , 0xc8d75180 , 0xbfd06116 , 0x21b4f4b5 , 0x56b3c423 , 0xcfba9599 , 0xb8bda50f ,
-+ 0x2802b89e , 0x5f058808 , 0xc60cd9b2 , 0xb10be924 , 0x2f6f7c87 , 0x58684c11 , 0xc1611dab , 0xb6662d3d ,
-+ 0x76dc4190 , 0x01db7106 , 0x98d220bc , 0xefd5102a , 0x71b18589 , 0x06b6b51f , 0x9fbfe4a5 , 0xe8b8d433 ,
-+ 0x7807c9a2 , 0x0f00f934 , 0x9609a88e , 0xe10e9818 , 0x7f6a0dbb , 0x086d3d2d , 0x91646c97 , 0xe6635c01 ,
-+ 0x6b6b51f4 , 0x1c6c6162 , 0x856530d8 , 0xf262004e , 0x6c0695ed , 0x1b01a57b , 0x8208f4c1 , 0xf50fc457 ,
-+ 0x65b0d9c6 , 0x12b7e950 , 0x8bbeb8ea , 0xfcb9887c , 0x62dd1ddf , 0x15da2d49 , 0x8cd37cf3 , 0xfbd44c65 ,
-+ 0x4db26158 , 0x3ab551ce , 0xa3bc0074 , 0xd4bb30e2 , 0x4adfa541 , 0x3dd895d7 , 0xa4d1c46d , 0xd3d6f4fb ,
-+ 0x4369e96a , 0x346ed9fc , 0xad678846 , 0xda60b8d0 , 0x44042d73 , 0x33031de5 , 0xaa0a4c5f , 0xdd0d7cc9 ,
-+ 0x5005713c , 0x270241aa , 0xbe0b1010 , 0xc90c2086 , 0x5768b525 , 0x206f85b3 , 0xb966d409 , 0xce61e49f ,
-+ 0x5edef90e , 0x29d9c998 , 0xb0d09822 , 0xc7d7a8b4 , 0x59b33d17 , 0x2eb40d81 , 0xb7bd5c3b , 0xc0ba6cad ,
-+ 0xedb88320 , 0x9abfb3b6 , 0x03b6e20c , 0x74b1d29a , 0xead54739 , 0x9dd277af , 0x04db2615 , 0x73dc1683 ,
-+ 0xe3630b12 , 0x94643b84 , 0x0d6d6a3e , 0x7a6a5aa8 , 0xe40ecf0b , 0x9309ff9d , 0x0a00ae27 , 0x7d079eb1 ,
-+ 0xf00f9344 , 0x8708a3d2 , 0x1e01f268 , 0x6906c2fe , 0xf762575d , 0x806567cb , 0x196c3671 , 0x6e6b06e7 ,
-+ 0xfed41b76 , 0x89d32be0 , 0x10da7a5a , 0x67dd4acc , 0xf9b9df6f , 0x8ebeeff9 , 0x17b7be43 , 0x60b08ed5 ,
-+ 0xd6d6a3e8 , 0xa1d1937e , 0x38d8c2c4 , 0x4fdff252 , 0xd1bb67f1 , 0xa6bc5767 , 0x3fb506dd , 0x48b2364b ,
-+ 0xd80d2bda , 0xaf0a1b4c , 0x36034af6 , 0x41047a60 , 0xdf60efc3 , 0xa867df55 , 0x316e8eef , 0x4669be79 ,
-+ 0xcb61b38c , 0xbc66831a , 0x256fd2a0 , 0x5268e236 , 0xcc0c7795 , 0xbb0b4703 , 0x220216b9 , 0x5505262f ,
-+ 0xc5ba3bbe , 0xb2bd0b28 , 0x2bb45a92 , 0x5cb36a04 , 0xc2d7ffa7 , 0xb5d0cf31 , 0x2cd99e8b , 0x5bdeae1d ,
-+ 0x9b64c2b0 , 0xec63f226 , 0x756aa39c , 0x026d930a , 0x9c0906a9 , 0xeb0e363f , 0x72076785 , 0x05005713 ,
-+ 0x95bf4a82 , 0xe2b87a14 , 0x7bb12bae , 0x0cb61b38 , 0x92d28e9b , 0xe5d5be0d , 0x7cdcefb7 , 0x0bdbdf21 ,
-+ 0x86d3d2d4 , 0xf1d4e242 , 0x68ddb3f8 , 0x1fda836e , 0x81be16cd , 0xf6b9265b , 0x6fb077e1 , 0x18b74777 ,
-+ 0x88085ae6 , 0xff0f6a70 , 0x66063bca , 0x11010b5c , 0x8f659eff , 0xf862ae69 , 0x616bffd3 , 0x166ccf45 ,
-+ 0xa00ae278 , 0xd70dd2ee , 0x4e048354 , 0x3903b3c2 , 0xa7672661 , 0xd06016f7 , 0x4969474d , 0x3e6e77db ,
-+ 0xaed16a4a , 0xd9d65adc , 0x40df0b66 , 0x37d83bf0 , 0xa9bcae53 , 0xdebb9ec5 , 0x47b2cf7f , 0x30b5ffe9 ,
-+ 0xbdbdf21c , 0xcabac28a , 0x53b39330 , 0x24b4a3a6 , 0xbad03605 , 0xcdd70693 , 0x54de5729 , 0x23d967bf ,
-+ 0xb3667a2e , 0xc4614ab8 , 0x5d681b02 , 0x2a6f2b94 , 0xb40bbe37 , 0xc30c8ea1 , 0x5a05df1b , 0x2d02ef8d ,
-+};
-+
-+/***
-+ * CRC Table creater.
-+ *
-+void make_crc_table(void) {
-+ u_int32_t c;
-+ u_int32_t n, k;
-+ for (n = 0; n < 256; n++)
-+ {
-+ c = (u_int32_t) n;
-+ for (k = 0; k < 8; k++)
-+ {
-+ if (c & 1)
-+ c = 0xedb88320L ^ (c >> 1);
-+ else
-+ c = c >> 1;
-+ }
-+ CRC_Table[n] = c;
-+ }
-+}
-+***/
-+#define NEXT_PTR (4)
-+
-+static __inline__
-+u_int32_t _update_crc(u_int32_t crc, unsigned char *buf, size_t len)
-+{
-+ u_int32_t c = crc;
-+ size_t n;
-+ for (n = 0; n < len; n++)
-+ c = CRC_Table[(c ^ buf[n]) & 0xff] ^ (c >> 8);
-+ return c;
-+}
-+/*********************************************************************
-+ * update_crc4x4()()
-+ * calc_crc32() をベースに、4 ワード毎に個別に CRC32 を計算する方法
-+ *
-+ * +0 +1 +2 +3
-+ * +0x00 AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-+ * +0x04 EEEEEEEE FFFFFFFF 00000000 11111111
-+ * : : : :
-+ * CRC32 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
-+ *
-+ *********************************************************************/
-+
-+static __inline__
-+void update_crc4x4(u_int32_t crc[4], unsigned char *buf)
-+{
-+ u_int32_t c1, c2, c3, c4;
-+ u_int32_t *p = (void *)buf;
-+
-+ c1 = crc[0] ^ p[0];
-+ c2 = crc[1] ^ p[1];
-+ c3 = crc[2] ^ p[2];
-+ c4 = crc[3] ^ p[3];
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ c1 = CRC_Table[c1 & 0xff] ^ (c1 >> 8);
-+ c2 = CRC_Table[c2 & 0xff] ^ (c2 >> 8);
-+ c3 = CRC_Table[c3 & 0xff] ^ (c3 >> 8);
-+ c4 = CRC_Table[c4 & 0xff] ^ (c4 >> 8);
-+
-+ crc[0] = c1;
-+ crc[1] = c2;
-+ crc[2] = c3;
-+ crc[3] = c4;
-+}
-+
-+
-+void calc_crc32x4(unsigned char *buf, size_t len, CRC32_WORD4_t *result)
-+{
-+ unsigned int crc_tmp[4] = {CRC_INIT_VALUE, CRC_INIT_VALUE, CRC_INIT_VALUE, CRC_INIT_VALUE};
-+ u_int32_t i;
-+ int res;
-+ u_int32_t n4;
-+ int xlen = len;
-+#ifdef HWDPLS_ENABLE
-+ unsigned long plstout = 60;
-+ unsigned long plsstart = 0;
-+ if ((unsigned long)CONFIG_SYS_HZ > 100000)
-+ plstout *= (unsigned long)CONFIG_SYS_HZ / 1000;
-+ else
-+ plstout = DIV_ROUND_UP(plstout * (unsigned long)CONFIG_SYS_HZ, 1000);
-+#endif
-+
-+ /**
-+ * 4バイト境界に合わない開始アドレスの場合
-+ * 境界までのCRCを crc_tmp[0] に求める。
-+ */
-+ if ((unsigned long)buf & 3) {
-+ crc_tmp[0] = _update_crc(crc_tmp[0], buf, (unsigned long)buf & 3);
-+ buf = (unsigned char *)((unsigned long)buf & ~3);
-+ xlen -= (unsigned long)buf & 3;
-+ }
-+
-+ n4 = xlen/(NEXT_PTR*4);
-+ /**
-+ * 4バイト境界に合わない開始アドレスの場合
-+ * 境界までのCRCを crc_tmp[0] に求める。
-+ */
-+#ifdef HWDPLS_ENABLE
-+ reset_timer();
-+ plsstart = get_timer(0);
-+#endif
-+ for (i = 0; i < n4; i++) {
-+ update_crc4x4(crc_tmp, buf);
-+ buf += NEXT_PTR * 4;
-+#ifdef HWDPLS_ENABLE
-+ /**
-+ * WDを考慮
-+ */
-+ if (__builtin_expect((int)((i & 0x1f) == 0), 0)) {
-+ if ((get_timer(plsstart)) > plstout) {
-+ __HWDTPLS_OUT();
-+ MEASURE("crc plsout")
-+ plsstart += plstout;
-+ }
-+ }
-+#endif /*HWPLS_ENABLE*/
-+ }
-+
-+ res = xlen % (NEXT_PTR * 4);
-+ if (res > 0)
-+ crc_tmp[3] = _update_crc(crc_tmp[3], buf, res);
-+
-+ result->crc_w[0] = CRC_FIX(crc_tmp[0]);
-+ result->crc_w[1] = CRC_FIX(crc_tmp[1]);
-+ result->crc_w[2] = CRC_FIX(crc_tmp[2]);
-+ result->crc_w[3] = CRC_FIX(crc_tmp[3]);
-+
-+ MEASURE("calc_crc32x4 finish")
-+}
-+
-+#if defined(OWNTEST)
-+#define BUFSIZE (2 * 1024 * 1024)
-+#include <sys/time.h>
-+#include <malloc.h>
-+
-+int main()
-+{
-+ unsigned char *buf, *buf2;
-+ struct timeval start, end;
-+ unsigned long long diff;
-+ int i;
-+
-+ CRC32_WORD4_t result = { .crc_w = {0, 0, 0, 0 } };
-+ CRC32_WORD4_t result2 = { .crc_w = {0, 0, 0, 0 } };
-+
-+ buf = malloc(BUFSIZE);
-+ if (!buf) {
-+ perror("malloc");
-+ return 1;
-+ }
-+ printf("Generate %dMB random data..\n", BUFSIZE / 1024 / 1024);
-+ srand(0);
-+ for (i = 0; i < BUFSIZE / 4; i++)
-+ ((int *)buf)[i] = rand();
-+
-+ /* Memory dup */
-+ buf2 = memalign(NEXT_PTR, BUFSIZE);
-+ if (!buf2) {
-+ perror("malloc");
-+ return 1;
-+ }
-+ memcpy(buf2, buf, BUFSIZE);
-+
-+
-+ gettimeofday(&start, NULL);
-+ calc_crc32x4(buf, BUFSIZE, &result);
-+ gettimeofday(&end, NULL);
-+
-+ diff = (end.tv_sec - start.tv_sec) * 1000000;
-+ diff += end.tv_usec - start.tv_usec;
-+
-+ printf("time=%lluus\n", diff);
-+ printf(" result.word[0] = %x\n", result.crc_w[0]);
-+ printf(" result.word[1] = %x\n", result.crc_w[1]);
-+ printf(" result.word[2] = %x\n", result.crc_w[2]);
-+ printf(" result.word[3] = %x\n", result.crc_w[3]);
-+
-+ /* Broken test */
-+#if 0 /* Destory test */
-+ buf[rand() % BUFSIZE] ^= 1 << (rand()%7);
-+#endif
-+ for (i = 0; i < BUFSIZE; i++) {
-+ if (buf[i] != buf2[i])
-+ printf("buf[%d] %02x : %02x\n", i, buf[i], buf2[i]);
-+ }
-+
-+ gettimeofday(&start, NULL);
-+ calc_crc32x4(buf, BUFSIZE, &result2);
-+ gettimeofday(&end, NULL);
-+
-+ diff = (end.tv_sec - start.tv_sec) * 1000000;
-+ diff += end.tv_usec - start.tv_usec;
-+
-+ printf("time=%lluus\n", diff);
-+ printf(" result.word[0] = %x:%s\n", result2.crc_w[0] ,
-+ result.crc_w[0] == result2.crc_w[0] ? "OK" : "NG");
-+ printf(" result.word[1] = %x:%s\n", result2.crc_w[1] ,
-+ result.crc_w[1] == result2.crc_w[1] ? "OK" : "NG");
-+ printf(" result.word[2] = %x:%s\n", result2.crc_w[2] ,
-+ result.crc_w[2] == result2.crc_w[2] ? "OK" : "NG");
-+ printf(" result.word[3] = %x:%s\n", result2.crc_w[3] ,
-+ result.crc_w[3] == result2.crc_w[3] ? "OK" : "NG");
-+ return 0;
-+}
-+#endif /* TEST */
-diff --git a/arch/arm/mach-shmobile/crc32_word4.h b/arch/arm/mach-shmobile/crc32_word4.h
-new file mode 100644
-index 0000000..6c04878
---- /dev/null
-+++ b/arch/arm/mach-shmobile/crc32_word4.h
-@@ -0,0 +1,23 @@
-+/*************************************************************************
-+ * Coptright (C) FUJITSUTEN Limited, 2012 All Rights Reserved.
-+ *
-+ *************************************************************************/
-+#ifndef __CRC32_WORD4_H__
-+#define __CRC32_WORD4_H__
-+
-+typedef struct {
-+ unsigned int crc_w[4];
-+} CRC32_WORD4_t;
-+
-+void calc_crc32x4(unsigned char *buf, size_t len, CRC32_WORD4_t *result);
-+
-+typedef struct {
-+ unsigned int size;
-+ CRC32_WORD4_t chksum;
-+ unsigned int dummy[3];
-+} CRC32_WORD4_TICKET_t;
-+
-+#define IS_CRC_WORD4_OK(_res1, _res2) (!memcmp(_res1, _res2, sizeof(CRC32_WORD4_t)))
-+#define IS_CRC_WORD4_ZERO(_w4) (((_w4)->crc_w[0] == 0) && ((_w4)->crc_w[1] == 0) && ((_w4)->crc_w[2] == 0) && ((_w4)->crc_w[3] == 0))
-+#define IS_CRC_WORD4_ALL_F(_w4) (((_w4)->crc_w[0] == 0xffffffff) && ((_w4)->crc_w[1] == 0xffffffff) && ((_w4)->crc_w[2] == 0xffffffff) && ((_w4)->crc_w[3] == 0xffffffff))
-+#endif
-diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
-index debf271..f99f8b2 100644
---- a/arch/arm/mach-shmobile/headsmp.S
-+++ b/arch/arm/mach-shmobile/headsmp.S
-@@ -16,8 +16,6 @@
- #include <linux/threads.h>
- #include <asm/memory.h>
-
-- __CPUINIT
--
- #ifdef CONFIG_SMP
- ENTRY(shmobile_invalidate_start)
- bl v7_invalidate_l1
-diff --git a/arch/arm/mach-shmobile/hibernation.c b/arch/arm/mach-shmobile/hibernation.c
-new file mode 100644
-index 0000000..94fa78b
---- /dev/null
-+++ b/arch/arm/mach-shmobile/hibernation.c
-@@ -0,0 +1,243 @@
-+/*
-+ * Suspend-to-RAM support code for SH-Mobile ARM
-+ *
-+ * Copyright (C) 2011 Magnus Damm
-+ *
-+ * This file is subject to the terms and conditions of the GNU General Public
-+ * License. See the file "COPYING" in the main directory of this archive
-+ * for more details.
-+ */
-+#include <linux/pm.h>
-+#include <linux/suspend.h>
-+#include <linux/module.h>
-+#include <linux/err.h>
-+#include <linux/cpu.h>
-+#include <linux/smp.h>
-+
-+#include <linux/io.h>
-+#include <asm/system_misc.h>
-+#include <asm/page.h>
-+#include <asm/smp_plat.h>
-+
-+#include "common.h"
-+#include "rcar-gen2.h"
-+
-+#include <linux/clk.h>
-+
-+#include "crc32_word4.c"
-+#include "pm-rcar.h"
-+
-+
-+struct swsusp_header {
-+ char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int) -
-+ sizeof(u32) - sizeof(CRC32_WORD4_t) - sizeof(u32)];
-+ CRC32_WORD4_t comp_crc32;
-+ u32 img_size; /* add. see. kernel/power/swap.c */
-+ u32 crc32;
-+ sector_t image;
-+ unsigned int flags; /* Flags to pass to the "boot" kernel */
-+ char orig_sig[10];
-+ char sig[10];
-+} __packed;
-+static unsigned long swsusp_area = CONFIG_SWSUSP_AREA;
-+static unsigned long swsusp_area_size = CONFIG_SWSUSP_AREA_SIZE;
-+
-+enum {
-+ MSTP00, MSTP01, MSTP02, MSTP03, MSTP04, MSTP05,
-+ MSTP07, MSTP08, MSTP09, MSTP10, MSTP11,
-+ MSTP_NR,
-+};
-+
-+static struct {
-+ u32 s_offset;
-+ u32 s_val;
-+ u32 r_offset;
-+ u32 r_val;
-+} mstp_regs[] = {
-+ [MSTP00] = { SMSTPCR0, 0,
-+ RMSTPCR0, 0},
-+ [MSTP01] = { SMSTPCR1, 0,
-+ RMSTPCR1, 0},
-+ [MSTP02] = { SMSTPCR2, 0,
-+ RMSTPCR2, 0},
-+ [MSTP03] = { SMSTPCR3, 0,
-+ RMSTPCR3, 0},
-+ [MSTP04] = { SMSTPCR4, 0,
-+ RMSTPCR4, 0},
-+ [MSTP05] = { SMSTPCR5, 0,
-+ RMSTPCR5, 0},
-+ [MSTP07] = { SMSTPCR7, 0,
-+ RMSTPCR7, 0},
-+ [MSTP08] = { SMSTPCR8, 0,
-+ RMSTPCR8, 0},
-+ [MSTP09] = { SMSTPCR9, 0,
-+ RMSTPCR9, 0},
-+ [MSTP10] = { SMSTPCR10, 0,
-+ RMSTPCR10, 0},
-+ [MSTP11] = { SMSTPCR11, 0,
-+ RMSTPCR11, 0},
-+};
-+
-+static void save_mstp_regs(void)
-+{
-+ int i;
-+ void *m = ioremap(CPG_BASE, CPG_LEN);
-+ for (i = MSTP00; i < MSTP_NR; i++) {
-+ mstp_regs[i].s_val = ioread32(m +mstp_regs[i].s_offset);
-+ mstp_regs[i].r_val = ioread32(m +mstp_regs[i].r_offset);
-+ }
-+ iounmap(m);
-+}
-+
-+static void restore_mstp_regs(void)
-+{
-+ int i;
-+ void *m = ioremap(CPG_BASE, CPG_LEN);
-+ for (i = MSTP00; i < MSTP_NR; i++) {
-+ iowrite32(mstp_regs[i].s_val, m +mstp_regs[i].s_offset);
-+ iowrite32(mstp_regs[i].r_val, m +mstp_regs[i].r_offset);
-+ }
-+ iounmap(m);
-+}
-+
-+static int shmobile_hibernation_begin(void)
-+{
-+ save_mstp_regs();
-+ return 0;
-+}
-+
-+static void shmobile_hibernation_end(void)
-+{
-+}
-+
-+static int shmobile_hibernation_pre_snapshot(void)
-+{
-+ return 0;
-+}
-+
-+
-+static void shmobile_hibernation_finish(void)
-+{
-+}
-+
-+static int shmobile_hibernation_prepare(void)
-+{
-+ return 0;
-+}
-+
-+static int shmobile_hibernation_enter(void)
-+{
-+ void *m, *l;
-+ struct swsusp_header *h;
-+ unsigned int calc_sz;
-+ if (swsusp_area_size > 0) {
-+ h = m = ioremap(swsusp_area, swsusp_area_size);
-+ if (h) {
-+ if ((h->img_size > PAGE_SIZE)
-+ && (h->img_size < (swsusp_area_size - PAGE_SIZE)))
-+ calc_sz = h->img_size;
-+ else
-+ calc_sz = swsusp_area_size - PAGE_SIZE;
-+ memset(&h->comp_crc32, 0, sizeof(h->comp_crc32));
-+ calc_crc32x4(m + PAGE_SIZE, calc_sz, &h->comp_crc32);
-+ mb();
-+ iounmap(m);
-+ }
-+ }
-+ /* Resetting FDP0 */
-+ l = ioremap(0xfe940000, 0x4000);
-+ writel(1, l + 0x1c);
-+ mb();
-+ iounmap(l);
-+ /* Resetting FDP1 */
-+ l = ioremap(0xfe944000, 0x4000);
-+ writel(1, l + 0x1c);
-+ mb();
-+ iounmap(l);
-+ /* Doing board reset */
-+ l = ioremap(0xe6300200, 4);
-+ writel(0xa1b20001, l);
-+ mb();
-+ iounmap(l);
-+
-+ return 0;
-+}
-+
-+char *clks[] = {
-+ "ehci", "hsusb", "dmal", "dmah", "sys-dmac1",
-+ "sys-dmac0", "ssp", "ssp_dev", "ipmmu_gp",
-+ "audmac0", "audmac1",
-+};
-+
-+static int shmobile_hibernation_pre_restore(void)
-+{
-+ return 0;
-+}
-+
-+
-+static void shmobile_hibernation_restore_cleanup(void)
-+{
-+}
-+
-+extern int in_suspend;
-+
-+static void shmobile_hibernation_leave(void)
-+{
-+ int restore_highmem(void);
-+ struct clk *clk;
-+ unsigned int i;
-+
-+ if (!in_suspend) {
-+#ifdef CONFIG_SMP
-+ if (is_smp())
-+ arch_smp_prepare_cpus(setup_max_cpus);
-+#endif
-+
-+#ifdef CONFIG_HIGHMEM
-+ restore_highmem();
-+#endif
-+ restore_mstp_regs();
-+ }
-+
-+ for (i = 0; i < ARRAY_SIZE(clks); ++i) {
-+ clk = clk_get(NULL, clks[i]);
-+ if (!IS_ERR(clk)) {
-+ clk_prepare_enable(clk);
-+ clk_put(clk);
-+ }
-+ }
-+}
-+
-+const struct platform_hibernation_ops shmobile_hibernation_ops = {
-+ .leave = shmobile_hibernation_leave,
-+ .begin = shmobile_hibernation_begin,
-+ .end = shmobile_hibernation_end,
-+ .pre_snapshot = shmobile_hibernation_pre_snapshot,
-+ .finish = shmobile_hibernation_finish,
-+ .prepare = shmobile_hibernation_prepare,
-+ .enter = shmobile_hibernation_enter,
-+ .pre_restore = shmobile_hibernation_pre_restore,
-+ .restore_cleanup = shmobile_hibernation_restore_cleanup,
-+};
-+
-+int __init shmobile_hibernation_init(void)
-+{
-+ hibernation_set_ops(&shmobile_hibernation_ops);
-+ return 0;
-+}
-+static int setup_swsusp_area(char *s)
-+{
-+ long tmp = 0;
-+ char *p;
-+ if (!kstrtol(s, 0, &tmp) && tmp > 0)
-+ swsusp_area = tmp;
-+ p = strchr(s, ',');
-+ if (!p)
-+ goto out;
-+ if (!kstrtol(p, 0, &tmp) && tmp > 0)
-+ swsusp_area_size = tmp;
-+out:
-+ return 1;
-+}
-+__setup("swsusp_area=", setup_swsusp_area);
-+
-diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
-index cff7a25..e382e26 100644
---- a/arch/arm/mach-shmobile/platsmp-apmu.c
-+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
-@@ -33,7 +33,10 @@
-
- /* only enable the cluster that includes the boot CPU by default */
- static bool enable_multicluster = false;
-+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || \
-+defined(CONFIG_CPU_IDLE)
- static bool is_last_cpu;
-+#endif
-
- static __init int apmu_setup(char *opt)
- {
-@@ -71,12 +74,15 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
- return 0;
- }
-
-+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || \
-+defined(CONFIG_CPU_IDLE)
- static int apmu_power_off(void __iomem *p, int bit)
- {
- /* request Core Standby for next WFI */
- writel_relaxed(3, p + CPUNCR_OFFS(bit));
- return 0;
- }
-+#endif
-
- static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
- {
-@@ -92,12 +98,15 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
- return 0;
- }
-
-+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || \
-+defined(CONFIG_CPU_IDLE) || defined(CONFIG_SMP)
- static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
- {
- void __iomem *p = apmu_cpus[cpu].iomem;
-
- return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
- }
-+#endif
-
- static void apmu_init_cpu(struct resource *res, int cpu, int bit)
- {
-@@ -141,7 +150,7 @@ static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit),
- }
- }
-
--void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
-+void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
- struct rcar_apmu_config *apmu_config,
- int num)
- {
-@@ -328,7 +337,7 @@ static int __cpuinit shmobile_smp_apmu_enter_suspend(suspend_state_t state)
- return 0;
- }
-
--void __init shmobile_smp_apmu_suspend_init(void)
-+void shmobile_smp_apmu_suspend_init(void)
- {
- cpucmcr_ca7 = ioremap_nocache(CPUCMCR_CA7, 0x4);
- cpucmcr_ca15 = ioremap_nocache(CPUCMCR_CA15, 0x4);
-diff --git a/arch/arm/mach-shmobile/platsmp-rst.c b/arch/arm/mach-shmobile/platsmp-rst.c
-index 70a2b6c..7ba9eeb 100644
---- a/arch/arm/mach-shmobile/platsmp-rst.c
-+++ b/arch/arm/mach-shmobile/platsmp-rst.c
-@@ -11,8 +11,7 @@
- #include <linux/io.h>
- #include <asm/smp_plat.h>
- #include <mach/platsmp-rst.h>
--
--#define RST 0xe6160000
-+#include "rcar-gen2.h"
-
- #define r8a779x_clst_id(cpu) (cpu_logical_map((cpu)) >> 8)
- #define r8a779x_cpu_id(cpu) (cpu_logical_map((cpu)) & 0xff)
-diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
-index f0ed98c..a13da84 100644
---- a/arch/arm/mach-shmobile/pm-r8a7791.c
-+++ b/arch/arm/mach-shmobile/pm-r8a7791.c
-@@ -21,16 +21,9 @@
- #include <asm/io.h>
- #include "common.h"
- #include "pm-rcar.h"
-+#include "rcar-gen2.h"
- #include "r8a7791.h"
-
--#define RST 0xe6160000
--#define CA15BAR 0x0020
--#define RAM 0xe63c0000
--
--/* SYSC */
--#define SYSCIER 0x0c
--#define SYSCIMR 0x10
--
- struct r8a7791_pm_domain {
- struct generic_pm_domain genpd;
- struct rcar_sysc_ch ch;
-@@ -43,13 +36,14 @@ static inline struct rcar_sysc_ch *to_r8a7791_ch(struct generic_pm_domain *d)
-
- #if defined(CONFIG_PM) || defined(CONFIG_SMP)
-
--static void __init r8a7791_sysc_init(void)
-+static void r8a7791_sysc_init(void)
- {
-- void __iomem *base = rcar_sysc_init(0xe6180000);
-+ void __iomem *base = rcar_sysc_init(SYSC_BASE);
-
- /* enable all interrupt sources, but do not use interrupt handler */
- iowrite32(0x0131000e, base + SYSCIER);
-- iowrite32(0, base + SYSCIMR);
-+ /* keep reserved bits as they are in TRM */
-+ iowrite32(0x012001ec, base + SYSCIMR);
- }
-
- #else /* CONFIG_PM || CONFIG_SMP */
-@@ -60,9 +54,6 @@ static inline void r8a7791_sysc_init(void) {}
-
- #ifdef CONFIG_PM
-
--#define CPG_BASE 0xe6150000
--#define CPG_LEN 0x1000
--
- /* Software Reset */
- #define SRCR0 0x00a0
- #define SRCR1 0x00a8
-@@ -243,14 +234,10 @@ static struct notifier_block platform_nb = {
-
- #endif /* CONFIG_PM */
-
--void __init r8a7791_pm_init(void)
-+void r8a7791_pm_init(void)
- {
- void __iomem *p;
- u32 bar;
-- static int once;
--
-- if (once++)
-- return;
-
- /* RAM for jump stub, because BAR requires 256KB aligned address */
- p = ioremap_nocache(RAM, shmobile_boot_size);
-@@ -258,7 +245,7 @@ void __init r8a7791_pm_init(void)
- iounmap(p);
-
- /* setup reset vectors */
-- p = ioremap_nocache(RST, 0x63);
-+ p = ioremap_nocache(RST, RST_LEN);
- bar = (RAM >> 8) & 0xfffffc00;
- writel_relaxed(bar, p + CA15BAR);
- writel_relaxed(bar | 0x10, p + CA15BAR);
-diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
-index ce53cb5..df7201a 100644
---- a/arch/arm/mach-shmobile/rcar-gen2.h
-+++ b/arch/arm/mach-shmobile/rcar-gen2.h
-@@ -1,6 +1,45 @@
- #ifndef __ASM_RCAR_GEN2_H__
- #define __ASM_RCAR_GEN2_H__
-
-+#define CPG_BASE 0xe6150000
-+#define CPG_LEN 0x1000
-+#define RMSTPCR0 0x110
-+#define RMSTPCR1 0x114
-+#define RMSTPCR2 0x118
-+#define RMSTPCR3 0x11c
-+#define RMSTPCR4 0x120
-+#define RMSTPCR5 0x124
-+#define RMSTPCR7 0x12c
-+#define RMSTPCR8 0x980
-+#define RMSTPCR9 0x984
-+#define RMSTPCR10 0x988
-+#define RMSTPCR11 0x98c
-+#define SMSTPCR0 0x130
-+#define SMSTPCR1 0x134
-+#define SMSTPCR2 0x138
-+#define SMSTPCR3 0x13c
-+#define SMSTPCR4 0x140
-+#define SMSTPCR5 0x144
-+#define SMSTPCR7 0x14c
-+#define SMSTPCR8 0x990
-+#define SMSTPCR9 0x994
-+#define SMSTPCR10 0x998
-+#define SMSTPCR11 0x99c
-+
-+#define SYSC_BASE 0xe6180000
-+#define SYSCIER 0x0c
-+#define SYSCIMR 0x10
-+
-+#define RST 0xe6160000
-+#define RST_LEN 0x64
-+
-+#define CA15BAR 0x0020
-+#define CA7BAR 0x0030
-+#define RAM 0xe63c0000
-+
-+#define CNTCR 0
-+#define CNTFID0 0x20
-+
- void rcar_gen2_timer_init(void);
- #define MD(nr) BIT(nr)
- u32 rcar_gen2_read_mode_pins(void);
-diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
-index 2aa431a..c48c6a9 100644
---- a/arch/arm/mach-shmobile/setup-r8a7791.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
-@@ -29,6 +29,7 @@
- #include <linux/sh_timer.h>
- #include <linux/spi/sh_msiof.h>
- #include <asm/mach/arch.h>
-+#include <asm/smp_plat.h>
-
- #include "common.h"
- #include "dma-register.h"
-@@ -243,8 +244,6 @@ static const struct resource powervr_resources[] __initconst = {
- powervr_resources, \
- ARRAY_SIZE(powervr_resources))
-
--#define CPG_BASE 0xe6150000
--#define CPG_LEN 0x1000
- #define RGXCR 0x0B4
-
- void __init r8a7791_register_pvrsrvkm(void)
-@@ -271,7 +270,12 @@ void __init r8a7791_register_ssp(void)
-
- void __init r8a7791_add_dt_devices(void)
- {
-- r8a7791_pm_init();
-+#ifdef CONFIG_SMP
-+ /* In case of SMP config pm_init already called from smp_prepare_cpus.
-+ * It is still needed to call pm_init if 'nosmp' was given */
-+ if (!setup_max_cpus)
-+#endif
-+ r8a7791_pm_init();
- r8a7791_init_pm_domains();
- r8a7791_register_cmt(00);
- r8a7791_register_pvrsrvkm();
-diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
-index da16ebd..641ee1d 100644
---- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
-+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
-@@ -47,9 +47,6 @@ u32 rcar_gen2_read_mode_pins(void)
- return mode;
- }
-
--#define CNTCR 0
--#define CNTFID0 0x20
--
- void __init rcar_gen2_timer_init(void)
- {
- #if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK)
-@@ -58,7 +55,7 @@ void __init rcar_gen2_timer_init(void)
- #ifdef CONFIG_ARM_ARCH_TIMER
- void __iomem *base;
- int extal_mhz = 0;
-- u32 freq;
-+ u32 rcar_gen2_archtimer_freq;
-
- /* At Linux boot time the r8a7790 arch timer comes up
- * with the counter disabled. Moreover, it may also report
-@@ -83,7 +80,7 @@ void __init rcar_gen2_timer_init(void)
- }
-
- /* The arch timer frequency equals EXTAL / 2 */
-- freq = extal_mhz * (1000000 / 2);
-+ rcar_gen2_archtimer_freq = extal_mhz * (1000000 / 2);
-
- /* Remap "armgcnt address map" space */
- base = ioremap(0xe6080000, PAGE_SIZE);
-@@ -96,10 +93,11 @@ void __init rcar_gen2_timer_init(void)
- */
-
- if ((ioread32(base + CNTCR) & 1) == 0 ||
-- ioread32(base + CNTFID0) != freq) {
-+ ioread32(base + CNTFID0) != rcar_gen2_archtimer_freq) {
- /* Update registers with correct frequency */
-- iowrite32(freq, base + CNTFID0);
-- asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
-+ iowrite32(rcar_gen2_archtimer_freq, base + CNTFID0);
-+ asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"
-+ (rcar_gen2_archtimer_freq));
-
- /* make sure arch timer is started by setting bit 0 of CNTCR */
- iowrite32(1, base + CNTCR);
-diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
-index 24cad9f..4583cb6 100644
---- a/arch/arm/mach-shmobile/smp-r8a7791.c
-+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
-@@ -33,6 +33,11 @@
-
- #define CA15RESCNT 0x0040
-
-+static struct rcar_sysc_ch r8a7791_ca15_scu = {
-+ .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
-+ .isr_bit = 12, /* CA15-SCU */
-+};
-+
- static struct rcar_apmu_config r8a7791_apmu_config[] = {
- {
- .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
-@@ -47,7 +52,7 @@ static struct rcar_rst_config r8a7791_rst_config[] = {
- }
- };
-
--static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
-+static void r8a7791_smp_prepare_cpus(unsigned int max_cpus)
- {
- void __iomem *p;
- u32 val;
-@@ -67,6 +72,7 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
- }
-
- r8a7791_pm_init();
-+ rcar_sysc_power_up(&r8a7791_ca15_scu);
-
- /* keep secondary CPU cores in reset */
- r8a779x_init_reset(r8a7791_rst_config);
-diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
-index 19da841..35c9048 100644
---- a/arch/arm/mm/proc-v7.S
-+++ b/arch/arm/mm/proc-v7.S
-@@ -92,48 +92,59 @@ ENDPROC(cpu_v7_dcache_clean_area)
-
- /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
- .globl cpu_v7_suspend_size
--.equ cpu_v7_suspend_size, 4 * 8
-+.equ cpu_v7_suspend_size, 4 * 9
- #ifdef CONFIG_ARM_CPU_SUSPEND
- ENTRY(cpu_v7_do_suspend)
- stmfd sp!, {r4 - r10, lr}
- mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
- mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID
- stmia r0!, {r4 - r5}
-+#ifdef CONFIG_MMU
- mrc p15, 0, r6, c3, c0, 0 @ Domain ID
-+#ifdef CONFIG_ARM_LPAE
-+ mrrc p15, 1, r5, r7, c2 @ TTB 1
-+#else
- mrc p15, 0, r7, c2, c0, 1 @ TTB 1
-+#endif
- mrc p15, 0, r11, c2, c0, 2 @ TTB control register
-+#endif
- mrc p15, 0, r8, c1, c0, 0 @ Control register
- mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register
- mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control
-- stmia r0, {r6 - r11}
-+ stmia r0, {r5 - r11}
- ldmfd sp!, {r4 - r10, pc}
- ENDPROC(cpu_v7_do_suspend)
-
- ENTRY(cpu_v7_do_resume)
- mov ip, #0
-- mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
- mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
- mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID
- ldmia r0!, {r4 - r5}
- mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
- mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID
-- ldmia r0, {r6 - r11}
-+ ldmia r0, {r5 - r11}
-+#ifdef CONFIG_MMU
-+ mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
- mcr p15, 0, r6, c3, c0, 0 @ Domain ID
--#ifndef CONFIG_ARM_LPAE
-+#ifdef CONFIG_ARM_LPAE
-+ mcrr p15, 0, r1, ip, c2 @ TTB 0
-+ mcrr p15, 1, r5, r7, c2 @ TTB 1
-+#else
- ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP)
- ALT_UP(orr r1, r1, #TTB_FLAGS_UP)
--#endif
- mcr p15, 0, r1, c2, c0, 0 @ TTB 0
- mcr p15, 0, r7, c2, c0, 1 @ TTB 1
-+#endif
- mcr p15, 0, r11, c2, c0, 2 @ TTB control register
-- mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register
-- teq r4, r9 @ Is it already set?
-- mcrne p15, 0, r9, c1, c0, 1 @ No, so write it
-- mcr p15, 0, r10, c1, c0, 2 @ Co-processor access control
- ldr r4, =PRRR @ PRRR
- ldr r5, =NMRR @ NMRR
- mcr p15, 0, r4, c10, c2, 0 @ write PRRR
- mcr p15, 0, r5, c10, c2, 1 @ write NMRR
-+#endif /* CONFIG_MMU */
-+ mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register
-+ teq r4, r9 @ Is it already set?
-+ mcrne p15, 0, r9, c1, c0, 1 @ No, so write it
-+ mcr p15, 0, r10, c1, c0, 2 @ Co-processor access control
- isb
- dsb
- mov r0, r8 @ control register
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch
deleted file mode 100644
index 2ef1129ce..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 175a91f2068c5cb4a9be5aa1ea5f1e24e2919bbb Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:13:59 +0900
-Subject: [PATCH 2/3] Fix Black blink correction of display
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 1 +
- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 1 +
- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 13 ++++---------
- drivers/gpu/drm/rcar-du/rcar_du_group.c | 4 ++--
- 4 files changed, 8 insertions(+), 11 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index 262d8a8d..ab3bb09 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -1027,4 +1027,5 @@ void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable)
- } else {
- rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE);
- }
-+ rcrtc->vblank_enable = enable;
- }
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-index 6cdd02e6..19c0d69 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-@@ -49,6 +49,7 @@ struct rcar_du_crtc {
- int lif_enable;
- void *vpsd_handle;
- #endif
-+ bool vblank_enable;
- };
-
- #define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-index fbb212c..f83501d 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-@@ -517,7 +517,7 @@ static int rcar_du_pm_resume(struct device *dev)
-
- return 0;
- }
--#ifdef CONFIG_MACH_FTEN
-+
- static int rcar_du_pm_freeze(struct device *dev)
- {
- int ret;
-@@ -546,18 +546,13 @@ static int rcar_du_pm_restore(struct device *dev)
- return ret;
- }
- #endif
--#endif
-+
- static const struct dev_pm_ops rcar_du_pm_ops = {
--#if defined(CONFIG_MACH_FTEN) && defined(CONFIG_HIBERNATION) && \
-- defined(CONFIG_PM_SLEEP)
-- .suspend = rcar_du_pm_suspend,
-- .resume = rcar_du_pm_resume,
-+ SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume)
-+#ifdef CONFIG_HIBERNATION
- .freeze = rcar_du_pm_freeze,
- .thaw = rcar_du_pm_thaw,
-- .poweroff = rcar_du_pm_suspend,
- .restore = rcar_du_pm_restore,
--#else
-- SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume)
- #endif
- };
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
-index 3620040..0e571d4 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
-@@ -151,8 +151,8 @@ void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start)
- * when the display controller will have to be restarted.
- */
- if (start) {
-- if (rgrp->used_crtcs++ != 0)
-- __rcar_du_group_start_stop(rgrp, false);
-+ rgrp->used_crtcs++;
-+ __rcar_du_group_start_stop(rgrp, false);
- __rcar_du_group_start_stop(rgrp, true);
- } else {
- if (--rgrp->used_crtcs == 0)
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch
deleted file mode 100644
index 5901cc2b1..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 4d35f60f9bd47aebc104d34b9099e8e4f69fa53a Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Fri, 9 Jun 2017 20:15:32 +0900
-Subject: [PATCH 3/3] Add hibernation image area
-
-0x40000000 <-> 0x77FFFFFF : kernel
-0x78000000 <-> 0x7FFFFFFF : hibernation image area
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- arch/arm/boot/dts/r8a7791-porter.dts | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791-porter.dts b/arch/arm/boot/dts/r8a7791-porter.dts
-index b1acf4a..a0e273e 100644
---- a/arch/arm/boot/dts/r8a7791-porter.dts
-+++ b/arch/arm/boot/dts/r8a7791-porter.dts
-@@ -42,7 +42,10 @@
-
- memory@40000000 {
- device_type = "memory";
-- reg = <0 0x40000000 0 0x40000000>;
-+/* reg = <0 0x40000000 0 0x40000000>; */
-+/* 0x40000000 <-> 0x77FFFFFF : kernel */
-+/* 0x78000000 <-> 0x7FFFFFFF : snap */
-+ reg = <0 0x40000000 0 0x38000000>;
- };
-
- memory@200000000 {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-sata-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-sata-hibernation-code.patch
deleted file mode 100755
index fd0dfb66f..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-sata-hibernation-code.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 5d87144a96085d74b6002bd6d8c093c37bf128b7 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:04:33 +0900
-Subject: [PATCH 03/15] Add sata hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/ata/sata_rcar.c | 29 +++++++++++++++++++++++++++++
- 1 file changed, 29 insertions(+)
-
-diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
-index 92abfdd..4c82b5e 100644
---- a/drivers/ata/sata_rcar.c
-+++ b/drivers/ata/sata_rcar.c
-@@ -1003,9 +1003,38 @@ static int sata_rcar_resume(struct device *dev)
- return 0;
- }
-
-+static int sata_rcar_restore(struct device *dev)
-+{
-+ struct ata_host *host = dev_get_drvdata(dev);
-+ struct sata_rcar_priv *priv = host->private_data;
-+ int ret;
-+
-+ clk_prepare_enable(priv->clk);
-+
-+ ret = sata_rcar_setup_port(host);
-+ if (ret)
-+ goto cleanup;
-+
-+ /* initialize host controller */
-+ sata_rcar_init_controller(host);
-+
-+ ata_host_resume(host);
-+
-+ return 0;
-+
-+cleanup:
-+ clk_disable_unprepare(priv->clk);
-+
-+ return ret;
-+}
-+
- static const struct dev_pm_ops sata_rcar_pm_ops = {
- .suspend = sata_rcar_suspend,
- .resume = sata_rcar_resume,
-+ .freeze = sata_rcar_suspend,
-+ .restore = sata_rcar_restore,
-+ .thaw = sata_rcar_resume,
-+ .poweroff = sata_rcar_suspend
- };
- #endif
-
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0004-Add-firmware-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0004-Add-firmware-hibernation-code.patch
deleted file mode 100755
index d0250762e..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0004-Add-firmware-hibernation-code.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 33d4c0afe2a4e39c0afdc993f28a8d2d6228df01 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:31:24 +0900
-Subject: [PATCH 04/15] Add firmware hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/base/firmware_class.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
-index 01e2103..6123148 100644
---- a/drivers/base/firmware_class.c
-+++ b/drivers/base/firmware_class.c
-@@ -1464,6 +1464,7 @@ static int fw_pm_notify(struct notifier_block *notify_block,
- switch (mode) {
- case PM_HIBERNATION_PREPARE:
- case PM_SUSPEND_PREPARE:
-+ case PM_RESTORE_PREPARE:
- device_cache_fw_images();
- break;
-
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0005-Add-rcar-dma-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0005-Add-rcar-dma-hibernation-code.patch
deleted file mode 100755
index b446fa301..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0005-Add-rcar-dma-hibernation-code.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From c094e905cb0f542acdeb5d7009ab9edc812897f7 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:32:30 +0900
-Subject: [PATCH 05/15] Add rcar-dma hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/dma/sh/rcar-dmac.c | 27 +++++++++++++++++++++++++++
- 1 file changed, 27 insertions(+)
-
-diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
-index e5e60ee..3b4a684 100644
---- a/drivers/dma/sh/rcar-dmac.c
-+++ b/drivers/dma/sh/rcar-dmac.c
-@@ -121,6 +121,7 @@ struct rcar_dmac_desc_page {
- * struct rcar_dmac_chan - R-Car Gen2 DMA Controller Channel
- * @chan: base DMA channel object
- * @iomem: channel I/O memory base
-+ * @backup: channel I/O memory backup base
- * @index: index of this channel in the controller
- * @src_xfer_size: size (in bytes) of hardware transfers on the source side
- * @dst_xfer_size: size (in bytes) of hardware transfers on the destination side
-@@ -140,6 +141,7 @@ struct rcar_dmac_desc_page {
- struct rcar_dmac_chan {
- struct dma_chan chan;
- void __iomem *iomem;
-+ void *backup;
- unsigned int index;
-
- unsigned int src_xfer_size;
-@@ -171,6 +173,7 @@ struct rcar_dmac_chan {
- * @engine: base DMA engine object
- * @dev: the hardware device
- * @iomem: remapped I/O memory base
-+ * @backup: remapped I/O memory backup base
- * @n_channels: number of available channels
- * @channels: array of DMAC channels
- * @modules: bitmask of client modules in use
-@@ -179,6 +182,7 @@ struct rcar_dmac {
- struct dma_device engine;
- struct device *dev;
- void __iomem *iomem;
-+ void *backup;
-
- unsigned int n_channels;
- struct rcar_dmac_chan *channels;
-@@ -277,6 +281,7 @@ static void rcar_dmac_write(struct rcar_dmac *dmac, u32 reg, u32 data)
- writew(data, dmac->iomem + reg);
- else
- writel(data, dmac->iomem + reg);
-+ writel(data, dmac->backup + reg);
- }
-
- static u32 rcar_dmac_read(struct rcar_dmac *dmac, u32 reg)
-@@ -301,6 +306,7 @@ static void rcar_dmac_chan_write(struct rcar_dmac_chan *chan, u32 reg, u32 data)
- writew(data, chan->iomem + reg);
- else
- writel(data, chan->iomem + reg);
-+ writel(data, chan->backup + reg);
- }
-
- /* -----------------------------------------------------------------------------
-@@ -1548,10 +1554,25 @@ static int rcar_dmac_runtime_resume(struct device *dev)
- }
- #endif
-
-+static int rcar_dmac_freeze(struct device *dev)
-+{
-+ return 0;
-+}
-+
-+static int rcar_dmac_restore(struct device *dev)
-+{
-+ int ret;
-+ struct rcar_dmac *dmac = dev_get_drvdata(dev);
-+ ret = rcar_dmac_init(dmac);
-+ return ret;
-+}
-+
- static const struct dev_pm_ops rcar_dmac_pm = {
- SET_SYSTEM_SLEEP_PM_OPS(rcar_dmac_sleep_suspend, rcar_dmac_sleep_resume)
- SET_RUNTIME_PM_OPS(rcar_dmac_runtime_suspend, rcar_dmac_runtime_resume,
- NULL)
-+ .freeze = rcar_dmac_freeze,
-+ .restore = rcar_dmac_restore,
- };
-
- /* -----------------------------------------------------------------------------
-@@ -1571,6 +1592,7 @@ static int rcar_dmac_chan_probe(struct rcar_dmac *dmac,
-
- rchan->index = index;
- rchan->iomem = dmac->iomem + RCAR_DMAC_CHAN_OFFSET(index);
-+ rchan->backup = dmac->backup + RCAR_DMAC_CHAN_OFFSET(index);
- rchan->mid_rid = -EINVAL;
-
- spin_lock_init(&rchan->lock);
-@@ -1657,8 +1679,13 @@ static int rcar_dmac_probe(struct platform_device *pdev)
- /* Request resources. */
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- dmac->iomem = devm_ioremap_resource(&pdev->dev, mem);
-+ dmac->backup = devm_kzalloc(&pdev->dev, resource_size(mem), GFP_KERNEL);
- if (IS_ERR(dmac->iomem))
- return PTR_ERR(dmac->iomem);
-+ dmac->backup = devm_kzalloc(&pdev->dev, resource_size(mem), GFP_KERNEL);
-+ if (IS_ERR(dmac->backup)) {
-+ return PTR_ERR(dmac->backup);
-+ }
-
- irq = platform_get_irq_byname(pdev, "error");
- if (irq < 0) {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0006-Add-rcar-du-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0006-Add-rcar-du-hibernation-code.patch
deleted file mode 100755
index 8942ed44e..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0006-Add-rcar-du-hibernation-code.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 4a9a11deb2e83549d2e77cac129f879a0000ef7e Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:33:54 +0900
-Subject: [PATCH 06/15] Add rcar-du hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 68 ++++++++++++++++++++++++++++++++++-
- 1 file changed, 67 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-index 53f1f6a..fbb212c 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-@@ -442,6 +442,15 @@ static int rcar_du_pm_suspend(struct device *dev)
-
- drm_kms_helper_poll_disable(rcdu->ddev);
-
-+#ifdef CONFIG_MACH_FTEN
-+ list_for_each_entry(encoder,
-+ &rcdu->ddev->mode_config.encoder_list, head) {
-+ if ((encoder->encoder_type == DRM_MODE_ENCODER_TVDAC) &&
-+ (get_rcar_slave_funcs(encoder)->dpms))
-+ get_rcar_slave_funcs(encoder)->dpms(encoder,
-+ DRM_MODE_DPMS_SUSPEND);
-+ }
-+#else
- #if defined(CONFIG_DRM_ADV7511) || defined(CONFIG_DRM_ADV7511_MODULE)
- list_for_each_entry(encoder,
- &rcdu->ddev->mode_config.encoder_list, head) {
-@@ -451,6 +460,8 @@ static int rcar_du_pm_suspend(struct device *dev)
- DRM_MODE_DPMS_OFF);
- }
- #endif
-+#endif
-+
- #ifdef CONFIG_DRM_RCAR_LVDS
- for (i = 0; i < rcdu->info->num_lvds; ++i) {
- if (rcdu->lvds[i])
-@@ -483,6 +494,15 @@ static int rcar_du_pm_resume(struct device *dev)
- }
- #endif
-
-+#ifdef CONFIG_MACH_FTEN
-+ list_for_each_entry(encoder,
-+ &rcdu->ddev->mode_config.encoder_list, head) {
-+ if ((encoder->encoder_type == DRM_MODE_ENCODER_TVDAC) &&
-+ (get_rcar_slave_funcs(encoder)->dpms))
-+ get_rcar_slave_funcs(encoder)->dpms(encoder,
-+ DRM_MODE_DPMS_ON);
-+ }
-+#else
- #if defined(CONFIG_DRM_ADV7511) || defined(CONFIG_DRM_ADV7511_MODULE)
- list_for_each_entry(encoder,
- &rcdu->ddev->mode_config.encoder_list, head) {
-@@ -492,14 +512,53 @@ static int rcar_du_pm_resume(struct device *dev)
- DRM_MODE_DPMS_ON);
- }
- #endif
-+#endif
- drm_kms_helper_poll_enable(rcdu->ddev);
-
- return 0;
- }
--#endif
-+#ifdef CONFIG_MACH_FTEN
-+static int rcar_du_pm_freeze(struct device *dev)
-+{
-+ int ret;
-+
-+ ret = rcar_du_pm_suspend(dev);
-+ return ret;
-+}
-+
-+static int rcar_du_pm_thaw(struct device *dev)
-+{
-+ int ret;
-
-+ ret = rcar_du_pm_resume(dev);
-+ return ret;
-+}
-+
-+static int rcar_du_pm_restore(struct device *dev)
-+{
-+ int i, ret;
-+ struct rcar_du_device *rcdu = dev_get_drvdata(dev);
-+
-+ ret = rcar_du_pm_resume(dev);
-+ for (i = 0; i < rcdu->pdata->num_crtcs; ++i)
-+ rcar_du_crtc_enable_vblank(&rcdu->crtcs[i],
-+ rcdu->crtcs[i].vblank_enable);
-+ return ret;
-+}
-+#endif
-+#endif
- static const struct dev_pm_ops rcar_du_pm_ops = {
-+#if defined(CONFIG_MACH_FTEN) && defined(CONFIG_HIBERNATION) && \
-+ defined(CONFIG_PM_SLEEP)
-+ .suspend = rcar_du_pm_suspend,
-+ .resume = rcar_du_pm_resume,
-+ .freeze = rcar_du_pm_freeze,
-+ .thaw = rcar_du_pm_thaw,
-+ .poweroff = rcar_du_pm_suspend,
-+ .restore = rcar_du_pm_restore,
-+#else
- SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume)
-+#endif
- };
-
- /* -----------------------------------------------------------------------------
-@@ -620,6 +679,13 @@ static const struct rcar_du_device_info rcar_du_r8a7791_info = {
- .possible_clones = 0,
- .encoder_type = DRM_MODE_ENCODER_NONE,
- },
-+#if defined(CONFIG_MACH_FTEN)
-+ [RCAR_DU_OUTPUT_COMPOSITE] = {
-+ .possible_crtcs = BIT(1),
-+ .possible_clones = 0,
-+ .encoder_type = DRM_MODE_ENCODER_TVDAC,
-+ },
-+#endif
- },
- .num_lvds = 1,
- .drgbs_bit = 1,
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0007-Add-rcar-i2c-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0007-Add-rcar-i2c-hibernation-code.patch
deleted file mode 100755
index bba1eb401..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0007-Add-rcar-i2c-hibernation-code.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 6c133013b75d88d5b4514dfecb3089f830b82d65 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:35:37 +0900
-Subject: [PATCH 07/15] Add rcar-i2c hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/i2c/busses/i2c-rcar.c | 38 ++++++++++++++++++++++++++++++++++++++
- 1 file changed, 38 insertions(+)
-
-diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
-index 8242002..c6a5a4b 100644
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -754,6 +754,43 @@ static int rcar_i2c_probe(struct platform_device *pdev)
-
- return 0;
- }
-+static int rcar_i2c_suspend(struct device *dev)
-+{
-+ struct platform_device *pdev = to_platform_device(dev);
-+ struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
-+ pr_debug("suspend: i2c adapter name %s", priv->adap.name);
-+ pr_debug("suspend: ICSCR: %08x\n", readl(priv->io + ICSCR));
-+ pr_debug("suspend: ICMCR: %08x\n", readl(priv->io + ICMCR));
-+ pr_debug("suspend: ICSSR: %08x\n", readl(priv->io + ICSSR));
-+ pr_debug("suspend: ICMSR: %08x\n", readl(priv->io + ICMSR));
-+ pr_debug("suspend: ICSIER: %08x\n", readl(priv->io + ICSIER));
-+ pr_debug("suspend: ICMIER: %08x\n", readl(priv->io + ICMIER));
-+ pr_debug("suspend: ICCCR: %08x\n", readl(priv->io + ICCCR));
-+ pr_debug("suspend: ICSAR: %08x\n", readl(priv->io + ICSAR));
-+ pr_debug("suspend: ICMAR: %08x\n", readl(priv->io + ICMAR));
-+ clk_disable(priv->clk);
-+ return 0;
-+}
-+static int rcar_i2c_resume(struct device *dev)
-+{
-+ struct platform_device *pdev = to_platform_device(dev);
-+ struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
-+ clk_enable(priv->clk);
-+ pr_debug("resume: i2c adapter name %s", priv->adap.name);
-+ pr_debug("resume: ICSCR: %08x\n", readl(priv->io + ICSCR));
-+ pr_debug("resume: ICMCR: %08x\n", readl(priv->io + ICMCR));
-+ pr_debug("resume: ICSSR: %08x\n", readl(priv->io + ICSSR));
-+ pr_debug("resume: ICMSR: %08x\n", readl(priv->io + ICMSR));
-+ pr_debug("resume: ICSIER: %08x\n", readl(priv->io + ICSIER));
-+ pr_debug("resume: ICMIER: %08x\n", readl(priv->io + ICMIER));
-+ pr_debug("resume: ICCCR: %08x\n", readl(priv->io + ICCCR));
-+ pr_debug("resume: ICSAR: %08x\n", readl(priv->io + ICSAR));
-+ pr_debug("resume: ICMAR: %08x\n", readl(priv->io + ICMAR));
-+ return 0;
-+}
-+static const struct dev_pm_ops rcar_i2c_pm_ops = {
-+ SET_SYSTEM_SLEEP_PM_OPS(rcar_i2c_suspend, rcar_i2c_resume)
-+};
-
- static int rcar_i2c_remove(struct platform_device *pdev)
- {
-@@ -780,6 +817,7 @@ static struct platform_driver rcar_i2c_driver = {
- .name = "i2c-rcar",
- .owner = THIS_MODULE,
- .of_match_table = rcar_i2c_dt_ids,
-+ .pm = &rcar_i2c_pm_ops,
- },
- .probe = rcar_i2c_probe,
- .remove = rcar_i2c_remove,
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0008-Add-rcar-mmc-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0008-Add-rcar-mmc-hibernation-code.patch
deleted file mode 100755
index 34b40a147..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0008-Add-rcar-mmc-hibernation-code.patch
+++ /dev/null
@@ -1,414 +0,0 @@
-From 9d1d9be70ed3cf6670ae12a1caed337833f7bba8 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:38:11 +0900
-Subject: [PATCH 08/15] Add rcar mmc hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/mmc/host/sh_mmcif.c | 65 +++++++++++++++++++++-
- drivers/mmc/host/sh_mobile_sdhi.c | 112 +++++++++++++++++++++++++++++++++++++-
- drivers/mmc/host/tmio_mmc.h | 1 +
- drivers/mmc/host/tmio_mmc_pio.c | 49 ++++++++++++-----
- 4 files changed, 210 insertions(+), 17 deletions(-)
-
-diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
-index 7290e6e..4ecf62c 100644
---- a/drivers/mmc/host/sh_mmcif.c
-+++ b/drivers/mmc/host/sh_mmcif.c
-@@ -232,6 +232,7 @@ struct sh_mmcif_host {
- struct platform_device *pd;
- struct clk *hclk;
- unsigned int clk;
-+ int clkrate;
- int bus_width;
- unsigned char timing;
- bool sd_error;
-@@ -257,6 +258,8 @@ struct sh_mmcif_host {
- struct dma_chan *chan_tx;
- struct completion dma_complete;
- bool dma_active;
-+#define N_REGS 10
-+ u32 regs[N_REGS];
- };
-
- static inline void sh_mmcif_bitset(struct sh_mmcif_host *host,
-@@ -1457,6 +1460,8 @@ static int sh_mmcif_probe(struct platform_device *pdev)
- }
- }
-
-+ host->clkrate = clk_get_rate(host->hclk);
-+
- ret = sh_mmcif_clk_update(host);
- if (ret < 0)
- goto eclkupdate;
-@@ -1503,6 +1508,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
- dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION);
- dev_dbg(&pdev->dev, "chip ver H'%04x\n",
- sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
-+ device_enable_async_suspend(&pdev->dev);
- return ret;
-
- emmcaddh:
-@@ -1574,15 +1580,68 @@ static int sh_mmcif_suspend(struct device *dev)
- sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
- pm_runtime_put(dev);
-
-- return 0;
-+ return mmc_suspend_host(host->mmc);
- }
-
- static int sh_mmcif_resume(struct device *dev)
- {
-- return 0;
-+ struct sh_mmcif_host *host = dev_get_drvdata(dev);
-+ return mmc_resume_host(host->mmc);
-+}
-+#endif
-+
-+#ifdef CONFIG_PM
-+static int sh_mmcif_restore(struct device *dev)
-+{
-+ struct sh_mmcif_host *host = dev_get_drvdata(dev);
-+ int ret;
-+ ret = clk_set_rate(host->hclk, host->clkrate);
-+ if (ret < 0)
-+ goto eclkupdate;
-+ ret = sh_mmcif_clk_update(host);
-+ if (ret < 0)
-+ goto eclkupdate;
-+ ret = pm_runtime_resume(dev);
-+ if (ret < 0)
-+ goto eresume;
-+ sh_mmcif_sync_reset(host);
-+#ifdef CONFIG_MACH_FTEN
-+ sh_mmcif_writel(host->addr, 0x00000080, 0x00000100);
-+#endif
-+ sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
-+ clk_disable_unprepare(host->hclk);
-+ dev_info(dev, "restore: chip ver H'%04x\n",
-+ sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
-+ sh_mmcif_writel(host->addr, MMCIF_CE_CMD_CTRL, host->regs[0]);
-+ sh_mmcif_writel(host->addr, MMCIF_CE_BLOCK_SET, host->regs[1]);
-+ sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL, host->regs[2]);
-+ sh_mmcif_writel(host->addr, MMCIF_CE_BUF_ACC, host->regs[3]);
-+ sh_mmcif_release_dma(host);
-+ return mmc_resume_host(host->mmc);
-+eclkupdate:
-+ pr_info("Can't set clock\n");
-+ return -EINVAL;
-+eresume:
-+ pr_info("Can't resume PM\n");
-+ return -ENODEV;
- }
-+
-+static int sh_mmcif_freeze(struct device *dev)
-+{
-+ struct sh_mmcif_host *host = dev_get_drvdata(dev);
-+ int ret = mmc_suspend_host(host->mmc);
-+ host->regs[0] = sh_mmcif_readl(host->addr, MMCIF_CE_CMD_CTRL);
-+ host->regs[1] = sh_mmcif_readl(host->addr, MMCIF_CE_BLOCK_SET);
-+ host->regs[2] = sh_mmcif_readl(host->addr, MMCIF_CE_CLK_CTRL);
-+ host->regs[3] = sh_mmcif_readl(host->addr, MMCIF_CE_BUF_ACC);
-+ return ret;
-+}
-+#else
-+#define sh_mmcif_restore NULL
-+#define sh_mmcif_freeze NULL
- #endif
-
-+
- static const struct of_device_id mmcif_of_match[] = {
- { .compatible = "renesas,sh-mmcif" },
- { }
-@@ -1591,6 +1650,8 @@ MODULE_DEVICE_TABLE(of, mmcif_of_match);
-
- static const struct dev_pm_ops sh_mmcif_dev_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(sh_mmcif_suspend, sh_mmcif_resume)
-+ .restore = sh_mmcif_restore,
-+ .freeze = sh_mmcif_freeze,
- };
-
- static struct platform_driver sh_mmcif_driver = {
-diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
-index 1b59cdf..c7f3abf 100644
---- a/drivers/mmc/host/sh_mobile_sdhi.c
-+++ b/drivers/mmc/host/sh_mobile_sdhi.c
-@@ -156,6 +156,8 @@ struct sh_mobile_sdhi {
- struct tmio_mmc_dma dma_priv;
- unsigned int type;
- struct sh_mobile_sdhi_vlt vlt;
-+ int wifi_xrst;
-+ int save_clk_rate;
- };
-
- static int sh_mobile_sdhi_clk_enable(struct platform_device *pdev, unsigned int *f)
-@@ -647,6 +649,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
- if (ret < 0)
- dev_err(&pdev->dev,
- "cannot set clock rate: %d\n", ret);
-+ priv->save_clk_rate = clk_rate;
-
- clk_disable_unprepare(priv->clk);
- }
-@@ -841,6 +844,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
- }
- }
-
-+ device_enable_async_suspend(&pdev->dev);
- dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n",
- mmc_hostname(host->mmc), (unsigned long)
- (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
-@@ -865,17 +869,123 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
- struct mmc_host *mmc = platform_get_drvdata(pdev);
- struct tmio_mmc_host *host = mmc_priv(mmc);
- struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
-+#ifdef CONFIG_MACH_FTEN_DT
-+ int ret;
-+ struct sh_mobile_sdhi *priv = container_of(host->pdata,
-+ struct sh_mobile_sdhi,
-+ mmc_data);
-+#endif
-
- tmio_mmc_host_remove(host);
-
- if (p && p->cleanup)
- p->cleanup(pdev);
-
-+#ifdef CONFIG_MACH_FTEN_DT
-+ ret = gpio_request(priv->wifi_xrst, "sh_mobile_sdhi");
-+ if (ret != 0) {
-+ dev_err(&pdev->dev,
-+ "gpio_request(%d) failed(%d) remove\n",
-+ priv->wifi_xrst, ret);
-+ goto skip_wifi;
-+ }
-+ ret = gpio_direction_output(priv->wifi_xrst, 0);
-+ if (ret != 0) {
-+ dev_err(&pdev->dev,
-+ "gpio_direction_output(%d) failed(%d) remove\n",
-+ priv->wifi_xrst, ret);
-+ }
-+ gpio_free(priv->wifi_xrst);
-+skip_wifi:
-+#endif
-+
-+ return 0;
-+}
-+
-+static int sh_mobile_sdhi_restore_noirq(struct device *dev)
-+{
-+ struct mmc_host *mmc = dev_get_drvdata(dev);
-+ struct tmio_mmc_host *host = mmc_priv(mmc);
-+
-+ sd_ctrl_write32(host, CTL_IRQ_MASK, 0x8b7f031d);
-+ sd_ctrl_write32(host, CTL_STATUS, 0);
-+#if 0
-+ sh_mobile_sdhi_enable_sdbuf_acc32(host, false);
-+ /* FIXME - should we set stop clock reg here */
-+ sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);
-+ /* implicit BUG_ON(!res) */
-+ if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
-+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
-+ msleep(2);
-+ sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
-+ if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
-+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
-+ msleep(2);
-+ sd_ctrl_write32(host, CTL_IRQ_MASK, 0x8b7f031d);
-+ sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0040);
-+ sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80E0);
-+ sd_ctrl_write16(host, CTL_DMA_ENABLE, 0x1002);
-+#endif
-+ return 0;
-+}
-+
-+static int sh_mobile_sdhi_restore(struct device *dev)
-+{
-+ struct mmc_host *mmc = dev_get_drvdata(dev);
-+ struct tmio_mmc_host *host = mmc_priv(mmc);
-+ struct sh_mobile_sdhi *priv = container_of(host->pdata,
-+ struct sh_mobile_sdhi,
-+ mmc_data);
-+#if defined(CONFIG_MACH_FTEN_DT) || defined(CONFIG_PM_SLEEP)
-+ int ret;
-+#endif
-+ int dma_size;
-+ host->restore = true;
-+
-+#ifdef CONFIG_MACH_FTEN_DT
-+ /* priv->wifi_xrst is 0 or more. */
-+ if (priv->wifi_xrst >= 0) {
-+ ret = gpio_request(priv->wifi_xrst, "sh_mobile_sdhi");
-+ if (ret != 0) {
-+ dev_err(dev, "gpio_request(%d) failed(%d) restore\n",
-+ priv->wifi_xrst, ret);
-+ goto skip_wifi;
-+ }
-+ ret = gpio_direction_output(priv->wifi_xrst, 1);
-+ if (ret != 0) {
-+ dev_err(dev, "gpio_direction_output(%d) failed(%d) restore\n",
-+ priv->wifi_xrst, ret);
-+ }
-+ gpio_free(priv->wifi_xrst);
-+ }
-+skip_wifi:
-+#endif
-+
-+ dma_size = sh_mobile_sdhi_get_xmit_size(priv->type,
-+ priv->dma_priv.alignment_shift);
-+
-+ sd_ctrl_write16(host, SD_DMACR(priv->type), dma_size);
-+
-+#ifdef CONFIG_PM_SLEEP
-+ ret = tmio_mmc_host_resume(dev);
-+ host->restore = false;
-+ return ret;
-+#else
-+ host->restore = false;
- return 0;
-+#endif
- }
-
- static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
-- SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_host_suspend, tmio_mmc_host_resume)
-+#ifdef CONFIG_PM_SLEEP
-+ .suspend = tmio_mmc_host_suspend,
-+ .resume = tmio_mmc_host_resume,
-+ .freeze = tmio_mmc_host_suspend,
-+ .thaw = tmio_mmc_host_resume,
-+ .poweroff = tmio_mmc_host_suspend,
-+#endif
-+ .restore = sh_mobile_sdhi_restore,
-+ .restore_noirq = sh_mobile_sdhi_restore_noirq,
- SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
- tmio_mmc_host_runtime_resume,
- NULL)
-diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
-index c5b12ad..3efe03d 100644
---- a/drivers/mmc/host/tmio_mmc.h
-+++ b/drivers/mmc/host/tmio_mmc.h
-@@ -104,6 +104,7 @@ struct tmio_mmc_host {
- bool resuming;
- bool done_tuning;
- struct completion completion;
-+ bool restore;
- };
-
- int tmio_mmc_host_probe(struct tmio_mmc_host **host,
-diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
-index 09c0c08..514af15 100644
---- a/drivers/mmc/host/tmio_mmc_pio.c
-+++ b/drivers/mmc/host/tmio_mmc_pio.c
-@@ -167,8 +167,20 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
- if (host->set_clk_div)
- host->set_clk_div(host->pdev, (clk>>22) & 1);
-
-+#ifdef CONFIG_MACH_FTEN
-+ clk |= sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL) & 0x0100;
-+ if (host->pdata->flags & TMIO_MMC_SDCLK_AUTO_CONTROL &&
-+ new_clock > host->mmc->f_init)
-+ clk |= SDCLKOFFEN;
-+ dev_dbg(&host->pdev->dev,
-+ "clock=%d, clk=%08x, new_clock=%d, f_init=%d\n",
-+ clock, clk, new_clock, host->mmc->f_init);
-+ sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x3ff);
-+#else
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff);
-- msleep(10);
-+#endif
-+ if (!host->restore)
-+ msleep(2);
- }
-
- static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
-@@ -176,13 +188,15 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
- /* implicit BUG_ON(!res) */
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
-- if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP))
-+ if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP)
-+ && !host->restore)
- msleep(10);
- }
-
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &
- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
-- if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP))
-+ if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP)
-+ && !host->restore)
- msleep(10);
- }
-
-@@ -190,14 +204,16 @@ static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
- {
- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
-- if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP))
-- msleep(10);
-+ if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP)
-+ && !host->restore)
-+ msleep(2);
-
- /* implicit BUG_ON(!res) */
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
-- if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP))
-- msleep(10);
-+ if (!(host->pdata->flags & TMIO_MMC_CLK_NO_SLEEP)
-+ && !host->restore)
-+ msleep(2);
- }
- }
-
-@@ -208,11 +224,11 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
- /* implicit BUG_ON(!res) */
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);
-- msleep(10);
-+ msleep(2);
- sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
- if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
-- msleep(10);
-+ msleep(2);
- }
-
- static void tmio_mmc_reset_work(struct work_struct *work)
-@@ -1134,16 +1150,21 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
- * is kept positive, so no suspending actually takes place.
- */
- if (ios->power_mode == MMC_POWER_ON && ios->clock) {
-+ int reset_needed = 0;
- if (host->power != TMIO_MMC_ON_RUN) {
- tmio_mmc_clk_update(mmc);
- pm_runtime_get_sync(dev);
-- if (host->resuming) {
-- tmio_mmc_reset(host);
-- host->resuming = false;
-- }
-+ if (host->resuming)
-+ reset_needed = 1;
- }
-+
- if (host->power == TMIO_MMC_OFF_STOP)
-+ reset_needed = 1;
-+ if (reset_needed) {
- tmio_mmc_reset(host);
-+ if (host->resuming)
-+ host->resuming = false;
-+ }
- tmio_mmc_set_clock(host, ios->clock);
- if (host->power == TMIO_MMC_OFF_STOP)
- /* power up SD card and the bus */
-@@ -1497,7 +1518,7 @@ int tmio_mmc_host_resume(struct device *dev)
-
- /* The MMC core will perform the complete set up */
- host->resuming = true;
-- return mmc_resume_host(mmc);
-+ return mmc_resume_host(mmc);
- }
- EXPORT_SYMBOL(tmio_mmc_host_resume);
- #endif
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0009-Add-hibernation-store-area.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0009-Add-hibernation-store-area.patch
deleted file mode 100755
index a3495e650..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0009-Add-hibernation-store-area.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 5509937666792520b755ed61a110c956478d089d Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:41:19 +0900
-Subject: [PATCH 09/15] Add hibernation store area
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/mtd/Makefile | 3 ++-
- drivers/mtd/devices/Makefile | 4 +++-
- drivers/mtd/devices/phram.c | 5 ++++-
- 3 files changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
-index 99bb9a1..b48049c 100644
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -30,7 +30,8 @@ obj-$(CONFIG_MTD_SWAP) += mtdswap.o
- nftl-objs := nftlcore.o nftlmount.o
- inftl-objs := inftlcore.o inftlmount.o
-
-+obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/
-+
- obj-y += chips/ lpddr/ maps/ devices/ nand/ onenand/ tests/
-
--obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/
- obj-$(CONFIG_MTD_UBI) += ubi/
-diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
-index d83bd73..969f0e8 100644
---- a/drivers/mtd/devices/Makefile
-+++ b/drivers/mtd/devices/Makefile
-@@ -3,8 +3,10 @@
- #
-
- obj-$(CONFIG_MTD_DOCG3) += docg3.o
--obj-$(CONFIG_MTD_SLRAM) += slram.o
-+# obj-$(CONFIG_MTD_SLRAM) += slram.o
-+# obj-$(CONFIG_MTD_PHRAM) += phram.o
- obj-$(CONFIG_MTD_PHRAM) += phram.o
-+obj-$(CONFIG_MTD_SLRAM) += slram.o
- obj-$(CONFIG_MTD_PMC551) += pmc551.o
- obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o
- obj-$(CONFIG_MTD_MTDRAM) += mtdram.o
-diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
-index 67823de..f05947f 100644
---- a/drivers/mtd/devices/phram.c
-+++ b/drivers/mtd/devices/phram.c
-@@ -293,8 +293,11 @@ static void __exit cleanup_phram(void)
- {
- unregister_devices();
- }
--
-+#ifdef __MODULE__
- module_init(init_phram);
-+#else
-+late_initcall(init_phram);
-+#endif
- module_exit(cleanup_phram);
-
- MODULE_LICENSE("GPL");
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0010-Add-rcar-eth-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0010-Add-rcar-eth-hibernation-code.patch
deleted file mode 100755
index 55d1216fe..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0010-Add-rcar-eth-hibernation-code.patch
+++ /dev/null
@@ -1,238 +0,0 @@
-From 1d20d3bd16eac561e14513c9e6cac543fab5a3f0 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:42:33 +0900
-Subject: [PATCH 10/15] Add rcar-eth hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/net/ethernet/renesas/sh_eth.c | 57 +++++++++++++++++++++++++++++++++--
- drivers/net/phy/phy_device.c | 41 +++++++++++++++++++++++++
- 2 files changed, 95 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
-index 991fa1e..7e91b26 100644
---- a/drivers/net/ethernet/renesas/sh_eth.c
-+++ b/drivers/net/ethernet/renesas/sh_eth.c
-@@ -33,6 +33,7 @@
- #include <linux/of.h>
- #include <linux/of_device.h>
- #include <linux/of_irq.h>
-+#include <linux/of_gpio.h>
- #include <linux/of_net.h>
- #include <linux/phy.h>
- #include <linux/cache.h>
-@@ -999,6 +1000,7 @@ static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
- struct bb_info {
- void (*set_gate)(void *addr);
- struct mdiobb_ctrl ctrl;
-+ struct sh_eth_private *mdp;
- void *addr;
- u32 mmd_msk;/* MMD */
- u32 mdo_msk;
-@@ -1029,6 +1031,8 @@ static void sh_mmd_ctrl(struct mdiobb_ctrl *ctrl, int bit)
- {
- struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
-
-+ pm_runtime_get_sync(&bitbang->mdp->pdev->dev);
-+
- if (bitbang->set_gate)
- bitbang->set_gate(bitbang->addr);
-
-@@ -1036,6 +1040,8 @@ static void sh_mmd_ctrl(struct mdiobb_ctrl *ctrl, int bit)
- bb_set(bitbang->addr, bitbang->mmd_msk);
- else
- bb_clr(bitbang->addr, bitbang->mmd_msk);
-+
-+ pm_runtime_put_sync(&bitbang->mdp->pdev->dev);
- }
-
- /* Set bit data*/
-@@ -1043,6 +1049,8 @@ static void sh_set_mdio(struct mdiobb_ctrl *ctrl, int bit)
- {
- struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
-
-+ pm_runtime_get_sync(&bitbang->mdp->pdev->dev);
-+
- if (bitbang->set_gate)
- bitbang->set_gate(bitbang->addr);
-
-@@ -1050,17 +1058,26 @@ static void sh_set_mdio(struct mdiobb_ctrl *ctrl, int bit)
- bb_set(bitbang->addr, bitbang->mdo_msk);
- else
- bb_clr(bitbang->addr, bitbang->mdo_msk);
-+
-+ pm_runtime_put_sync(&bitbang->mdp->pdev->dev);
- }
-
- /* Get bit data*/
- static int sh_get_mdio(struct mdiobb_ctrl *ctrl)
- {
- struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
-+ unsigned int ret;
-+
-+ pm_runtime_get_sync(&bitbang->mdp->pdev->dev);
-
- if (bitbang->set_gate)
- bitbang->set_gate(bitbang->addr);
-
-- return bb_read(bitbang->addr, bitbang->mdi_msk);
-+ ret = bb_read(bitbang->addr, bitbang->mdi_msk);
-+
-+ pm_runtime_put_sync(&bitbang->mdp->pdev->dev);
-+
-+ return ret;
- }
-
- /* MDC pin control */
-@@ -1068,6 +1085,8 @@ static void sh_mdc_ctrl(struct mdiobb_ctrl *ctrl, int bit)
- {
- struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl);
-
-+ pm_runtime_get_sync(&bitbang->mdp->pdev->dev);
-+
- if (bitbang->set_gate)
- bitbang->set_gate(bitbang->addr);
-
-@@ -1075,6 +1094,8 @@ static void sh_mdc_ctrl(struct mdiobb_ctrl *ctrl, int bit)
- bb_set(bitbang->addr, bitbang->mdc_msk);
- else
- bb_clr(bitbang->addr, bitbang->mdc_msk);
-+
-+ pm_runtime_put_sync(&bitbang->mdp->pdev->dev);
- }
-
- /* mdio bus control struct */
-@@ -2664,6 +2685,7 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
- bitbang->mdo_msk = PIR_MDO;
- bitbang->mmd_msk = PIR_MMD;
- bitbang->mdc_msk = PIR_MDC;
-+ bitbang->mdp = mdp;
- bitbang->ctrl.ops = &bb_ops;
-
- /* MII controller setting */
-@@ -3002,9 +3024,38 @@ static int sh_eth_runtime_nop(struct device *dev)
- return 0;
- }
-
-+static int sh_eth_suspend(struct device *dev)
-+{
-+ int ret = 0;
-+ struct net_device *ndev = dev_get_drvdata(dev);
-+
-+ if (netif_running(ndev)) {
-+ netif_device_detach(ndev);
-+ ret = sh_eth_close(ndev);
-+ }
-+
-+ return ret;
-+}
-+
-+static int sh_eth_resume(struct device *dev)
-+{
-+ int ret = 0;
-+ struct net_device *ndev = dev_get_drvdata(dev);
-+
-+ if (netif_running(ndev)) {
-+ ret = sh_eth_open(ndev);
-+ if (ret < 0)
-+ goto err;
-+ netif_device_attach(ndev);
-+ }
-+
-+err:
-+ return ret;
-+}
-+
- static const struct dev_pm_ops sh_eth_dev_pm_ops = {
-- .runtime_suspend = sh_eth_runtime_nop,
-- .runtime_resume = sh_eth_runtime_nop,
-+ SET_RUNTIME_PM_OPS(sh_eth_runtime_nop, sh_eth_runtime_nop, NULL)
-+ SET_SYSTEM_SLEEP_PM_OPS(sh_eth_suspend, sh_eth_resume)
- };
- #define SH_ETH_PM_OPS (&sh_eth_dev_pm_ops)
- #else
-diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
-index 3657b4a..3ceb4f9 100644
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -510,6 +510,32 @@ int phy_init_hw(struct phy_device *phydev)
- return phydev->drv->config_init(phydev);
- }
-
-+int phy_suspend(struct phy_device *phydev)
-+{
-+ struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
-+ struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
-+
-+ /* If the device has WOL enabled, we cannot suspend the PHY */
-+ phy_ethtool_get_wol(phydev, &wol);
-+ if (wol.wolopts)
-+ return -EBUSY;
-+
-+ if (phydrv->suspend)
-+ return phydrv->suspend(phydev);
-+ return 0;
-+}
-+EXPORT_SYMBOL(phy_suspend);
-+
-+int phy_resume(struct phy_device *phydev)
-+{
-+ struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
-+
-+ if (phydrv->resume)
-+ return phydrv->resume(phydev);
-+ return 0;
-+}
-+EXPORT_SYMBOL(phy_resume);
-+
- /**
- * phy_attach_direct - attach a network device to a given PHY device pointer
- * @dev: network device to attach
-@@ -528,6 +554,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
- u32 flags, phy_interface_t interface)
- {
- struct device *d = &phydev->dev;
-+ struct module *bus_module;
- int err;
-
- /* Assume that if there is no driver, that it doesn't
-@@ -553,6 +580,14 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
- return -EBUSY;
- }
-
-+ /* Increment the bus module reference count */
-+ bus_module = phydev->bus->dev.driver ?
-+ phydev->bus->dev.driver->owner : NULL;
-+ if (!try_module_get(bus_module)) {
-+ dev_err(&dev->dev, "failed to get the bus module\n");
-+ return -EIO;
-+ }
-+
- phydev->attached_dev = dev;
- dev->phydev = phydev;
-
-@@ -568,6 +603,8 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
- err = phy_init_hw(phydev);
- if (err)
- phy_detach(phydev);
-+ else
-+ phy_resume(phydev);
-
- return err;
- }
-@@ -612,8 +649,12 @@ EXPORT_SYMBOL(phy_attach);
- */
- void phy_detach(struct phy_device *phydev)
- {
-+ if (phydev->bus->dev.driver)
-+ module_put(phydev->bus->dev.driver->owner);
-+
- phydev->attached_dev->phydev = NULL;
- phydev->attached_dev = NULL;
-+ phy_suspend(phydev);
-
- /* If the device had no specific driver before (i.e. - it
- * was using the generic driver), we unbind the device
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0011-Add-rcar-pci-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0011-Add-rcar-pci-hibernation-code.patch
deleted file mode 100755
index bdc9555c8..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0011-Add-rcar-pci-hibernation-code.patch
+++ /dev/null
@@ -1,375 +0,0 @@
-From f8691a62199319d9e37cd451a9b8364aa640c4cb Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:45:19 +0900
-Subject: [PATCH 11/15] Add rcar-pci hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/pci/host/pci-rcar-gen2.c | 281 ++++++++++++++++++++++++++++++++++++---
- 1 file changed, 266 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
-index 57b6572..4cb9693 100644
---- a/drivers/pci/host/pci-rcar-gen2.c
-+++ b/drivers/pci/host/pci-rcar-gen2.c
-@@ -23,9 +23,12 @@
- #include <linux/sizes.h>
- #include <linux/slab.h>
- #include <linux/usb/phy.h>
-+#include <linux/clk.h>
-
- /* AHB-PCI Bridge PCI communication registers */
- #define RCAR_AHBPCI_PCICOM_OFFSET 0x800
-+#define RCAR_PCICONF_OHCI 0x0
-+#define RCAR_PCICONF_EHCI 0x100
-
- #define RCAR_PCIAHB_WIN1_CTR_REG (RCAR_AHBPCI_PCICOM_OFFSET + 0x00)
- #define RCAR_PCIAHB_WIN2_CTR_REG (RCAR_AHBPCI_PCICOM_OFFSET + 0x04)
-@@ -104,6 +107,14 @@ struct rcar_pci_priv {
- int domain;
- int irq;
- unsigned long window_size;
-+ void __iomem *ohci_memdata;
-+ void __iomem *ehci_memdata;
-+#ifndef MCCILDK_CHANGE_DISABLE
-+ u32 store_cfg[12];
-+#else
-+ u32 store_cfg[9];
-+#endif
-+ struct usb_phy *phy;
- };
-
- /* PCI configuration space operations */
-@@ -276,12 +287,6 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys)
- /* Configure AHB master and slave modes */
- iowrite32(RCAR_AHB_BUS_MODE, reg + RCAR_AHB_BUS_CTR_REG);
-
-- /* Configure PCI arbiter */
-- val = ioread32(reg + RCAR_PCI_ARBITER_CTR_REG);
-- val |= RCAR_PCI_ARBITER_PCIREQ0 | RCAR_PCI_ARBITER_PCIREQ1 |
-- RCAR_PCI_ARBITER_PCIBP_MODE;
-- iowrite32(val, reg + RCAR_PCI_ARBITER_CTR_REG);
--
- /* PCI-AHB mapping: 0x40000000 base */
- iowrite32(0x40000000 | RCAR_PCIAHB_PREFETCH16,
- reg + RCAR_PCIAHB_WIN1_CTR_REG);
-@@ -290,9 +295,25 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys)
- val = priv->mem_res.start | RCAR_AHBPCI_WIN_CTR_MEM;
- iowrite32(val, reg + RCAR_AHBPCI_WIN2_CTR_REG);
-
-+ /* Enable PCI interrupts */
-+ iowrite32(RCAR_PCI_INT_A | RCAR_PCI_INT_B | RCAR_PCI_INT_PME,
-+ reg + RCAR_PCI_INT_ENABLE_REG);
-+
-+ /* Configure PCI arbiter */
-+ val = ioread32(reg + RCAR_PCI_ARBITER_CTR_REG);
-+ val |= RCAR_PCI_ARBITER_PCIREQ0 | RCAR_PCI_ARBITER_PCIREQ1 |
-+ RCAR_PCI_ARBITER_PCIBP_MODE;
-+ iowrite32(val, reg + RCAR_PCI_ARBITER_CTR_REG);
-+
- /* Enable AHB-PCI bridge PCI configuration access */
- iowrite32(RCAR_AHBPCI_WIN1_HOST | RCAR_AHBPCI_WIN_CTR_CFG,
- reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ val = ioread32(reg + PCI_COMMAND);
-+
-+ val |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY |
-+ PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
-+ iowrite32(val, reg + PCI_COMMAND);
-+
- /* Set PCI-AHB Window1 address */
- iowrite32(0x40000000 | PCI_BASE_ADDRESS_MEM_PREFETCH,
- reg + PCI_BASE_ADDRESS_1);
-@@ -300,15 +321,6 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys)
- val = priv->cfg_res->start + RCAR_AHBPCI_PCICOM_OFFSET;
- iowrite32(val, reg + PCI_BASE_ADDRESS_0);
-
-- val = ioread32(reg + PCI_COMMAND);
-- val |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY |
-- PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
-- iowrite32(val, reg + PCI_COMMAND);
--
-- /* Enable PCI interrupts */
-- iowrite32(RCAR_PCI_INT_A | RCAR_PCI_INT_B | RCAR_PCI_INT_PME,
-- reg + RCAR_PCI_INT_ENABLE_REG);
--
- if (priv->irq > 0)
- rcar_pci_setup_errirq(priv);
-
-@@ -326,6 +338,8 @@ static struct pci_ops rcar_pci_ops = {
- .write = rcar_pci_write_config,
- };
-
-+#define RCAR_MAX_PCI_HOSTS 2
-+static struct rcar_pci_priv *keep_priv[RCAR_MAX_PCI_HOSTS];
- static int rcar_pci_probe(struct platform_device *pdev)
- {
- struct resource *cfg_res, *mem_res;
-@@ -350,6 +364,7 @@ static int rcar_pci_probe(struct platform_device *pdev)
- return -ENOMEM;
-
- priv->mem_res = *mem_res;
-+ keep_priv[pdev->id] = priv;
- /*
- * The controller does not support/use port I/O,
- * so setup a dummy port I/O region here.
-@@ -378,6 +393,7 @@ static int rcar_pci_probe(struct platform_device *pdev)
- return PTR_ERR(phy);
-
- usb_phy_init(phy);
-+ priv->phy = phy;
-
- hw_private[0] = priv;
- memset(&hw, 0, sizeof(hw));
-@@ -390,14 +406,249 @@ static int rcar_pci_probe(struct platform_device *pdev)
- hw.domain = priv->domain;
- #endif
- pci_common_init_dev(&pdev->dev, &hw);
-+ priv->ohci_memdata = ioremap(cfg_res->start - 0x10000, 0x1000);
-+ priv->ehci_memdata = ioremap(cfg_res->start - 0x10000 + 0x1000, 0x1000);
-+ return 0;
-+}
-+
-+static int rcar_pci_suspend(struct device *dev)
-+{
-+ struct clk *clk;
-+ clk = clk_get(NULL, "ehci");
-+ clk_disable_unprepare(clk);
-+ clk_put(clk);
-+ return 0;
-+}
-+static int rcar_pci_resume(struct device *dev)
-+{
-+ struct clk *clk;
-+ clk = clk_get(NULL, "ehci");
-+ clk_prepare_enable(clk);
-+ clk_put(clk);
-+ return 0;
-+}
-+static u32 rcar_pci_get_conf(struct rcar_pci_priv *priv, int id, int offset)
-+{
-+ u32 val, kpt;
-+ void __iomem *data;
-+ kpt = ioread32(priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ val = id ? RCAR_AHBPCI_WIN1_DEVICE | RCAR_AHBPCI_WIN_CTR_CFG :
-+ RCAR_AHBPCI_WIN1_HOST | RCAR_AHBPCI_WIN_CTR_CFG;
-+
-+ iowrite32(val, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ data = priv->reg + (id >> 1) * 0x100;
-+ val = ioread32(data + offset);
-+ iowrite32(kpt, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ return val;
-+}
-+
-+static void rcar_pci_set_conf(struct rcar_pci_priv *priv,
-+ int id, int offset, u32 d)
-+{
-+ u32 val, kpt;
-+ void __iomem *data;
-+ kpt = ioread32(priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ val = id ? RCAR_AHBPCI_WIN1_DEVICE | RCAR_AHBPCI_WIN_CTR_CFG :
-+ RCAR_AHBPCI_WIN1_HOST | RCAR_AHBPCI_WIN_CTR_CFG;
-+
-+ iowrite32(val, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ data = priv->reg + (id >> 1) * 0x100;
-+ iowrite32(d, data + offset);
-+ iowrite32(kpt, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+}
-+
-+
-+static int rcar_pci_freeze(struct device *dev)
-+{
-+ struct rcar_pci_priv *priv = keep_priv[to_platform_device(dev)->id];
-+ struct clk *clk;
-+ clk = clk_get(NULL, "ehci");
-+ clk_disable_unprepare(clk);
-+ clk_put(clk);
-+
-+#ifndef MCCILDK_CHANGE_DISABLE
-+ priv->store_cfg[0] = rcar_pci_get_conf(priv, 0, PCI_COMMAND);
-+ priv->store_cfg[1] = rcar_pci_get_conf(priv, 1, PCI_COMMAND);
-+ priv->store_cfg[2] = rcar_pci_get_conf(priv, 2, PCI_COMMAND);
-+ priv->store_cfg[3] = rcar_pci_get_conf(priv, 0, PCI_CACHE_LINE_SIZE);
-+ priv->store_cfg[4] = rcar_pci_get_conf(priv, 1, PCI_CACHE_LINE_SIZE);
-+ priv->store_cfg[5] = rcar_pci_get_conf(priv, 2, PCI_CACHE_LINE_SIZE);
-+ priv->store_cfg[6] = rcar_pci_get_conf(priv, 0, PCI_INTERRUPT_LINE);
-+ priv->store_cfg[7] = rcar_pci_get_conf(priv, 1, PCI_INTERRUPT_LINE);
-+ priv->store_cfg[8] = rcar_pci_get_conf(priv, 2, PCI_INTERRUPT_LINE);
-+ priv->store_cfg[9] = rcar_pci_get_conf(priv, 0, PCI_BASE_ADDRESS_0);
-+ priv->store_cfg[10] = rcar_pci_get_conf(priv, 1, PCI_BASE_ADDRESS_0);
-+ priv->store_cfg[11] = rcar_pci_get_conf(priv, 2, PCI_BASE_ADDRESS_0);
-+#else
-+ priv->store_cfg[0] = rcar_pci_get_conf(priv, 0, 0x04);
-+ priv->store_cfg[1] = rcar_pci_get_conf(priv, 1, 0x04);
-+ priv->store_cfg[2] = rcar_pci_get_conf(priv, 2, 0x04);
-+ priv->store_cfg[3] = rcar_pci_get_conf(priv, 0, 0x0c);
-+ priv->store_cfg[4] = rcar_pci_get_conf(priv, 1, 0x0c);
-+ priv->store_cfg[5] = rcar_pci_get_conf(priv, 2, 0x0c);
-+ priv->store_cfg[6] = rcar_pci_get_conf(priv, 0, 0x3c);
-+ priv->store_cfg[7] = rcar_pci_get_conf(priv, 1, 0x3c);
-+ priv->store_cfg[8] = rcar_pci_get_conf(priv, 2, 0x3c);
-+#endif
-+ pm_runtime_disable(priv->dev);
-+ return 0;
-+}
-+
-+static int rcar_pci_restore(struct device *dev)
-+{
-+ struct clk *clk;
-+ void *m;
-+ u32 val;
-+ struct rcar_pci_priv *priv = keep_priv[to_platform_device(dev)->id];
-+ void __iomem *reg = priv->reg;
-+ int id = to_platform_device(dev)->id;
-+
-+ pm_runtime_enable(priv->dev);
-+ pm_runtime_get_sync(priv->dev);
-+
-+ clk = clk_get(NULL, "ehci");
-+ clk_prepare_enable(clk);
-+ clk_put(clk);
-+ clk = clk_get(NULL, "hsusb");
-+ clk_prepare_enable(clk);
-+ clk_put(clk);
-+ usb_phy_set_suspend(priv->phy, 0);
-+ m = ioremap(0xe61501c4, 4);
-+ val = readl(m);
-+ iounmap(m);
-+ m = ioremap(0xe615014c, 4);
-+ writel(val & ~(3 << 3), m);
-+ iounmap(m);
-+ val = ioread32(reg + RCAR_PCI_UNIT_REV_REG);
-+ dev_info(priv->dev, "PCI: bus%u revision %x\n", id, val);
-+
-+ /* Disable Direct Power Down State and assert reset */
-+ val = ioread32(reg + RCAR_USBCTR_REG) & ~RCAR_USBCTR_DIRPD;
-+#ifndef MCCILDK_CHANGE_DISABLE
-+ val |= RCAR_USBCTR_USBH_RST | RCAR_USBCTR_PLL_RST;
-+#else
-+ val |= RCAR_USBCTR_USBH_RST;
-+#endif
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+ udelay(4);
-+ /* De-assert reset */
-+#ifndef MCCILDK_CHANGE_DISABLE
-+ val &= ~(RCAR_USBCTR_USBH_RST | RCAR_USBCTR_PLL_RST
-+ | RCAR_USBCTR_PCICLK_MASK);
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+ /* reset PCIAHB window size */
-+ val &= ~RCAR_USBCTR_PCIAHB_WIN1_MASK;
-+ val |= RCAR_USBCTR_PCIAHB_WIN1_1G;
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+#else
-+ val &= RCAR_USBCTR_USBH_RST | RCAR_USBCTR_PLL_RST
-+ | RCAR_USBCTR_PCICLK_MASK;
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+ val &= RCAR_USBCTR_USBH_RST | RCAR_USBCTR_PLL_RST
-+ | RCAR_USBCTR_PCICLK_MASK;
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+ /* reset PCIAHB window size */
-+ val &= RCAR_USBCTR_PCIAHB_WIN1_MASK;
-+ val |= RCAR_USBCTR_PCIAHB_WIN1_1G;
-+ iowrite32(val, reg + RCAR_USBCTR_REG);
-+#endif
-+
-+ /* Configure AHB master and slave modes */
-+ iowrite32(RCAR_AHB_BUS_MODE, reg + RCAR_AHB_BUS_CTR_REG);
-+
-+ /* PCI-AHB mapping: 0x40000000 base */
-+ iowrite32(0x40000000 | RCAR_PCIAHB_PREFETCH16,
-+ reg + RCAR_PCIAHB_WIN1_CTR_REG);
-+
-+ /* AHB-PCI mapping: OHCI/EHCI registers */
-+ val = priv->mem_res.start | RCAR_AHBPCI_WIN_CTR_MEM;
-+ iowrite32(val, reg + RCAR_AHBPCI_WIN2_CTR_REG);
-+
-+ /* Enable PCI interrupts */
-+ iowrite32(RCAR_PCI_INT_A | RCAR_PCI_INT_B | RCAR_PCI_INT_PME,
-+ reg + RCAR_PCI_INT_ENABLE_REG);
-+
-+ /* Configure PCI arbiter */
-+ val = ioread32(reg + RCAR_PCI_ARBITER_CTR_REG);
-+ val |= RCAR_PCI_ARBITER_PCIREQ0 | RCAR_PCI_ARBITER_PCIREQ1 |
-+ RCAR_PCI_ARBITER_PCIBP_MODE;
-+ iowrite32(val, reg + RCAR_PCI_ARBITER_CTR_REG);
-+
-+ /* Enable AHB-PCI bridge PCI configuration access */
-+ iowrite32(RCAR_AHBPCI_WIN1_HOST | RCAR_AHBPCI_WIN_CTR_CFG,
-+ reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+
-+ val = ioread32(reg + PCI_COMMAND);
-+ val |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY |
-+ PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
-+ iowrite32(val, reg + PCI_COMMAND);
-+
-+ /* Set PCI-AHB Window1 address */
-+ iowrite32(0x40000000 | PCI_BASE_ADDRESS_MEM_PREFETCH,
-+ reg + PCI_BASE_ADDRESS_1);
-+ /* Set AHB-PCI bridge PCI communication area address */
-+ val = priv->cfg_res->start + RCAR_AHBPCI_PCICOM_OFFSET;
-+ iowrite32(val, reg + PCI_BASE_ADDRESS_0);
-+
-+ if (priv->irq > 0)
-+ rcar_pci_setup_errirq(priv);
-+#ifndef MCCILDK_CHANGE_DISABLE
-+ rcar_pci_set_conf(priv, 0, PCI_COMMAND, priv->store_cfg[0]);
-+ rcar_pci_set_conf(priv, 1, PCI_COMMAND, priv->store_cfg[1]);
-+ rcar_pci_set_conf(priv, 2, PCI_COMMAND, priv->store_cfg[2]);
-+ rcar_pci_set_conf(priv, 0, PCI_CACHE_LINE_SIZE, priv->store_cfg[3]);
-+ rcar_pci_set_conf(priv, 1, PCI_CACHE_LINE_SIZE, priv->store_cfg[4]);
-+ rcar_pci_set_conf(priv, 2, PCI_CACHE_LINE_SIZE, priv->store_cfg[5]);
-+ rcar_pci_set_conf(priv, 0, PCI_INTERRUPT_LINE, priv->store_cfg[6]);
-+ rcar_pci_set_conf(priv, 1, PCI_INTERRUPT_LINE, priv->store_cfg[7]);
-+ rcar_pci_set_conf(priv, 2, PCI_INTERRUPT_LINE, priv->store_cfg[8]);
-+ rcar_pci_set_conf(priv, 1, PCI_BASE_ADDRESS_0, priv->store_cfg[10]);
-+ rcar_pci_set_conf(priv, 2, PCI_BASE_ADDRESS_0, priv->store_cfg[11]);
-+#else
-+ rcar_pci_set_conf(priv, 1, PCI_COMMAND, PCI_COMMAND_SERR
-+ | PCI_COMMAND_PARITY | PCI_COMMAND_MEMORY
-+ | PCI_COMMAND_MASTER);
-+ rcar_pci_set_conf(priv, 1, PCI_BASE_ADDRESS_0
-+ priv->cfg_res->start - 0x10000);
-+ rcar_pci_set_conf(priv, 2, PCI_COMMAND, PCI_COMMAND_SERR
-+ | PCI_COMMAND_PARITY | PCI_COMMAND_MEMORY
-+ | PCI_COMMAND_MASTER);
-+ rcar_pci_set_conf(priv, 2, PCI_BASE_ADDRESS_0,
-+ priv->cfg_res->start - 0x10000 + 0x1000);
-+ rcar_pci_set_conf(priv, 0, PCI_CACHE_LINE_SIZE, priv->store_cfg[3]);
-+ rcar_pci_set_conf(priv, 1, PCI_CACHE_LINE_SIZE, priv->store_cfg[4]);
-+ rcar_pci_set_conf(priv, 2, PCI_CACHE_LINE_SIZE, priv->store_cfg[5]);
-+ rcar_pci_set_conf(priv, 0, PCI_INTERRUPT_LINE, 0x00020100);
-+ rcar_pci_set_conf(priv, 1, PCI_INTERRUPT_LINE, 0x2a010100);
-+ rcar_pci_set_conf(priv, 2, PCI_INTERRUPT_LINE, 0x22100200);
-+ val = RCAR_AHBPCI_WIN1_DEVICE | RCAR_AHBPCI_WIN_CTR_CFG;
-+ iowrite32(val, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+ val = ioread32(priv->reg + 0x04);
-+ iowrite32(val | (1 << 1), priv->reg + 0x04);
-+ val = ioread32(priv->reg + 0x104);
-+ iowrite32(val | (1 << 1), priv->reg + 0x104);
-+
-+ val = RCAR_AHBPCI_WIN1_HOST | RCAR_AHBPCI_WIN_CTR_CFG;
-+ iowrite32(val, priv->reg + RCAR_AHBPCI_WIN1_CTR_REG);
-+#endif
- return 0;
- }
-
-+static const struct dev_pm_ops rcar_pci_pm_ops = {
-+ .suspend = rcar_pci_suspend,
-+ .resume = rcar_pci_resume,
-+ .freeze_noirq = rcar_pci_freeze,
-+ .restore_noirq = rcar_pci_restore,
-+ .thaw = rcar_pci_resume,
-+ .poweroff = rcar_pci_suspend
-+};
-+
- static struct platform_driver rcar_pci_driver = {
- .driver = {
- .name = "pci-rcar-gen2",
- .owner = THIS_MODULE,
- .suppress_bind_attrs = true,
-+ .pm = &rcar_pci_pm_ops,
- },
- .probe = rcar_pci_probe,
- };
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0012-Add-rcar-gpio-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0012-Add-rcar-gpio-hibernation-code.patch
deleted file mode 100755
index 9b2aff4f9..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0012-Add-rcar-gpio-hibernation-code.patch
+++ /dev/null
@@ -1,230 +0,0 @@
-From bf20be14fc1b3f7e096bdac9c5ff67362b391479 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:46:24 +0900
-Subject: [PATCH 12/15] Add rcar-gpio hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/pinctrl/sh-pfc/core.c | 141 +++++++++++++++++++++++++++++++++++++++---
- drivers/pinctrl/sh-pfc/core.h | 4 ++
- 2 files changed, 138 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index b9e025d..c37418e 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -24,6 +24,7 @@
- #include <linux/pinctrl/machine.h>
- #include <linux/platform_device.h>
- #include <linux/slab.h>
-+#include <linux/cpu_pm.h>
-
- #include "core.h"
-
-@@ -201,19 +202,117 @@ static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
- }
- }
-
-+#ifdef CONFIG_CPU_PM
-+struct reg_record {
-+ void __iomem *reg;
-+ unsigned long width;
-+ unsigned long data;
-+};
-+
-+struct reg_config {
-+ bool unlock;
-+ struct reg_record unlock_reg;
-+ struct reg_record actual_reg;
-+ struct list_head list;
-+};
-+
-+static struct reg_config *regs_list;
-+
-+struct reg_range {
-+ int start;
-+ int end;
-+};
-+
-+static int sh_pfc_cpu_pm_notify(struct notifier_block *self,
-+ unsigned long action, void *hcpu)
-+{
-+ struct reg_config *tmp = NULL;
-+ struct sh_pfc *pfc = container_of(self, struct sh_pfc, pm_notify);
-+ /* We don't setup pinmux in kernel - store all registers */
-+ struct reg_range ranges[] = {
-+ {0x0, 0x5c}, {0x160, 0x160}, {0x90, 0x98},
-+ {0x100, 0x118}, {0x70, 0x70}, {0x60, 0x64},
-+ {0x84, 0x8c}, {0x240, 0x248},
-+ };
-+
-+ if (action == CPU_PM_ENTER) {
-+ if (!regs_list) {
-+ /* No pinmux configuration, storing all registers */
-+ int store_cnt = 0;
-+ int i;
-+ for (i = 0; i < ARRAY_SIZE(ranges); i++) {
-+ int j;
-+ for (j = ranges[i].start; j <= ranges[i].end; j += sizeof(u32)) {
-+ pfc->stored_regs[store_cnt] =
-+ sh_pfc_read_raw_reg(sh_pfc_phys_to_virt(pfc, 0xe6060000 + j), 32);
-+ pr_debug("PFC: %08x => %08x\n", 0xe6060000 + j, pfc->stored_regs[store_cnt]);
-+ store_cnt++;
-+ if (store_cnt >= ARRAY_SIZE(pfc->stored_regs)) {
-+ pr_err("read: Register store overflow\n");
-+ goto out;
-+ }
-+ }
-+ }
-+ }
-+ } else if (action == CPU_PM_ENTER_FAILED || action == CPU_PM_EXIT) {
-+ if (!regs_list) {
-+ /* No list, restoring all registers */
-+ int store_cnt = 0;
-+ int i;
-+ for (i = 0; i < ARRAY_SIZE(ranges); i++) {
-+ int j;
-+ for (j = ranges[i].start; j <= ranges[i].end; j += sizeof(u32)) {
-+ sh_pfc_write_raw_reg(sh_pfc_phys_to_virt(pfc, 0xe6060000 + j), 32,
-+ pfc->stored_regs[store_cnt]);
-+ pr_debug("PFC: %08x => %08x\n", 0xe6060000 + j, pfc->stored_regs[store_cnt]);
-+ store_cnt++;
-+ if (store_cnt >= ARRAY_SIZE(pfc->stored_regs)) {
-+ pr_err("write: Register store overflow\n");
-+ goto out;
-+ }
-+ }
-+ }
-+ goto out;
-+ }
-+ list_for_each_entry(tmp , &(regs_list->list), list) {
-+ if (tmp->unlock)
-+ sh_pfc_write_raw_reg(tmp->unlock_reg.reg,
-+ tmp->unlock_reg.width,
-+ tmp->unlock_reg.data);
-+ sh_pfc_write_raw_reg(tmp->actual_reg.reg,
-+ tmp->actual_reg.width,
-+ tmp->actual_reg.data);
-+ }
-+ }
-+out:
-+ return NOTIFY_OK;
-+}
-+
-+static int __init sh_pfc_cpu_pm_init(struct sh_pfc *pfc)
-+{
-+ memset(&pfc->pm_notify, 0, sizeof(pfc->pm_notify));
-+ pfc->pm_notify.notifier_call = sh_pfc_cpu_pm_notify;
-+ return cpu_pm_register_notifier(&pfc->pm_notify);
-+}
-+#else
-+static int __init sh_pfc_cpu_pm_init(struct sh_pfc *pfc)
-+{
-+ return 0;
-+}
-+#endif
-+
-+
- static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
- const struct pinmux_cfg_reg *crp,
- unsigned long field, unsigned long value)
- {
- void __iomem *mapped_reg;
- unsigned long mask, pos, data;
--
-+#ifdef CONFIG_CPU_PM
-+ struct reg_config *tmp;
-+#endif
- sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos);
-
-- dev_dbg(pfc->dev, "write_reg addr = %lx, value = %ld, field = %ld, "
-- "r_width = %ld, f_width = %ld\n",
-- crp->reg, value, field, crp->reg_width, crp->field_width);
--
- mask = ~(mask << pos);
- value = value << pos;
-
-@@ -221,14 +320,39 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
- data &= mask;
- data |= value;
-
-- if (pfc->info->unlock_reg)
-+#ifdef CONFIG_CPU_PM
-+ tmp = kzalloc(sizeof(struct reg_config), GFP_KERNEL);
-+ BUG_ON(!tmp);
-+
-+ if (!regs_list) {
-+ regs_list = tmp;
-+ INIT_LIST_HEAD(&regs_list->list);
-+ }
-+#endif
-+
-+ if (pfc->info->unlock_reg) {
-+#ifdef CONFIG_CPU_PM
-+ tmp->unlock = true;
-+ tmp->unlock_reg.reg = sh_pfc_phys_to_virt(pfc,
-+ pfc->info->unlock_reg);
-+ tmp->unlock_reg.width = 32;
-+ tmp->unlock_reg.data = ~data;
-+#endif
- sh_pfc_write_raw_reg(
- sh_pfc_phys_to_virt(pfc, pfc->info->unlock_reg), 32,
- ~data);
-+ }
-+
-+#ifdef CONFIG_CPU_PM
-+ tmp->actual_reg.reg = mapped_reg;
-+ tmp->actual_reg.width = crp->reg_width;
-+ tmp->actual_reg.data = data;
-+
-+ list_add(&tmp->list, &regs_list->list);
-+#endif
-
- sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data);
- }
--
- static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id,
- const struct pinmux_cfg_reg **crp, int *fieldp,
- int *valuep)
-@@ -574,6 +698,8 @@ static int sh_pfc_probe(struct platform_device *pdev)
-
- platform_set_drvdata(pdev, pfc);
-
-+ sh_pfc_cpu_pm_init(pfc);
-+
- dev_info(pfc->dev, "%s support registered\n", info->name);
-
- return 0;
-@@ -596,6 +722,7 @@ static int sh_pfc_remove(struct platform_device *pdev)
- if (pfc->info->ops && pfc->info->ops->exit)
- pfc->info->ops->exit(pfc);
-
-+
- return 0;
- }
-
-diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
-index 75ecb67..5471a6c 100644
---- a/drivers/pinctrl/sh-pfc/core.h
-+++ b/drivers/pinctrl/sh-pfc/core.h
-@@ -14,6 +14,7 @@
- #include <linux/compiler.h>
- #include <linux/spinlock.h>
- #include <linux/types.h>
-+#include <linux/notifier.h>
-
- #include "sh_pfc.h"
-
-@@ -51,6 +52,9 @@ struct sh_pfc {
- struct sh_pfc_chip *func;
-
- struct sh_pfc_pinctrl *pinctrl;
-+ struct notifier_block pm_notify;
-+#define STORE_REGS_COUNT 50
-+ u32 stored_regs[STORE_REGS_COUNT];
- };
-
- int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0013-Add-rcar-spi-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0013-Add-rcar-spi-hibernation-code.patch
deleted file mode 100755
index 515b08b12..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0013-Add-rcar-spi-hibernation-code.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From c1b129172a91046a7555a3c198b49eb1b45aafd7 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:58:28 +0900
-Subject: [PATCH 13/15] Add rcar-spi hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/spi/spi-rspi.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 108 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
-index 215be3b..a2432de 100644
---- a/drivers/spi/spi-rspi.c
-+++ b/drivers/spi/spi-rspi.c
-@@ -38,6 +38,7 @@
- #include <linux/sh_dma.h>
- #include <linux/spi/spi.h>
- #include <linux/spi/rspi.h>
-+#include <linux/delay.h>
-
- #define RSPI_SPCR 0x00 /* Control Register */
- #define RSPI_SSLP 0x01 /* Slave Select Polarity Register */
-@@ -208,6 +209,12 @@ struct rspi_data {
- u8 sppcr;
- int rx_irq, tx_irq;
- const struct spi_ops *ops;
-+ u32 save_spbmul0;
-+ u32 save_spbmul1;
-+ u32 save_spbmul2;
-+ u32 save_spbmul3;
-+ u8 save_spbfcr;
-+ u8 save_spscr;
-
- unsigned dma_callbacked:1;
- unsigned byte_access:1;
-@@ -238,6 +245,11 @@ static u16 rspi_read16(const struct rspi_data *rspi, u16 offset)
- return ioread16(rspi->addr + offset);
- }
-
-+static u16 rspi_read32(const struct rspi_data *rspi, u16 offset)
-+{
-+ return ioread32(rspi->addr + offset);
-+}
-+
- #define rspi_update8(spi, mask, val, reg) \
- rspi_write8(spi, (rspi_read8(spi, reg) & ~mask) | val, reg);
-
-@@ -504,7 +516,6 @@ static int rspi_pio_transfer_in(struct rspi_data *rspi, u8 *rx, unsigned int n)
- if (!rx)
- return 0;
-
--
- while (n > 0) {
- count = min(n, SPI_BUFFER_SIZE);
- if (count >= SPI_BUFFER_SIZE) {
-@@ -1278,6 +1289,101 @@ error1:
- return ret;
- }
-
-+int rspi_suspend(struct device *dev)
-+{
-+ struct rspi_data *rspi = platform_get_drvdata(to_platform_device(dev));
-+ clk_disable_unprepare(rspi->clk);
-+ return 0;
-+}
-+
-+int rspi_resume(struct device *dev)
-+{
-+ struct rspi_data *rspi = platform_get_drvdata(to_platform_device(dev));
-+ clk_prepare_enable(rspi->clk);
-+ return 0;
-+}
-+
-+#define PR_REG8(dev, rspi, reg) \
-+ dev_dbg(dev, "QSPI REG: " #reg " = %08x\n", \
-+ rspi_read8(rspi, reg))
-+#define PR_REG16(dev, rspi, reg) \
-+ dev_dbg(dev, "QSPI REG: " #reg " = %08x\n", \
-+ rspi_read16(rspi, reg))
-+#define PR_REG32(dev, rspi, reg) \
-+ dev_dbg(dev, "QSPI REG: " #reg " = %08x\n", \
-+ rspi_read32(rspi, reg))
-+
-+#ifdef DEBUG
-+static void pr_regs(struct device *dev)
-+{
-+ struct rspi_data *rspi = platform_get_drvdata(to_platform_device(dev));
-+ PR_REG8(dev, rspi, RSPI_SPCR);
-+ PR_REG8(dev, rspi, RSPI_SSLP);
-+ PR_REG8(dev, rspi, RSPI_SPPCR);
-+ PR_REG8(dev, rspi, RSPI_SPDR);
-+ PR_REG8(dev, rspi, RSPI_SPSCR);
-+ PR_REG8(dev, rspi, RSPI_SPBR);
-+ PR_REG8(dev, rspi, RSPI_SPDCR);
-+ PR_REG8(dev, rspi, RSPI_SPCKD);
-+ PR_REG8(dev, rspi, RSPI_SSLND);
-+ PR_REG8(dev, rspi, RSPI_SPND);
-+ PR_REG16(dev, rspi, RSPI_SPCMD0);
-+ PR_REG16(dev, rspi, RSPI_SPCMD1);
-+ PR_REG16(dev, rspi, RSPI_SPCMD2);
-+ PR_REG16(dev, rspi, RSPI_SPCMD3);
-+ PR_REG8(dev, rspi, QSPI_SPBFCR);
-+ PR_REG16(dev, rspi, QSPI_SPBDCR);
-+ PR_REG32(dev, rspi, QSPI_SPBMUL0);
-+ PR_REG32(dev, rspi, QSPI_SPBMUL1);
-+ PR_REG32(dev, rspi, QSPI_SPBMUL2);
-+ PR_REG32(dev, rspi, QSPI_SPBMUL3);
-+}
-+#endif
-+
-+int rspi_freeze(struct device *dev)
-+{
-+ struct rspi_data *rspi = platform_get_drvdata(to_platform_device(dev));
-+ rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR);
-+ rspi->save_spbmul0 = rspi_read32(rspi, QSPI_SPBMUL0);
-+ rspi->save_spbmul1 = rspi_read32(rspi, QSPI_SPBMUL1);
-+ rspi->save_spbmul2 = rspi_read32(rspi, QSPI_SPBMUL2);
-+ rspi->save_spbmul3 = rspi_read32(rspi, QSPI_SPBMUL3);
-+ rspi->save_spbfcr = rspi_read8(rspi, QSPI_SPBFCR);
-+ rspi->save_spscr = rspi_read8(rspi, RSPI_SPSCR);
-+ dev_info(dev, "freeze\n");
-+#ifdef DEBUG
-+ pr_regs(dev);
-+#endif
-+ return 0;
-+}
-+
-+
-+int rspi_restore(struct device *dev)
-+{
-+ struct rspi_data *rspi = platform_get_drvdata(to_platform_device(dev));
-+ clk_prepare_enable(rspi->clk);
-+ udelay(16);
-+ set_config_register(rspi, 8);
-+ rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR);
-+ rspi_write8(rspi, rspi->save_spscr, RSPI_SPSCR);
-+ rspi_write8(rspi, rspi->save_spbfcr, QSPI_SPBFCR);
-+ rspi_write32(rspi, rspi->save_spbmul3, QSPI_SPBMUL3);
-+ rspi_write32(rspi, rspi->save_spbmul2, QSPI_SPBMUL2);
-+ rspi_write32(rspi, rspi->save_spbmul1, QSPI_SPBMUL1);
-+ rspi_write32(rspi, rspi->save_spbmul0, QSPI_SPBMUL0);
-+ dev_info(dev, "restore\n");
-+#ifdef DEBUG
-+ pr_regs(dev);
-+#endif
-+ return 0;
-+}
-+
-+const struct dev_pm_ops rspi_pm_ops = {
-+ SET_SYSTEM_SLEEP_PM_OPS(rspi_suspend, rspi_resume)
-+ .restore = rspi_restore,
-+ .freeze = rspi_freeze,
-+};
-+
- static struct platform_device_id spi_driver_ids[] = {
- { "rspi", (kernel_ulong_t)&rspi_ops },
- { "rspi-rz", (kernel_ulong_t)&rspi_rz_ops },
-@@ -1295,6 +1401,7 @@ static struct platform_driver rspi_driver = {
- .name = "renesas_spi",
- .owner = THIS_MODULE,
- .of_match_table = of_match_ptr(rspi_of_match),
-+ .pm = &rspi_pm_ops,
- },
- };
- module_platform_driver(rspi_driver);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0014-Add-rcar-sci-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0014-Add-rcar-sci-hibernation-code.patch
deleted file mode 100755
index c70f515a2..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0014-Add-rcar-sci-hibernation-code.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 947b9e15ff36a9dcd517bb932303cc32f8356550 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 17:59:40 +0900
-Subject: [PATCH 14/15] Add rcar-sci hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/tty/serial/sh-sci.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
-index e3abfb7..2f0dc7a 100644
---- a/drivers/tty/serial/sh-sci.c
-+++ b/drivers/tty/serial/sh-sci.c
-@@ -2852,6 +2852,7 @@ static int sci_probe(struct platform_device *dev)
- return 0;
- }
-
-+#ifdef CONFIG_PM_SLEEP
- static int sci_suspend(struct device *dev)
- {
- struct sci_port *sport = dev_get_drvdata(dev);
-@@ -2871,10 +2872,13 @@ static int sci_resume(struct device *dev)
-
- return 0;
- }
-+#else
-+#define sci_suspend NULL
-+#define sci_resume NULL
-+#endif
-
- static const struct dev_pm_ops sci_dev_pm_ops = {
-- .suspend = sci_suspend,
-- .resume = sci_resume,
-+ SET_SYSTEM_SLEEP_PM_OPS(sci_suspend, sci_resume)
- };
-
- static struct platform_driver sci_driver = {
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0015-Add-rcar-usbphy-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0015-Add-rcar-usbphy-hibernation-code.patch
deleted file mode 100755
index c0c2b1675..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0015-Add-rcar-usbphy-hibernation-code.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 28393daa686ef43966e3fa1652bcd8d860698ef4 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Thu, 18 May 2017 18:00:39 +0900
-Subject: [PATCH 15/15] Add rcar-usbphy hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drivers/usb/phy/phy-rcar-gen2-usb.c | 35 +++++++++++++++++++++++++++++++++++
- 1 file changed, 35 insertions(+)
-
-diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c
-index 9e7205d..05849e7 100644
---- a/drivers/usb/phy/phy-rcar-gen2-usb.c
-+++ b/drivers/usb/phy/phy-rcar-gen2-usb.c
-@@ -148,6 +148,7 @@ static int rcar_gen2_usb_phy_set_suspend(struct usb_phy *phy, int suspend)
-
- devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
- devm_iounmap(&pdev->dev, priv->base);
-+ priv->base = NULL;
-
- spin_unlock_irqrestore(&priv->lock, flags);
-
-@@ -178,6 +179,7 @@ static int rcar_gen2_usb_phy_init(struct usb_phy *phy)
- devm_release_mem_region(&pdev->dev, res->start,
- resource_size(res));
- devm_iounmap(&pdev->dev, priv->base);
-+ priv->base = NULL;
- spin_unlock_irqrestore(&priv->lock, flags);
- }
- return 0;
-@@ -209,6 +211,7 @@ static void rcar_gen2_usb_phy_shutdown(struct usb_phy *phy)
- devm_release_mem_region(&pdev->dev, res->start,
- resource_size(res));
- devm_iounmap(&pdev->dev, priv->base);
-+ priv->base = NULL;
- }
- out:
- spin_unlock_irqrestore(&priv->lock, flags);
-@@ -431,9 +434,41 @@ static int phy_rcar_gen2_pm_resume(struct device *dev)
- return 0;
- }
-
-+static int phy_rcar_gen2_pm_freeze(struct device *dev)
-+{
-+ struct rcar_gen2_usb_phy_priv *priv = dev_get_drvdata(dev);
-+ pr_info("freeze: %p\n", priv->base);
-+
-+ return phy_rcar_gen2_pm_suspend(dev);
-+}
-+
-+static int phy_rcar_gen2_pm_restore(struct device *dev)
-+{
-+ struct rcar_gen2_usb_phy_priv *priv = dev_get_drvdata(dev);
-+ struct resource *res;
-+
-+ res = platform_get_resource(to_platform_device(dev), IORESOURCE_MEM, 0);
-+ priv->base = devm_ioremap_resource(dev, res);
-+ if (IS_ERR(priv->base)) {
-+ pr_info("restore: pointer error %ld\n", PTR_ERR(priv->base));
-+ return PTR_ERR(priv->base);
-+ }
-+ pr_info("restore: %p\n", priv->base);
-+ __rcar_gen2_usb_phy_init(priv);
-+ devm_release_mem_region(dev, res->start,
-+ resource_size(res));
-+ devm_iounmap(dev, priv->base);
-+ priv->base = NULL;
-+ return phy_rcar_gen2_pm_resume(dev);
-+}
-+
- static const struct dev_pm_ops phy_rcar_gen2_dev_pm_ops = {
- .suspend = phy_rcar_gen2_pm_suspend,
- .resume = phy_rcar_gen2_pm_resume,
-+ .freeze_noirq = phy_rcar_gen2_pm_freeze,
-+ .restore = phy_rcar_gen2_pm_restore,
-+ .thaw = phy_rcar_gen2_pm_resume,
-+ .poweroff = phy_rcar_gen2_pm_suspend,
- };
- #endif
-
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg
deleted file mode 100755
index eddb52ce7..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG_SWSUSP_AREA=0x78000000
-CONFIG_SWSUSP_AREA_SIZE=0x8000000
-CONFIG_HIBERNATE_CALLBACKS=y
-CONFIG_HIBERNATION=y
-CONFIG_PM_STD_PARTITION=""
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_MTD_SWAP=y
-CONFIG_MTD_PHRAM=y
-CONFIG_MMC_UNSAFE_RESUME=y
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/pppd-rcar.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/pppd-rcar.cfg
deleted file mode 100755
index e50b2e1fc..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/pppd-rcar.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_SLIP=m
-CONFIG_SLIP_COMPRESSED=y
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/ra2x00.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/ra2x00.cfg
deleted file mode 100644
index e20934352..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/ra2x00.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_RT2X00=m
-CONFIG_RT2800USB=m
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/files/0001-Fix-for-memory-corruption-during-hibernate.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/files/0001-Fix-for-memory-corruption-during-hibernate.patch
deleted file mode 100644
index de0365da5..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/files/0001-Fix-for-memory-corruption-during-hibernate.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From 99f60a25458ac553ff609f5bdbf4db7dade46d9a Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Sat, 10 Jun 2017 20:26:26 +0900
-Subject: [PATCH] Fix for memory corruption during hibernate
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drv/mmngr_drv.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 106 insertions(+), 3 deletions(-)
-
-diff --git a/drv/mmngr_drv.c b/drv/mmngr_drv.c
-index 797800f..91f6c6e 100755
---- a/drv/mmngr_drv.c
-+++ b/drv/mmngr_drv.c
-@@ -844,7 +844,7 @@ static struct miscdevice misc = {
- extern struct cma *rcar_gen2_dma_contiguous;
- #endif
-
--static int mm_init(void)
-+static int mmngr_probe(struct platform_device *pdev)
- {
- int ret = 0;
- struct MM_DRVDATA *p = NULL;
-@@ -946,16 +946,16 @@ static int mm_init(void)
- printk(KERN_ERR "MMD reserve area from 0x%08x to 0x%08x at physical\n",
- (unsigned int)phy_addr,
- (unsigned int)phy_addr + MM_KERNEL_RESERVE_SIZE - 1);
--#endif
- #ifdef MMNGR_IPMMU_ENABLE
- r8a779x_ipmmu_startup();
- r8a779x_ipmmu_initialize(IPMMUMX_DOMAIN);
- #endif
-+#endif
-
- return 0;
- }
-
--static void mm_exit(void)
-+static int mmngr_remove(struct platform_device *pdev)
- {
- #ifdef MMNGR_IPMMU_ENABLE
- r8a779x_ipmmu_cleanup();
-@@ -983,6 +983,109 @@ static void mm_exit(void)
- #endif
-
- kfree(mm_drvdata);
-+ return 0;
-+}
-+static int mmngr_suspend(struct device *dev)
-+{
-+ return 0;
-+}
-+static int mmngr_resume(struct device *dev)
-+{
-+ return 0;
-+}
-+static int mmngr_freeze(struct device *dev)
-+{
-+#if defined(MMNGR_KOELSCH) || defined(MMNGR_LAGER) || \
-+ defined(MMNGR_ALT) || defined(MMNGR_GOSE)
-+ iowrite32((~MM_IMPCTR_VAL) & ioread32(top_impctr), top_impctr);
-+#endif
-+ mm_set_mxi_path(0, 0);
-+ dma_free_coherent(mm_drvdata->mm_dev_reserve,
-+ mm_drvdata->reserve_size,
-+ (void *)mm_drvdata->reserve_kernel_virt_addr,
-+ (dma_addr_t)mm_drvdata->reserve_phy_addr);
-+ return 0;
-+}
-+static int mmngr_thaw(struct device *dev)
-+{
-+ void *pkernel_virt_addr;
-+ mm_set_mxi_path(MM_OMXBUF_MXI_ADDR,
-+ MM_OMXBUF_MXI_ADDR + MM_OMXBUF_SIZE);
-+ pkernel_virt_addr = dma_alloc_coherent(mm_drvdata->mm_dev_reserve,
-+ MM_KERNEL_RESERVE_SIZE,
-+ (dma_addr_t *)&mm_drvdata->reserve_phy_addr,
-+ GFP_KERNEL);
-+ mm_drvdata->reserve_kernel_virt_addr = (unsigned long)pkernel_virt_addr;
-+ return 0;
-+}
-+static int mmngr_restore(struct device *dev)
-+{
-+ void *pkernel_virt_addr;
-+ mm_set_mxi_path(MM_OMXBUF_MXI_ADDR,
-+ MM_OMXBUF_MXI_ADDR + MM_OMXBUF_SIZE);
-+
-+#ifdef MMNGR_KOELSCH
-+ if ((MM_PRR_ESMASK & ioread32(top_prr)) >= MM_PRR_ES2) {
-+ mm_enable_pmb();
-+ mm_set_pmb_area(MM_OMXBUF_ADDR, top_impmba0, top_impmbd0);
-+ mm_enable_vpc_utlb();
-+ }
-+#endif
-+#ifdef MMNGR_LAGER
-+ if ((MM_PRR_ESMASK & ioread32(top_prr)) >= MM_PRR_ES2) {
-+ mm_enable_pmb();
-+ mm_set_pmb_area(MM_OMXBUF_ADDR, top_impmba0, top_impmbd0);
-+ mm_set_pmb_area(MM_OMXBUF_ADDR + MM_PMB_SIZE_128M,
-+ top_impmba1, top_impmbd1);
-+ mm_enable_vpc_utlb();
-+ }
-+#endif
-+#ifdef MMNGR_ALT
-+ mm_enable_pmb();
-+ mm_set_pmb_area(MM_OMXBUF_ADDR, top_impmba0, top_impmbd0);
-+ mm_enable_vpc_utlb();
-+#endif
-+#ifdef MMNGR_GOSE
-+ mm_enable_pmb();
-+ mm_set_pmb_area(MM_OMXBUF_ADDR, top_impmba0, top_impmbd0);
-+ mm_enable_vpc_utlb();
-+#endif
-+ pkernel_virt_addr = dma_alloc_coherent(mm_drvdata->mm_dev_reserve,
-+ MM_KERNEL_RESERVE_SIZE,
-+ (dma_addr_t *)&mm_drvdata->reserve_phy_addr,
-+ GFP_KERNEL);
-+ mm_drvdata->reserve_kernel_virt_addr = (unsigned long)pkernel_virt_addr;
-+
-+ return 0;
-+}
-+static const struct dev_pm_ops mmngr_pm_ops = {
-+ SET_SYSTEM_SLEEP_PM_OPS(mmngr_suspend, mmngr_resume)
-+ .freeze = mmngr_freeze,
-+ .thaw = mmngr_thaw,
-+ .restore = mmngr_restore,
-+};
-+struct platform_driver mmngr_driver = {
-+ .probe = mmngr_probe,
-+ .remove = mmngr_remove,
-+ .driver = {
-+ .name = "mmngr",
-+ .pm = &mmngr_pm_ops,
-+ },
-+};
-+struct platform_device mmngr_device = {
-+ .name = "mmngr",
-+ .id = -1,
-+};
-+static int mm_init(void)
-+{
-+ platform_driver_register(&mmngr_driver);
-+ platform_device_register(&mmngr_device);
-+ return 0;
-+}
-+static void mm_exit(void)
-+{
-+ platform_device_unregister(&mmngr_device);
-+ platform_driver_unregister(&mmngr_driver);
- }
-
- module_init(mm_init);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/mmngr-kernel-module.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/mmngr-kernel-module.bbappend
deleted file mode 100644
index 7863beaf7..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/mmngr-module/mmngr-kernel-module.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
-FILESEXTRAPATHS_prepend := '${THISDIR}/files:'
-SRC_URI_append_agl-porter-hibernate = " file://0001-Fix-for-memory-corruption-during-hibernate.patch \
- "
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch
deleted file mode 100644
index b5d9050b2..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From 03253eae0da9a84e343a8f21c65ac07196369420 Mon Sep 17 00:00:00 2001
-From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
-Date: Sun, 21 May 2017 23:08:52 +0900
-Subject: [PATCH] Add s3ctl hibernation code
-
-Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
----
- drv/s3ctl_drv.c | 50 ++++++++++++++++++++++++++++++++++++++------------
- 1 file changed, 38 insertions(+), 12 deletions(-)
-
-diff --git a/drv/s3ctl_drv.c b/drv/s3ctl_drv.c
-index a7b4bee..6640a49 100755
---- a/drv/s3ctl_drv.c
-+++ b/drv/s3ctl_drv.c
-@@ -66,6 +66,7 @@
- #include <linux/ioctl.h>
- #include <linux/slab.h>
- #include <linux/dma-mapping.h>
-+#include <linux/suspend.h>
-
- #include "s3ctl_private.h"
-
-@@ -332,19 +333,10 @@ static struct miscdevice misc = {
- .fops = &fops,
- };
-
--
--static int s3ctrl_init(void)
-+static int s3ctl_initialize(void)
- {
-- int ret;
-- unsigned int product;
-- unsigned int es;
--
-- ret = map_register();
-- if (ret != 0) {
-- printk(KERN_ERR "S3D map_register() NG\n");
-- return -1;
-- }
--
-+ int product;
-+ int es;
- product = S3_PRR_PRODUCTMASK & ioread32((void *)top_prr);
- es = S3_PRR_ESMASK & ioread32((void *)top_prr);
- if (product == S3_PRR_H2) {
-@@ -366,11 +358,44 @@ static int s3ctrl_init(void)
- set_xymodeconf(S3_XYMODE_VAL_NEW);
- } else
- set_xymodeconf(S3_XYMODE_VAL_NEW);
-+ return 0;
-+}
-+
-+static int s3ctl_cpu_pm_notify(struct notifier_block *self,
-+ unsigned long action, void *hcpu)
-+{
-+ if (action == PM_HIBERNATION_PREPARE)
-+ ;
-+ else if (action == PM_POST_HIBERNATION) {
-+ pr_info("%s: hibernation finished: %ld\n", __func__, action);
-+ s3ctl_initialize();
-+ }
-+ return NOTIFY_DONE;
-+}
-+
-+static struct notifier_block s3ctl_pm_notifier_block = {
-+ .notifier_call = s3ctl_cpu_pm_notify,
-+};
-+
-+static int s3ctrl_init(void)
-+{
-+ int ret;
-+ unsigned int product;
-+ unsigned int es;
-+
-+ ret = map_register();
-+ if (ret != 0) {
-+ printk(KERN_ERR "S3D map_register() NG\n");
-+ return -1;
-+ }
-+ s3ctl_initialize();
-
- misc_register(&misc);
-
- spin_lock_init(&lock);
-
-+ register_pm_notifier(&s3ctl_pm_notifier_block);
-+
- return 0;
- }
-
-@@ -379,6 +404,7 @@ static void s3ctrl_exit(void)
- misc_deregister(&misc);
-
- unmap_register();
-+ unregister_pm_notifier(&s3ctl_pm_notifier_block);
- }
-
- module_init(s3ctrl_init);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend
deleted file mode 100644
index 172418402..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
-FILESEXTRAPATHS_prepend := '${THISDIR}/files:'
-SRC_URI_append_agl-porter-hibernate = " file://0001-Add-s3ctl-hibernation-code.patch \
- "
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/files/0001-Fix-Wformat-security-issue-in-named-open.patch b/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/files/0001-Fix-Wformat-security-issue-in-named-open.patch
deleted file mode 100644
index e2f332cee..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/files/0001-Fix-Wformat-security-issue-in-named-open.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 0b424ab0cd7811f158186d04b868aa2d88559df2 Mon Sep 17 00:00:00 2001
-From: Matt Ranostay <matt.ranostay@konsulko.com>
-Date: Tue, 28 Mar 2017 22:15:21 -0700
-Subject: [PATCH] Fix -Wformat-security issue in named-open
-
-Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
----
- src/tests/named-open.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/tests/named-open.c b/src/tests/named-open.c
-index 025aa506dad6..dea885babaae 100644
---- a/src/tests/named-open.c
-+++ b/src/tests/named-open.c
-@@ -49,7 +49,7 @@ main (int argc, char *argv[])
- uiomux_list_device(&name, &count);
-
- for (i = 0; i < count; i++)
-- printf(name[i]);
-+ printf("%s", name[i]);
-
- uiomux_list_device(&name2, &count);
-
---
-2.11.0
-
diff --git a/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/libuiomux_git.bbappend b/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/libuiomux_git.bbappend
deleted file mode 100644
index 3e64886c0..000000000
--- a/meta-agl-bsp/meta-renesas/recipes-multimedia/libuiomux/libuiomux_git.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI_append = " file://0001-Fix-Wformat-security-issue-in-named-open.patch"
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
index f1fd52d35..8d3e6c7a7 100644
--- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
+++ b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
@@ -20,35 +20,10 @@ DEPENDS_append_ti33x = " \
"
############## F I X M E #####################
-# FIXME pyro
-SRC_URI_append = " \
+# FIXME rocko
+DISABLED_ROCKO_SRC_URI_append = " \
file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \
"
-DISABLED_SRC_URI_append_ti43x = " \
- file://0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch \
- file://0003-gstkmssink-Add-support-for-KMS-based-sink.patch \
- file://0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch \
- file://0002-kmssink-remove-DCE-dependencies.patch \
- file://0003-kmssink-add-YUYV-support.patch \
- file://0001-gstwaylandsink-add-input-format-I420-support.patch \
-"
-
-# FIXME pyro
-DISABLED_SRC_URI_append_ti33x = " \
- file://0001-gstwaylandsink-Add-mouse-drag-and-drop-support.patch \
-"
-
-# FIXME pyro
-DISABLED_SRC_URI_append_omap-a15 = " \
- file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \
- file://0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch \
- file://0003-gstkmssink-Add-support-for-KMS-based-sink.patch \
- file://0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch \
- file://0002-kmssink-remove-DCE-dependencies.patch \
- file://0003-kmssink-add-YUYV-support.patch \
- file://0001-gstwaylandsink-add-input-format-I420-support.patch \
- file://0005-gstwaylandsink-Implement-callbacks-for-version-5-of-.patch \
-"
################ F I X M E ####################
PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend
new file mode 100644
index 000000000..e9a57d324
--- /dev/null
+++ b/meta-agl-bsp/meta-ti/recipes-graphics/wayland/wayland-ivi-extension_2.%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
+
+SRC_URI_append = "\
+ file://force-type-conversion.patch \
+ "
diff --git a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend b/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend
index 283e8b778..02161415f 100644
--- a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend
+++ b/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend
@@ -1,4 +1,2 @@
-require recipes-kernel/linux/linux-dtb.inc
-
require recipes-kernel/linux/linux-agl.inc
require recipes-kernel/linux/linux-agl-4.9.inc
diff --git a/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota/0002-fixup-build-with-gcc7.patch b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota/0002-fixup-build-with-gcc7.patch
new file mode 100644
index 000000000..fc7933ea0
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota/0002-fixup-build-with-gcc7.patch
@@ -0,0 +1,101 @@
+From eea58226f0b604d3047c495985197113838d3a7a Mon Sep 17 00:00:00 2001
+From: Trevor Woerner <twoerner@gmail.com>
+Date: Tue, 20 Jun 2017 13:25:20 -0400
+Subject: [PATCH] fix build for gcc7
+
+| In file included from .../include/linux/compiler.h:54:0,
+| from .../include/uapi/linux/stddef.h:1,
+| from .../include/linux/stddef.h:4,
+| from .../include/uapi/linux/posix_types.h:4,
+| from .../include/uapi/linux/types.h:13,
+| from .../include/linux/types.h:5,
+| from .../include/linux/mod_devicetable.h:11,
+| from .../scripts/mod/devicetable-offsets.c:2:
+| .../include/linux/compiler-gcc.h:121:1: fatal error: linux/compiler-gcc7.h: No such file or directory
+| #include gcc_header(__GNUC__)
+
+Upstream-Status: Pending
+
+Signed-off-by: Trevor Woerner <twoerner@gmail.com>
+Signed-off-by: Fabio Berton <fabio.berton@gmail.com>
+Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
+---
+ include/linux/compiler-gcc7.h | 66 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 66 insertions(+)
+ create mode 100644 include/linux/compiler-gcc7.h
+
+diff --git a/include/linux/compiler-gcc7.h b/include/linux/compiler-gcc7.h
+new file mode 100644
+index 0000000..cdd1cc2
+--- /dev/null
++++ b/include/linux/compiler-gcc7.h
+@@ -0,0 +1,66 @@
++#ifndef __LINUX_COMPILER_H
++#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
++#endif
++
++#define __used __attribute__((__used__))
++#define __must_check __attribute__((warn_unused_result))
++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
++
++/* Mark functions as cold. gcc will assume any path leading to a call
++ to them will be unlikely. This means a lot of manual unlikely()s
++ are unnecessary now for any paths leading to the usual suspects
++ like BUG(), printk(), panic() etc. [but let's keep them for now for
++ older compilers]
++
++ Early snapshots of gcc 4.3 don't support this and we can't detect this
++ in the preprocessor, but we can live with this because they're unreleased.
++ Maketime probing would be overkill here.
++
++ gcc also has a __attribute__((__hot__)) to move hot functions into
++ a special section, but I don't see any sense in this right now in
++ the kernel context */
++#define __cold __attribute__((__cold__))
++
++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
++
++#ifndef __CHECKER__
++# define __compiletime_warning(message) __attribute__((warning(message)))
++# define __compiletime_error(message) __attribute__((error(message)))
++#endif /* __CHECKER__ */
++
++/*
++ * Mark a position in code as unreachable. This can be used to
++ * suppress control flow warnings after asm blocks that transfer
++ * control elsewhere.
++ *
++ * Early snapshots of gcc 4.5 don't support this and we can't detect
++ * this in the preprocessor, but we can live with this because they're
++ * unreleased. Really, we need to have autoconf for the kernel.
++ */
++#define unreachable() __builtin_unreachable()
++
++/* Mark a function definition as prohibited from being cloned. */
++#define __noclone __attribute__((__noclone__))
++
++/*
++ * Tell the optimizer that something else uses this function or variable.
++ */
++#define __visible __attribute__((externally_visible))
++
++/*
++ * GCC 'asm goto' miscompiles certain code sequences:
++ *
++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
++ *
++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
++ * Fixed in GCC 4.8.2 and later versions.
++ *
++ * (asm goto is automatically volatile - the naming reflects this.)
++ */
++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
++
++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
++#define __HAVE_BUILTIN_BSWAP32__
++#define __HAVE_BUILTIN_BSWAP64__
++#define __HAVE_BUILTIN_BSWAP16__
++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+--
+2.7.4
+
diff --git a/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb
index 37abc5a50..7ef3cacd4 100644
--- a/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb
+++ b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb
@@ -14,6 +14,7 @@ SRC_URI = "\
file://0001-Set-up-environment-for-OSTree-integration.patch \
file://0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch \
file://0001-fixup-build-with-gcc6.patch \
+ file://0002-fixup-build-with-gcc7.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.1.bbappend b/meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend
index db50df5d9..db50df5d9 100644
--- a/meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.1.bbappend
+++ b/meta-agl-bsp/recipes-graphics/harfbuzz/harfbuzz_1.4.8.bbappend
diff --git a/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch b/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch
deleted file mode 100644
index 4f1905492..000000000
--- a/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 0b316ee830765eb1d68cdece5fd4c991e9fba96c Mon Sep 17 00:00:00 2001
-From: Changhyeok Bae <changhyeok.bae@gmail.com>
-Date: Sat, 8 Jul 2017 15:22:09 +0900
-Subject: [PATCH] Use $llvm_prefix variable directly
-
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index ac110e8..d094ca6 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -896,7 +896,7 @@ fi
-
- if test -z "$LLVM_CONFIG"; then
- if test -n "$llvm_prefix"; then
-- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
-+ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix"])
- else
- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
- fi
---
-1.9.1
-
diff --git a/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend b/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend
index 13273792b..49e527707 100644
--- a/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend
+++ b/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,7 +1,3 @@
-FILESEXTRAPATHS_prepend_qemux86-64 := "${THISDIR}/${BPN}:"
-SRC_URI_append_qemux86-64 = " file://0001-Use-llvm_prefix-variable-directly.patch"
-EXTRA_OECONF_qemux86-64 = "--enable-shared-glapi --with-llvm-prefix=${STAGING_BINDIR_CROSS}"
-
# The gallium-llvm is recommended as software 3D graphics renderer
GALLIUM_LLVM = "gallium-llvm"
PACKAGECONFIG_append_qemux86 = " gallium ${GALLIUM_LLVM}"
diff --git a/meta-agl-bsp/meta-intel/recipes-graphics/wayland/libva_%.bbappend b/meta-agl-bsp/recipes-graphics/wayland/libva_%.bbappend
index eda8de38a..eda8de38a 100644
--- a/meta-agl-bsp/meta-intel/recipes-graphics/wayland/libva_%.bbappend
+++ b/meta-agl-bsp/recipes-graphics/wayland/libva_%.bbappend
diff --git a/meta-agl-bsp/recipes-kernel/linux/kernel-devsrc.bbappend b/meta-agl-bsp/recipes-kernel/linux/kernel-devsrc.bbappend
new file mode 100644
index 000000000..52fe69d24
--- /dev/null
+++ b/meta-agl-bsp/recipes-kernel/linux/kernel-devsrc.bbappend
@@ -0,0 +1,6 @@
+# fix for kernel using hardcoded awk while our filesystem only provides gawk
+do_install_append() {
+ # enforce all scripts to use /usr/bin/awk . This fixes the rpm dependency failure on install of kernel-devsrc
+ cd ${D} || true
+ ( for i in `grep -srI "\!/bin/awk" | cut -d":" -f1 ` ; do sed -i -e "s#\!/bin/awk#\!/usr/bin/env awk#g" $i ; done ) || true
+} \ No newline at end of file
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-agl-4.9.inc b/meta-agl-bsp/recipes-kernel/linux/linux-agl-4.9.inc
index 3235ff4d1..c4ebf4d46 100644
--- a/meta-agl-bsp/recipes-kernel/linux/linux-agl-4.9.inc
+++ b/meta-agl-bsp/recipes-kernel/linux/linux-agl-4.9.inc
@@ -3,6 +3,6 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/linux-4.9:"
#-------------------------------------------------------------------------
# smack patches for handling bluetooth
-SRC_URI_append_smack = "\
+SRC_URI_append_with-lsm-smack = "\
file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \
"
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-agl.inc b/meta-agl-bsp/recipes-kernel/linux/linux-agl.inc
index db37ab2f5..b6f9604a5 100644
--- a/meta-agl-bsp/recipes-kernel/linux/linux-agl.inc
+++ b/meta-agl-bsp/recipes-kernel/linux/linux-agl.inc
@@ -67,7 +67,7 @@ SRC_URI_append_virtualmachine = " file://vbox-vmware-sata.cfg"
KERNEL_CONFIG_FRAGMENTS_append_virtualmachine = " ${WORKDIR}/vbox-vmware-sata.cfg"
# Enable support for smack
-KERNEL_CONFIG_FRAGMENTS_append_smack = "\
+KERNEL_CONFIG_FRAGMENTS_append_with-lsm-smack = "\
${WORKDIR}/audit.cfg \
${WORKDIR}/smack.cfg \
${WORKDIR}/smack-default-lsm.cfg \
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/0001-fanotify-fix-notification-of-groups-with-inode-mount.patch b/meta-agl-bsp/recipes-kernel/linux/linux-yocto/0001-fanotify-fix-notification-of-groups-with-inode-mount.patch
deleted file mode 100644
index c50c152a1..000000000
--- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/0001-fanotify-fix-notification-of-groups-with-inode-mount.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-From 8edc6e1688fc8f02c8c1f53a2ec4928cb1055f4d Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Thu, 13 Nov 2014 15:19:33 -0800
-Subject: [PATCH] fanotify: fix notification of groups with inode & mount marks
-
-fsnotify() needs to merge inode and mount marks lists when notifying
-groups about events so that ignore masks from inode marks are reflected
-in mount mark notifications and groups are notified in proper order
-(according to priorities).
-
-Currently the sorting of the lists done by fsnotify_add_inode_mark() /
-fsnotify_add_vfsmount_mark() and fsnotify() differed which resulted
-ignore masks not being used in some cases.
-
-Fix the problem by always using the same comparison function when
-sorting / merging the mark lists.
-
-Thanks to Heinrich Schuchardt for improvements of my patch.
-
-Link: https://bugzilla.kernel.org/show_bug.cgi?id=87721
-Signed-off-by: Jan Kara <jack@suse.cz>
-Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----
- fs/notify/fsnotify.c | 36 +++++++++++++++++++++---------------
- fs/notify/fsnotify.h | 4 ++++
- fs/notify/inode_mark.c | 8 +++-----
- fs/notify/mark.c | 36 ++++++++++++++++++++++++++++++++++++
- fs/notify/vfsmount_mark.c | 8 +++-----
- 5 files changed, 67 insertions(+), 25 deletions(-)
-
-diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
-index 9d3e9c5..89326ac 100644
---- a/fs/notify/fsnotify.c
-+++ b/fs/notify/fsnotify.c
-@@ -229,8 +229,16 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
- &fsnotify_mark_srcu);
- }
-
-+ /*
-+ * We need to merge inode & vfsmount mark lists so that inode mark
-+ * ignore masks are properly reflected for mount mark notifications.
-+ * That's why this traversal is so complicated...
-+ */
- while (inode_node || vfsmount_node) {
-- inode_group = vfsmount_group = NULL;
-+ inode_group = NULL;
-+ inode_mark = NULL;
-+ vfsmount_group = NULL;
-+ vfsmount_mark = NULL;
-
- if (inode_node) {
- inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu),
-@@ -244,21 +252,19 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
- vfsmount_group = vfsmount_mark->group;
- }
-
-- if (inode_group > vfsmount_group) {
-- /* handle inode */
-- ret = send_to_group(to_tell, inode_mark, NULL, mask,
-- data, data_is, cookie, file_name);
-- /* we didn't use the vfsmount_mark */
-- vfsmount_group = NULL;
-- } else if (vfsmount_group > inode_group) {
-- ret = send_to_group(to_tell, NULL, vfsmount_mark, mask,
-- data, data_is, cookie, file_name);
-- inode_group = NULL;
-- } else {
-- ret = send_to_group(to_tell, inode_mark, vfsmount_mark,
-- mask, data, data_is, cookie,
-- file_name);
-+ if (inode_group && vfsmount_group) {
-+ int cmp = fsnotify_compare_groups(inode_group,
-+ vfsmount_group);
-+ if (cmp > 0) {
-+ inode_group = NULL;
-+ inode_mark = NULL;
-+ } else if (cmp < 0) {
-+ vfsmount_group = NULL;
-+ vfsmount_mark = NULL;
-+ }
- }
-+ ret = send_to_group(to_tell, inode_mark, vfsmount_mark, mask,
-+ data, data_is, cookie, file_name);
-
- if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS))
- goto out;
-diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h
-index 9c0898c..3b68b0a 100644
---- a/fs/notify/fsnotify.h
-+++ b/fs/notify/fsnotify.h
-@@ -12,6 +12,10 @@ extern void fsnotify_flush_notify(struct fsnotify_group *group);
- /* protects reads of inode and vfsmount marks list */
- extern struct srcu_struct fsnotify_mark_srcu;
-
-+/* compare two groups for sorting of marks lists */
-+extern int fsnotify_compare_groups(struct fsnotify_group *a,
-+ struct fsnotify_group *b);
-+
- extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark,
- __u32 mask);
- /* add a mark to an inode */
-diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
-index e849714..dfbf544 100644
---- a/fs/notify/inode_mark.c
-+++ b/fs/notify/inode_mark.c
-@@ -194,6 +194,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
- {
- struct fsnotify_mark *lmark, *last = NULL;
- int ret = 0;
-+ int cmp;
-
- mark->flags |= FSNOTIFY_MARK_FLAG_INODE;
-
-@@ -219,11 +220,8 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
- goto out;
- }
-
-- if (mark->group->priority < lmark->group->priority)
-- continue;
--
-- if ((mark->group->priority == lmark->group->priority) &&
-- (mark->group < lmark->group))
-+ cmp = fsnotify_compare_groups(lmark->group, mark->group);
-+ if (cmp < 0)
- continue;
-
- hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list);
-diff --git a/fs/notify/mark.c b/fs/notify/mark.c
-index d90deaa..34c38fa 100644
---- a/fs/notify/mark.c
-+++ b/fs/notify/mark.c
-@@ -210,6 +210,42 @@ void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mas
- }
-
- /*
-+ * Sorting function for lists of fsnotify marks.
-+ *
-+ * Fanotify supports different notification classes (reflected as priority of
-+ * notification group). Events shall be passed to notification groups in
-+ * decreasing priority order. To achieve this marks in notification lists for
-+ * inodes and vfsmounts are sorted so that priorities of corresponding groups
-+ * are descending.
-+ *
-+ * Furthermore correct handling of the ignore mask requires processing inode
-+ * and vfsmount marks of each group together. Using the group address as
-+ * further sort criterion provides a unique sorting order and thus we can
-+ * merge inode and vfsmount lists of marks in linear time and find groups
-+ * present in both lists.
-+ *
-+ * A return value of 1 signifies that b has priority over a.
-+ * A return value of 0 signifies that the two marks have to be handled together.
-+ * A return value of -1 signifies that a has priority over b.
-+ */
-+int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b)
-+{
-+ if (a == b)
-+ return 0;
-+ if (!a)
-+ return 1;
-+ if (!b)
-+ return -1;
-+ if (a->priority < b->priority)
-+ return 1;
-+ if (a->priority > b->priority)
-+ return -1;
-+ if (a < b)
-+ return 1;
-+ return -1;
-+}
-+
-+/*
- * Attach an initialized mark to a given group and fs object.
- * These marks may be used for the fsnotify backend to determine which
- * event types should be delivered to which group.
-diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c
-index ac851e8..faefa72 100644
---- a/fs/notify/vfsmount_mark.c
-+++ b/fs/notify/vfsmount_mark.c
-@@ -153,6 +153,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
- struct mount *m = real_mount(mnt);
- struct fsnotify_mark *lmark, *last = NULL;
- int ret = 0;
-+ int cmp;
-
- mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT;
-
-@@ -178,11 +179,8 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
- goto out;
- }
-
-- if (mark->group->priority < lmark->group->priority)
-- continue;
--
-- if ((mark->group->priority == lmark->group->priority) &&
-- (mark->group < lmark->group))
-+ cmp = fsnotify_compare_groups(lmark->group, mark->group);
-+ if (cmp < 0)
- continue;
-
- hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list);
---
-1.8.3.1
-
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch b/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch
deleted file mode 100644
index e9fafad74..000000000
--- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch
+++ /dev/null
@@ -1,900 +0,0 @@
-From 3982d0807e02909957990f194c5ed2ffb6ab6c35 Mon Sep 17 00:00:00 2001
-From: Hugh Dickins <hughd@google.com>
-Date: Mon, 19 Jun 2017 04:03:24 -0700
-Subject: [PATCH 1/3] mm: larger stack guard gap, between vmas
-
-commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream.
-
-Stack guard page is a useful feature to reduce a risk of stack smashing
-into a different mapping. We have been using a single page gap which
-is sufficient to prevent having stack adjacent to a different mapping.
-But this seems to be insufficient in the light of the stack usage in
-userspace. E.g. glibc uses as large as 64kB alloca() in many commonly
-used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX]
-which is 256kB or stack strings with MAX_ARG_STRLEN.
-
-This will become especially dangerous for suid binaries and the default
-no limit for the stack size limit because those applications can be
-tricked to consume a large portion of the stack and a single glibc call
-could jump over the guard page. These attacks are not theoretical,
-unfortunatelly.
-
-Make those attacks less probable by increasing the stack guard gap
-to 1MB (on systems with 4k pages; but make it depend on the page size
-because systems with larger base pages might cap stack allocations in
-the PAGE_SIZE units) which should cover larger alloca() and VLA stack
-allocations. It is obviously not a full fix because the problem is
-somehow inherent, but it should reduce attack space a lot.
-
-One could argue that the gap size should be configurable from userspace,
-but that can be done later when somebody finds that the new 1MB is wrong
-for some special case applications. For now, add a kernel command line
-option (stack_guard_gap) to specify the stack gap size (in page units).
-
-Implementation wise, first delete all the old code for stack guard page:
-because although we could get away with accounting one extra page in a
-stack vma, accounting a larger gap can break userspace - case in point,
-a program run with "ulimit -S -v 20000" failed when the 1MB gap was
-counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK
-and strict non-overcommit mode.
-
-Instead of keeping gap inside the stack vma, maintain the stack guard
-gap as a gap between vmas: using vm_start_gap() in place of vm_start
-(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few
-places which need to respect the gap - mainly arch_get_unmapped_area(),
-and and the vma tree's subtree_gap support for that.
-
-Original-patch-by: Oleg Nesterov <oleg@redhat.com>
-Original-patch-by: Michal Hocko <mhocko@suse.com>
-Signed-off-by: Hugh Dickins <hughd@google.com>
-Acked-by: Michal Hocko <mhocko@suse.com>
-Tested-by: Helge Deller <deller@gmx.de> # parisc
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-[wt: backport to 4.11: adjust context]
-[wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide]
-[wt: backport to 4.4: adjust context ; drop ppc hugetlb_radix changes]
-Signed-off-by: Willy Tarreau <w@1wt.eu>
-[gkh: minor build fixes for 4.4]
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- Documentation/kernel-parameters.txt | 7 ++
- arch/arc/mm/mmap.c | 2 +-
- arch/arm/mm/mmap.c | 4 +-
- arch/frv/mm/elf-fdpic.c | 2 +-
- arch/mips/mm/mmap.c | 2 +-
- arch/parisc/kernel/sys_parisc.c | 15 ++--
- arch/powerpc/mm/slice.c | 2 +-
- arch/s390/mm/mmap.c | 4 +-
- arch/sh/mm/mmap.c | 4 +-
- arch/sparc/kernel/sys_sparc_64.c | 4 +-
- arch/sparc/mm/hugetlbpage.c | 2 +-
- arch/tile/mm/hugetlbpage.c | 2 +-
- arch/x86/kernel/sys_x86_64.c | 4 +-
- arch/x86/mm/hugetlbpage.c | 2 +-
- arch/xtensa/kernel/syscall.c | 2 +-
- fs/hugetlbfs/inode.c | 2 +-
- fs/proc/task_mmu.c | 4 -
- include/linux/mm.h | 53 ++++++-------
- mm/gup.c | 5 --
- mm/memory.c | 38 ---------
- mm/mmap.c | 149 +++++++++++++++++++++---------------
- 21 files changed, 149 insertions(+), 160 deletions(-)
-
-diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
-index c360f80..9738c8b 100644
---- a/Documentation/kernel-parameters.txt
-+++ b/Documentation/kernel-parameters.txt
-@@ -3576,6 +3576,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
- spia_pedr=
- spia_peddr=
-
-+ stack_guard_gap= [MM]
-+ override the default stack gap protection. The value
-+ is in page units and it defines how many pages prior
-+ to (for stacks growing down) resp. after (for stacks
-+ growing up) the main stack are reserved for no other
-+ mapping. Default value is 256 pages.
-+
- stacktrace [FTRACE]
- Enabled the stack tracer on boot up.
-
-diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c
-index 2e06d56..cf4ae69 100644
---- a/arch/arc/mm/mmap.c
-+++ b/arch/arc/mm/mmap.c
-@@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
-index 407dc78..c469c06 100644
---- a/arch/arm/mm/mmap.c
-+++ b/arch/arm/mm/mmap.c
-@@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -140,7 +140,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c
-index 836f147..efa59f1 100644
---- a/arch/frv/mm/elf-fdpic.c
-+++ b/arch/frv/mm/elf-fdpic.c
-@@ -74,7 +74,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
- addr = PAGE_ALIGN(addr);
- vma = find_vma(current->mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- goto success;
- }
-
-diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
-index 5c81fdd..025cb31 100644
---- a/arch/mips/mm/mmap.c
-+++ b/arch/mips/mm/mmap.c
-@@ -92,7 +92,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
-index 5aba01a..4dda73c 100644
---- a/arch/parisc/kernel/sys_parisc.c
-+++ b/arch/parisc/kernel/sys_parisc.c
-@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- unsigned long len, unsigned long pgoff, unsigned long flags)
- {
- struct mm_struct *mm = current->mm;
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- unsigned long task_size = TASK_SIZE;
- int do_color_align, last_mmap;
- struct vm_unmapped_area_info info;
-@@ -115,9 +115,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- else
- addr = PAGE_ALIGN(addr);
-
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- goto found_addr;
- }
-
-@@ -141,7 +142,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- const unsigned long len, const unsigned long pgoff,
- const unsigned long flags)
- {
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct mm_struct *mm = current->mm;
- unsigned long addr = addr0;
- int do_color_align, last_mmap;
-@@ -175,9 +176,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = COLOR_ALIGN(addr, last_mmap, pgoff);
- else
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- goto found_addr;
- }
-
-diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
-index 0f432a7..6ad12b2 100644
---- a/arch/powerpc/mm/slice.c
-+++ b/arch/powerpc/mm/slice.c
-@@ -105,7 +105,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr,
- if ((mm->task_size - len) < addr)
- return 0;
- vma = find_vma(mm, addr);
-- return (!vma || (addr + len) <= vma->vm_start);
-+ return (!vma || (addr + len) <= vm_start_gap(vma));
- }
-
- static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice)
-diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
-index f2b6b1d..126c4a9 100644
---- a/arch/s390/mm/mmap.c
-+++ b/arch/s390/mm/mmap.c
-@@ -97,7 +97,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -135,7 +135,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
-index 6777177..7df7d59 100644
---- a/arch/sh/mm/mmap.c
-+++ b/arch/sh/mm/mmap.c
-@@ -63,7 +63,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -113,7 +113,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
-index c690c8e..7f0f7c01 100644
---- a/arch/sparc/kernel/sys_sparc_64.c
-+++ b/arch/sparc/kernel/sys_sparc_64.c
-@@ -118,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
-
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -181,7 +181,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
-
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
-index da11424..ffa842b 100644
---- a/arch/sparc/mm/hugetlbpage.c
-+++ b/arch/sparc/mm/hugetlbpage.c
-@@ -115,7 +115,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, HPAGE_SIZE);
- vma = find_vma(mm, addr);
- if (task_size - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
-index c034dc3..c97ee6c 100644
---- a/arch/tile/mm/hugetlbpage.c
-+++ b/arch/tile/mm/hugetlbpage.c
-@@ -232,7 +232,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (current->mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
-index 10e0272..136ad7c 100644
---- a/arch/x86/kernel/sys_x86_64.c
-+++ b/arch/x86/kernel/sys_x86_64.c
-@@ -143,7 +143,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (end - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-@@ -186,7 +186,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- addr = PAGE_ALIGN(addr);
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
-index 42982b2..39bdaf3 100644
---- a/arch/x86/mm/hugetlbpage.c
-+++ b/arch/x86/mm/hugetlbpage.c
-@@ -144,7 +144,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
- if (mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
-index 83cf496..3aaaae1 100644
---- a/arch/xtensa/kernel/syscall.c
-+++ b/arch/xtensa/kernel/syscall.c
-@@ -87,7 +87,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- /* At this point: (!vmm || addr < vmm->vm_end). */
- if (TASK_SIZE - len < addr)
- return -ENOMEM;
-- if (!vmm || addr + len <= vmm->vm_start)
-+ if (!vmm || addr + len <= vm_start_gap(vmm))
- return addr;
- addr = vmm->vm_end;
- if (flags & MAP_SHARED)
-diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
-index 595ebdb..a17da8b5 100644
---- a/fs/hugetlbfs/inode.c
-+++ b/fs/hugetlbfs/inode.c
-@@ -191,7 +191,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
- addr = ALIGN(addr, huge_page_size(h));
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
-
-diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index d598b9c..cb7020c 100644
---- a/fs/proc/task_mmu.c
-+++ b/fs/proc/task_mmu.c
-@@ -295,11 +295,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
-
- /* We don't show the stack guard page in /proc/maps */
- start = vma->vm_start;
-- if (stack_guard_page_start(vma, start))
-- start += PAGE_SIZE;
- end = vma->vm_end;
-- if (stack_guard_page_end(vma, end))
-- end -= PAGE_SIZE;
-
- seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
- seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
-diff --git a/include/linux/mm.h b/include/linux/mm.h
-index f0ffa01..55f950a 100644
---- a/include/linux/mm.h
-+++ b/include/linux/mm.h
-@@ -1278,39 +1278,11 @@ int clear_page_dirty_for_io(struct page *page);
-
- int get_cmdline(struct task_struct *task, char *buffer, int buflen);
-
--/* Is the vma a continuation of the stack vma above it? */
--static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
--{
-- return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
--}
--
- static inline bool vma_is_anonymous(struct vm_area_struct *vma)
- {
- return !vma->vm_ops;
- }
-
--static inline int stack_guard_page_start(struct vm_area_struct *vma,
-- unsigned long addr)
--{
-- return (vma->vm_flags & VM_GROWSDOWN) &&
-- (vma->vm_start == addr) &&
-- !vma_growsdown(vma->vm_prev, addr);
--}
--
--/* Is the vma a continuation of the stack vma below it? */
--static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr)
--{
-- return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP);
--}
--
--static inline int stack_guard_page_end(struct vm_area_struct *vma,
-- unsigned long addr)
--{
-- return (vma->vm_flags & VM_GROWSUP) &&
-- (vma->vm_end == addr) &&
-- !vma_growsup(vma->vm_next, addr);
--}
--
- int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t);
-
- extern unsigned long move_page_tables(struct vm_area_struct *vma,
-@@ -2012,6 +1984,7 @@ void page_cache_async_readahead(struct address_space *mapping,
- pgoff_t offset,
- unsigned long size);
-
-+extern unsigned long stack_guard_gap;
- /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
- extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
-
-@@ -2040,6 +2013,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m
- return vma;
- }
-
-+static inline unsigned long vm_start_gap(struct vm_area_struct *vma)
-+{
-+ unsigned long vm_start = vma->vm_start;
-+
-+ if (vma->vm_flags & VM_GROWSDOWN) {
-+ vm_start -= stack_guard_gap;
-+ if (vm_start > vma->vm_start)
-+ vm_start = 0;
-+ }
-+ return vm_start;
-+}
-+
-+static inline unsigned long vm_end_gap(struct vm_area_struct *vma)
-+{
-+ unsigned long vm_end = vma->vm_end;
-+
-+ if (vma->vm_flags & VM_GROWSUP) {
-+ vm_end += stack_guard_gap;
-+ if (vm_end < vma->vm_end)
-+ vm_end = -PAGE_SIZE;
-+ }
-+ return vm_end;
-+}
-+
- static inline unsigned long vma_pages(struct vm_area_struct *vma)
- {
- return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-diff --git a/mm/gup.c b/mm/gup.c
-index 4b0b7e7..b599526 100644
---- a/mm/gup.c
-+++ b/mm/gup.c
-@@ -312,11 +312,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
- /* mlock all present pages, but do not fault in new pages */
- if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK)
- return -ENOENT;
-- /* For mm_populate(), just skip the stack guard page. */
-- if ((*flags & FOLL_POPULATE) &&
-- (stack_guard_page_start(vma, address) ||
-- stack_guard_page_end(vma, address + PAGE_SIZE)))
-- return -ENOENT;
- if (*flags & FOLL_WRITE)
- fault_flags |= FAULT_FLAG_WRITE;
- if (nonblocking)
-diff --git a/mm/memory.c b/mm/memory.c
-index 76dcee3..e6fa134 100644
---- a/mm/memory.c
-+++ b/mm/memory.c
-@@ -2662,40 +2662,6 @@ out_release:
- }
-
- /*
-- * This is like a special single-page "expand_{down|up}wards()",
-- * except we must first make sure that 'address{-|+}PAGE_SIZE'
-- * doesn't hit another vma.
-- */
--static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address)
--{
-- address &= PAGE_MASK;
-- if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
-- struct vm_area_struct *prev = vma->vm_prev;
--
-- /*
-- * Is there a mapping abutting this one below?
-- *
-- * That's only ok if it's the same stack mapping
-- * that has gotten split..
-- */
-- if (prev && prev->vm_end == address)
-- return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
--
-- return expand_downwards(vma, address - PAGE_SIZE);
-- }
-- if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) {
-- struct vm_area_struct *next = vma->vm_next;
--
-- /* As VM_GROWSDOWN but s/below/above/ */
-- if (next && next->vm_start == address + PAGE_SIZE)
-- return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM;
--
-- return expand_upwards(vma, address + PAGE_SIZE);
-- }
-- return 0;
--}
--
--/*
- * We enter with non-exclusive mmap_sem (to exclude vma changes,
- * but allow concurrent faults), and pte mapped but not yet locked.
- * We return with mmap_sem still held, but pte unmapped and unlocked.
-@@ -2715,10 +2681,6 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
- if (vma->vm_flags & VM_SHARED)
- return VM_FAULT_SIGBUS;
-
-- /* Check if we need to add a guard page to the stack */
-- if (check_stack_guard_page(vma, address) < 0)
-- return VM_FAULT_SIGSEGV;
--
- /* Use the zero-page for reads */
- if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm)) {
- entry = pte_mkspecial(pfn_pte(my_zero_pfn(address),
-diff --git a/mm/mmap.c b/mm/mmap.c
-index 455772a..5e043dd 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -288,6 +288,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
- unsigned long retval;
- unsigned long newbrk, oldbrk;
- struct mm_struct *mm = current->mm;
-+ struct vm_area_struct *next;
- unsigned long min_brk;
- bool populate;
-
-@@ -332,7 +333,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
- }
-
- /* Check against existing mmap mappings. */
-- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
-+ next = find_vma(mm, oldbrk);
-+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next))
- goto out;
-
- /* Ok, looks good - let it rip. */
-@@ -355,10 +357,22 @@ out:
-
- static long vma_compute_subtree_gap(struct vm_area_struct *vma)
- {
-- unsigned long max, subtree_gap;
-- max = vma->vm_start;
-- if (vma->vm_prev)
-- max -= vma->vm_prev->vm_end;
-+ unsigned long max, prev_end, subtree_gap;
-+
-+ /*
-+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we
-+ * allow two stack_guard_gaps between them here, and when choosing
-+ * an unmapped area; whereas when expanding we only require one.
-+ * That's a little inconsistent, but keeps the code here simpler.
-+ */
-+ max = vm_start_gap(vma);
-+ if (vma->vm_prev) {
-+ prev_end = vm_end_gap(vma->vm_prev);
-+ if (max > prev_end)
-+ max -= prev_end;
-+ else
-+ max = 0;
-+ }
- if (vma->vm_rb.rb_left) {
- subtree_gap = rb_entry(vma->vm_rb.rb_left,
- struct vm_area_struct, vm_rb)->rb_subtree_gap;
-@@ -451,7 +465,7 @@ static void validate_mm(struct mm_struct *mm)
- anon_vma_unlock_read(anon_vma);
- }
-
-- highest_address = vma->vm_end;
-+ highest_address = vm_end_gap(vma);
- vma = vma->vm_next;
- i++;
- }
-@@ -620,7 +634,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma,
- if (vma->vm_next)
- vma_gap_update(vma->vm_next);
- else
-- mm->highest_vm_end = vma->vm_end;
-+ mm->highest_vm_end = vm_end_gap(vma);
-
- /*
- * vma->vm_prev wasn't known when we followed the rbtree to find the
-@@ -866,7 +880,7 @@ again: remove_next = 1 + (end > next->vm_end);
- vma_gap_update(vma);
- if (end_changed) {
- if (!next)
-- mm->highest_vm_end = end;
-+ mm->highest_vm_end = vm_end_gap(vma);
- else if (!adjust_next)
- vma_gap_update(next);
- }
-@@ -909,7 +923,7 @@ again: remove_next = 1 + (end > next->vm_end);
- else if (next)
- vma_gap_update(next);
- else
-- mm->highest_vm_end = end;
-+ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma));
- }
- if (insert && file)
- uprobe_mmap(insert);
-@@ -1741,7 +1755,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
-
- while (true) {
- /* Visit left subtree if it looks promising */
-- gap_end = vma->vm_start;
-+ gap_end = vm_start_gap(vma);
- if (gap_end >= low_limit && vma->vm_rb.rb_left) {
- struct vm_area_struct *left =
- rb_entry(vma->vm_rb.rb_left,
-@@ -1752,7 +1766,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info)
- }
- }
-
-- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
-+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
- check_current:
- /* Check if current node has a suitable gap */
- if (gap_start > high_limit)
-@@ -1779,8 +1793,8 @@ check_current:
- vma = rb_entry(rb_parent(prev),
- struct vm_area_struct, vm_rb);
- if (prev == vma->vm_rb.rb_left) {
-- gap_start = vma->vm_prev->vm_end;
-- gap_end = vma->vm_start;
-+ gap_start = vm_end_gap(vma->vm_prev);
-+ gap_end = vm_start_gap(vma);
- goto check_current;
- }
- }
-@@ -1844,7 +1858,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
-
- while (true) {
- /* Visit right subtree if it looks promising */
-- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0;
-+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0;
- if (gap_start <= high_limit && vma->vm_rb.rb_right) {
- struct vm_area_struct *right =
- rb_entry(vma->vm_rb.rb_right,
-@@ -1857,7 +1871,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info)
-
- check_current:
- /* Check if current node has a suitable gap */
-- gap_end = vma->vm_start;
-+ gap_end = vm_start_gap(vma);
- if (gap_end < low_limit)
- return -ENOMEM;
- if (gap_start <= high_limit && gap_end - gap_start >= length)
-@@ -1883,7 +1897,7 @@ check_current:
- struct vm_area_struct, vm_rb);
- if (prev == vma->vm_rb.rb_right) {
- gap_start = vma->vm_prev ?
-- vma->vm_prev->vm_end : 0;
-+ vm_end_gap(vma->vm_prev) : 0;
- goto check_current;
- }
- }
-@@ -1921,7 +1935,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
- unsigned long len, unsigned long pgoff, unsigned long flags)
- {
- struct mm_struct *mm = current->mm;
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct vm_unmapped_area_info info;
-
- if (len > TASK_SIZE - mmap_min_addr)
-@@ -1932,9 +1946,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
-
- if (addr) {
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- return addr;
- }
-
-@@ -1957,7 +1972,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- const unsigned long len, const unsigned long pgoff,
- const unsigned long flags)
- {
-- struct vm_area_struct *vma;
-+ struct vm_area_struct *vma, *prev;
- struct mm_struct *mm = current->mm;
- unsigned long addr = addr0;
- struct vm_unmapped_area_info info;
-@@ -1972,9 +1987,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- /* requesting a specific address */
- if (addr) {
- addr = PAGE_ALIGN(addr);
-- vma = find_vma(mm, addr);
-+ vma = find_vma_prev(mm, addr, &prev);
- if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
-- (!vma || addr + len <= vma->vm_start))
-+ (!vma || addr + len <= vm_start_gap(vma)) &&
-+ (!prev || addr >= vm_end_gap(prev)))
- return addr;
- }
-
-@@ -2099,21 +2115,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr,
- * update accounting. This is shared with both the
- * grow-up and grow-down cases.
- */
--static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow)
-+static int acct_stack_growth(struct vm_area_struct *vma,
-+ unsigned long size, unsigned long grow)
- {
- struct mm_struct *mm = vma->vm_mm;
- struct rlimit *rlim = current->signal->rlim;
-- unsigned long new_start, actual_size;
-+ unsigned long new_start;
-
- /* address space limit tests */
- if (!may_expand_vm(mm, grow))
- return -ENOMEM;
-
- /* Stack limit test */
-- actual_size = size;
-- if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
-- actual_size -= PAGE_SIZE;
-- if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
-+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
- return -ENOMEM;
-
- /* mlock limit tests */
-@@ -2151,17 +2165,30 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
- int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- {
- struct mm_struct *mm = vma->vm_mm;
-+ struct vm_area_struct *next;
-+ unsigned long gap_addr;
- int error = 0;
-
- if (!(vma->vm_flags & VM_GROWSUP))
- return -EFAULT;
-
- /* Guard against wrapping around to address 0. */
-- if (address < PAGE_ALIGN(address+4))
-- address = PAGE_ALIGN(address+4);
-- else
-+ address &= PAGE_MASK;
-+ address += PAGE_SIZE;
-+ if (!address)
- return -ENOMEM;
-
-+ /* Enforce stack_guard_gap */
-+ gap_addr = address + stack_guard_gap;
-+ if (gap_addr < address)
-+ return -ENOMEM;
-+ next = vma->vm_next;
-+ if (next && next->vm_start < gap_addr) {
-+ if (!(next->vm_flags & VM_GROWSUP))
-+ return -ENOMEM;
-+ /* Check that both stack segments have the same anon_vma? */
-+ }
-+
- /* We must make sure the anon_vma is allocated. */
- if (unlikely(anon_vma_prepare(vma)))
- return -ENOMEM;
-@@ -2206,7 +2233,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- if (vma->vm_next)
- vma_gap_update(vma->vm_next);
- else
-- mm->highest_vm_end = address;
-+ mm->highest_vm_end = vm_end_gap(vma);
- spin_unlock(&mm->page_table_lock);
-
- perf_event_mmap(vma);
-@@ -2227,6 +2254,8 @@ int expand_downwards(struct vm_area_struct *vma,
- unsigned long address)
- {
- struct mm_struct *mm = vma->vm_mm;
-+ struct vm_area_struct *prev;
-+ unsigned long gap_addr;
- int error;
-
- address &= PAGE_MASK;
-@@ -2234,6 +2263,17 @@ int expand_downwards(struct vm_area_struct *vma,
- if (error)
- return error;
-
-+ /* Enforce stack_guard_gap */
-+ gap_addr = address - stack_guard_gap;
-+ if (gap_addr > address)
-+ return -ENOMEM;
-+ prev = vma->vm_prev;
-+ if (prev && prev->vm_end > gap_addr) {
-+ if (!(prev->vm_flags & VM_GROWSDOWN))
-+ return -ENOMEM;
-+ /* Check that both stack segments have the same anon_vma? */
-+ }
-+
- /* We must make sure the anon_vma is allocated. */
- if (unlikely(anon_vma_prepare(vma)))
- return -ENOMEM;
-@@ -2289,28 +2329,25 @@ int expand_downwards(struct vm_area_struct *vma,
- return error;
- }
-
--/*
-- * Note how expand_stack() refuses to expand the stack all the way to
-- * abut the next virtual mapping, *unless* that mapping itself is also
-- * a stack mapping. We want to leave room for a guard page, after all
-- * (the guard page itself is not added here, that is done by the
-- * actual page faulting logic)
-- *
-- * This matches the behavior of the guard page logic (see mm/memory.c:
-- * check_stack_guard_page()), which only allows the guard page to be
-- * removed under these circumstances.
-- */
-+/* enforced gap between the expanding stack and other mappings. */
-+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT;
-+
-+static int __init cmdline_parse_stack_guard_gap(char *p)
-+{
-+ unsigned long val;
-+ char *endptr;
-+
-+ val = simple_strtoul(p, &endptr, 10);
-+ if (!*endptr)
-+ stack_guard_gap = val << PAGE_SHIFT;
-+
-+ return 0;
-+}
-+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);
-+
- #ifdef CONFIG_STACK_GROWSUP
- int expand_stack(struct vm_area_struct *vma, unsigned long address)
- {
-- struct vm_area_struct *next;
--
-- address &= PAGE_MASK;
-- next = vma->vm_next;
-- if (next && next->vm_start == address + PAGE_SIZE) {
-- if (!(next->vm_flags & VM_GROWSUP))
-- return -ENOMEM;
-- }
- return expand_upwards(vma, address);
- }
-
-@@ -2332,14 +2369,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr)
- #else
- int expand_stack(struct vm_area_struct *vma, unsigned long address)
- {
-- struct vm_area_struct *prev;
--
-- address &= PAGE_MASK;
-- prev = vma->vm_prev;
-- if (prev && prev->vm_end == address) {
-- if (!(prev->vm_flags & VM_GROWSDOWN))
-- return -ENOMEM;
-- }
- return expand_downwards(vma, address);
- }
-
-@@ -2437,7 +2466,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
- vma->vm_prev = prev;
- vma_gap_update(vma);
- } else
-- mm->highest_vm_end = prev ? prev->vm_end : 0;
-+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0;
- tail_vma->vm_next = NULL;
-
- /* Kill the cache */
---
-2.1.4
-
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch b/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch
deleted file mode 100644
index d0c94cef2..000000000
--- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From cd20f002742028366c33b38b3ca613eaee4582c9 Mon Sep 17 00:00:00 2001
-From: Helge Deller <deller@gmx.de>
-Date: Mon, 19 Jun 2017 17:34:05 +0200
-Subject: [PATCH 2/3] Allow stack to grow up to address space limit
-
-commit bd726c90b6b8ce87602208701b208a208e6d5600 upstream.
-
-Fix expand_upwards() on architectures with an upward-growing stack (parisc,
-metag and partly IA-64) to allow the stack to reliably grow exactly up to
-the address space limit given by TASK_SIZE.
-
-Signed-off-by: Helge Deller <deller@gmx.de>
-Acked-by: Hugh Dickins <hughd@google.com>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- mm/mmap.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/mm/mmap.c b/mm/mmap.c
-index 5e043dd..fcf4c88 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -2172,16 +2172,19 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
- if (!(vma->vm_flags & VM_GROWSUP))
- return -EFAULT;
-
-- /* Guard against wrapping around to address 0. */
-+ /* Guard against exceeding limits of the address space. */
- address &= PAGE_MASK;
-- address += PAGE_SIZE;
-- if (!address)
-+ if (address >= TASK_SIZE)
- return -ENOMEM;
-+ address += PAGE_SIZE;
-
- /* Enforce stack_guard_gap */
- gap_addr = address + stack_guard_gap;
-- if (gap_addr < address)
-- return -ENOMEM;
-+
-+ /* Guard against overflow */
-+ if (gap_addr < address || gap_addr > TASK_SIZE)
-+ gap_addr = TASK_SIZE;
-+
- next = vma->vm_next;
- if (next && next->vm_start < gap_addr) {
- if (!(next->vm_flags & VM_GROWSUP))
---
-2.1.4
-
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch b/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch
deleted file mode 100644
index 3f0acfa29..000000000
--- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 1c182004bcb1cd619b58ba6631b9d88052d18e02 Mon Sep 17 00:00:00 2001
-From: Hugh Dickins <hughd@google.com>
-Date: Tue, 20 Jun 2017 02:10:44 -0700
-Subject: [PATCH 3/3] mm: fix new crash in unmapped_area_topdown()
-
-commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream.
-
-Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of
-mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the
-end of unmapped_area_topdown(). Linus points out how MAP_FIXED
-(which does not have to respect our stack guard gap intentions)
-could result in gap_end below gap_start there. Fix that, and
-the similar case in its alternative, unmapped_area().
-
-Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas")
-Reported-by: Dave Jones <davej@codemonkey.org.uk>
-Debugged-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Hugh Dickins <hughd@google.com>
-Acked-by: Michal Hocko <mhocko@suse.com>
-Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- mm/mmap.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/mm/mmap.c b/mm/mmap.c
-index fcf4c88..0990f8b 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -1771,7 +1771,8 @@ check_current:
- /* Check if current node has a suitable gap */
- if (gap_start > high_limit)
- return -ENOMEM;
-- if (gap_end >= low_limit && gap_end - gap_start >= length)
-+ if (gap_end >= low_limit &&
-+ gap_end > gap_start && gap_end - gap_start >= length)
- goto found;
-
- /* Visit right subtree if it looks promising */
-@@ -1874,7 +1875,8 @@ check_current:
- gap_end = vm_start_gap(vma);
- if (gap_end < low_limit)
- return -ENOMEM;
-- if (gap_start <= high_limit && gap_end - gap_start >= length)
-+ if (gap_start <= high_limit &&
-+ gap_end > gap_start && gap_end - gap_start >= length)
- goto found;
-
- /* Visit left subtree if it looks promising */
---
-2.1.4
-
diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend b/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend
deleted file mode 100644
index 45c170661..000000000
--- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend
+++ /dev/null
@@ -1,14 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:"
-
-# Backported fix for CVE-2017-1000364
-SRC_URI_append_core2-32-intel-common = "\
- file://4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch \
- file://4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch \
- file://4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \
-"
-
-SRC_URI_append_corei7-64-intel-common = "\
- file://4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch \
- file://4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch \
- file://4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \
-"
diff --git a/meta-agl-bsp/recipes-support/open-vm-tools/files/tools.conf b/meta-agl-bsp/recipes-support/open-vm-tools/files/tools.conf
deleted file mode 100644
index f6cae70cc..000000000
--- a/meta-agl-bsp/recipes-support/open-vm-tools/files/tools.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[guestinfo]
-disable-perf-mon=1
diff --git a/meta-agl-bsp/recipes-support/open-vm-tools/files/vmtoolsd.service b/meta-agl-bsp/recipes-support/open-vm-tools/files/vmtoolsd.service
deleted file mode 100644
index d30e38055..000000000
--- a/meta-agl-bsp/recipes-support/open-vm-tools/files/vmtoolsd.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Open Virtual Machine Tools (VMware Tools)
-ConditionVirtualization=vmware
-
-[Service]
-ExecStart=/usr/bin/vmtoolsd
-Restart=on-failure
-KillSignal=SIGKILL
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch b/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
deleted file mode 100644
index e9cb873f1..000000000
--- a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 929150608c16644695f19cd2e0cc8a06a41cd497 Mon Sep 17 00:00:00 2001
-From: Martin Kelly <mkelly@xevo.com>
-Date: Fri, 7 Apr 2017 15:20:30 -0700
-Subject: [PATCH] configure.ac: don't use dnet-config
-
-The dnet-config tool doesn't know about cross-compilation, so it injects
--I/usr/include into the path, causing compiler errors. So instead find dnet via
--ldnet.
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Martin Kelly <mkelly@xevo.com>
----
- configure.ac | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 3400b86..7d6119e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -942,7 +942,7 @@ if test "$with_dnet" = "yes"; then
- AC_VMW_CHECK_LIB([dnet],
- [DNET],
- [],
-- [dnet-config],
-+ [],
- [],
- [dnet.h],
- [intf_open],
-@@ -952,7 +952,7 @@ if test "$with_dnet" = "yes"; then
-
- if test $have_dnet = "no"; then
- AC_MSG_ERROR(
-- [dnet-config was not found on your PATH. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net])
-+ [dnet was not found. Please configure without dnet (using --without-dnet) or install dnet - http://libdnet.sourceforge.net])
- fi
- fi
-
---
-2.1.4
-
diff --git a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0002-add-include-sys-sysmacros.h.patch b/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0002-add-include-sys-sysmacros.h.patch
deleted file mode 100644
index f905601d5..000000000
--- a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools/0002-add-include-sys-sysmacros.h.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 5818acc8032e3247257730376e947330340a07b3 Mon Sep 17 00:00:00 2001
-From: Martin Kelly <mkelly@xevo.com>
-Date: Mon, 22 May 2017 17:00:05 -0700
-Subject: [PATCH 2/2] add #include <sys/sysmacros.h>
-
-In newer glibc versions, the definition for major() has been moved to
-sys/sysmacros.h, and using the older version in <sys/types.h> has been
-deprecated. So, add an include for <sys/sysmacros.h>.
-
-Upstream-Status: Pending
-
-Signed-off-by: Martin Kelly <mkelly@xevo.com>
----
- lib/wiper/wiperPosix.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/open-vm-tools/lib/wiper/wiperPosix.c b/open-vm-tools/lib/wiper/wiperPosix.c
-index d389eee..1f221fc 100644
---- a/lib/wiper/wiperPosix.c
-+++ b/lib/wiper/wiperPosix.c
-@@ -40,6 +40,9 @@
- # include <libgen.h>
- # endif /* __FreeBSD_version >= 500000 */
- #endif
-+#if defined(__linux__)
-+#include <sys/sysmacros.h>
-+#endif
- #include <unistd.h>
-
- #include "vmware.h"
---
-2.7.4
-
diff --git a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb b/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
deleted file mode 100644
index 65fbfc9e9..000000000
--- a/meta-agl-bsp/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
+++ /dev/null
@@ -1,84 +0,0 @@
-# This recipe is modified from the recipe originally found in the Open-Switch
-# repository:
-#
-# https://github.com/open-switch/ops-build
-# yocto/openswitch/meta-foss-openswitch/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.0.5.bb
-# Commit 9008de2d8e100f3f868c66765742bca9fa98f3f9
-#
-# The recipe packaging has been relicensed under the MIT license for inclusion
-# in meta-openembedded by agreement of the author (Diego Dompe).
-#
-
-SUMMARY = "Tools to enhance VMWare guest integration and performance"
-HOMEPAGE = "https://github.com/vmware/open-vm-tools"
-SECTION = "vmware-tools"
-
-LICENSE = "LGPLv2.1 & GPLv2 & BSD & CDDLv1"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=b66ba4cb4fc017682c95efc300410e79"
-LICENSE_modules/freebsd/vmblock = "BSD"
-LICENSE_modules/freebsd/vmmemctl = "GPLv2"
-LICENSE_modules/freebsd/vmxnet = "GPLv2"
-LICENSE_modules/linux = "GPLv2"
-LICENSE_modules/solaris = "CDDLv1"
-
-SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \
- file://tools.conf \
- file://vmtoolsd.service \
- file://0001-configure.ac-don-t-use-dnet-config.patch \
- file://0002-add-include-sys-sysmacros.h.patch \
- "
-
-SRCREV = "854c0bb374612f7e633b448ca273f970f154458b"
-
-S = "${WORKDIR}/git/open-vm-tools"
-
-DEPENDS = "glib-2.0 glib-2.0-native util-linux libdnet procps"
-
-# open-vm-tools is supported only on x86.
-COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
-
-inherit autotools pkgconfig systemd
-
-SYSTEMD_SERVICE_${PN} = "vmtoolsd.service"
-
-EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \
- --disable-tests --without-gtkmm --without-xerces --without-pam \
- --disable-grabbitmqproxy --disable-vgauth --disable-deploypkg \
- --without-root-privileges --without-kernel-modules"
-
-NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3"
-X11_DEPENDS = "libxext libxi libxrender libxrandr libxtst gtk+ gdk-pixbuf"
-PACKAGECONFIG[x11] = ",${NO_X11_FLAGS},${X11_DEPENDS}"
-
-# fuse gets implicitly detected; there is no --without-fuse option.
-PACKAGECONFIG[fuse] = ",,fuse"
-
-FILES_${PN} += "\
- ${libdir}/open-vm-tools/plugins/vmsvc/lib*.so \
- ${libdir}/open-vm-tools/plugins/common/lib*.so \
- ${sysconfdir}/vmware-tools/tools.conf \
- "
-FILES_${PN}-locale += "${datadir}/open-vm-tools/messages"
-FILES_${PN}-dev += "${libdir}/open-vm-tools/plugins/common/lib*.la"
-FILES_${PN}-dbg += "\
- ${libdir}/open-vm-tools/plugins/common/.debug \
- ${libdir}/open-vm-tools/plugins/vmsvc/.debug \
- "
-
-CONFFILES_${PN} += "${sysconfdir}/vmware-tools/tools.conf"
-
-RDEPENDS_${PN} = "util-linux libdnet fuse"
-
-do_install_append() {
- ln -sf ${sbindir}/mount.vmhgfs ${D}/sbin/mount.vmhgfs
- install -d ${D}${systemd_unitdir}/system ${D}${sysconfdir}/vmware-tools
- install -m 644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/tools.conf ${D}${sysconfdir}/vmware-tools/tools.conf
-}
-
-do_configure_prepend() {
- export CUSTOM_PROCPS_NAME=procps
- export CUSTOM_PROCPS_LIBS=-L${STAGING_LIBDIR}/libprocps.so
- export CUSTOM_DNET_NAME=dnet
- export CUSTOM_DNET_LIBS=-L${STAGING_LIBDIR}/libdnet.so
-}
diff --git a/meta-agl-distro/conf/distro/poky-agl.conf b/meta-agl-distro/conf/distro/poky-agl.conf
index 235cc8434..8e8fd7ae1 100644
--- a/meta-agl-distro/conf/distro/poky-agl.conf
+++ b/meta-agl-distro/conf/distro/poky-agl.conf
@@ -69,26 +69,17 @@ DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
PREFERRED_VERSION_wayland-ivi-extension ?= "2.0.%"
# Prefer GStreamer 1.10.x by default
-PREFERRED_VERSION_gstreamer1.0 ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-plugins-bad ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-plugins-base ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-plugins-good ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-plugins-ugly ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-libav ?= "1.10.%"
-PREFERRED_VERSION_gstreamer1.0-omx ?= "1.2.%"
+PREFERRED_VERSION_gstreamer1.0 ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-plugins-bad ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-plugins-base ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-plugins-good ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-plugins-ugly ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-libav ?= "1.12.%"
+PREFERRED_VERSION_gstreamer1.0-omx ?= "1.12.%"
# Prefer libjpeg-turbo
PREFERRED_PROVIDER_jpeg = "libjpeg-turbo"
-# GPLv3 Compliance
-PREFERRED_VERSION_bash = "3.2.%"
-PREFERRED_VERSION_gawk = "3.1.%"
-#PREFERRED_VERSION_gdbm = "1.8.%"
-PREFERRED_VERSION_gnupg = "1.4.7"
-PREFERRED_VERSION_gnutls = "3.3.%"
-PREFERRED_VERSION_mc = "4.7.5.%"
-PREFERRED_VERSION_readline = "5.2"
-
# using multiple BSP layers causes dangling bbappends in meta-agl-bsp
# turn it into a warning
#BB_DANGLINGAPPENDS_WARNONLY = "1"
diff --git a/meta-agl/conf/include/agl-devel.inc b/meta-agl/conf/include/agl-devel.inc
index c24143593..fd11ade75 100644
--- a/meta-agl/conf/include/agl-devel.inc
+++ b/meta-agl/conf/include/agl-devel.inc
@@ -4,7 +4,7 @@ IMAGE_INSTALL_append = " \
packagegroup-agl-devel \
"
-IMAGE_INSTALL_append = "${@bb.utils.contains_any('IMAGE_FSTYPES', [ 'vmdk', 'vmdk.xz' ], ' open-vm-tools vboxguestdrivers', '', d)}"
+IMAGE_INSTALL_append = "${@bb.utils.contains('IMAGE_FSTYPES', 'wic.vmdk', ' open-vm-tools vboxguestdrivers', '', d)}"
# disable install of debug files in SDK
# initial value: SDKIMAGE_FEATURES="dev-pkgs dbg-pkgs staticdev-pkgs"
diff --git a/meta-agl/conf/include/agl-gplv2.inc b/meta-agl/conf/include/agl-gplv2.inc
new file mode 100644
index 000000000..fc9a4072b
--- /dev/null
+++ b/meta-agl/conf/include/agl-gplv2.inc
@@ -0,0 +1,8 @@
+# GPLv3 Compliance
+PREFERRED_VERSION_bash = "3.2.%"
+PREFERRED_VERSION_gawk = "3.1.%"
+PREFERRED_VERSION_gdbm = "1.8.%"
+PREFERRED_VERSION_gnupg = "1.4.7"
+PREFERRED_VERSION_gnutls = "3.3.%"
+PREFERRED_VERSION_mc = "4.7.5.%"
+PREFERRED_VERSION_readline = "5.2"
diff --git a/meta-agl/files/group b/meta-agl/files/group
index d910f0f83..f8a3843bd 100644
--- a/meta-agl/files/group
+++ b/meta-agl/files/group
@@ -86,3 +86,5 @@ postdrop::954:
display::200:
agl-driver::1001:
agl-passenger::1002:
+systemd-network::1005:
+systemd-resolve::1006:
diff --git a/meta-agl/files/passwd b/meta-agl/files/passwd
index df4c23e74..754cb819a 100644
--- a/meta-agl/files/passwd
+++ b/meta-agl/files/passwd
@@ -56,3 +56,5 @@ opensaf::957:957:::
lldpd::956:956:::
cyrus::955:8:::
display::200:200:::
+systemd-network::1005:1005:::
+systemd-resolve::1006:1006:::
diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/cve-2017-1000250.patch b/meta-agl/recipes-connectivity/bluez5/bluez5/cve-2017-1000250.patch
deleted file mode 100644
index 9fac961bc..000000000
--- a/meta-agl/recipes-connectivity/bluez5/bluez5/cve-2017-1000250.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-All versions of the SDP server in BlueZ 5.46 and earlier are vulnerable to an
-information disclosure vulnerability which allows remote attackers to obtain
-sensitive information from the bluetoothd process memory. This vulnerability
-lies in the processing of SDP search attribute requests.
-
-CVE: CVE-2017-1000250
-Upstream-Status: Backport
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From 9e009647b14e810e06626dde7f1bb9ea3c375d09 Mon Sep 17 00:00:00 2001
-From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
-Date: Wed, 13 Sep 2017 10:01:40 +0300
-Subject: sdp: Fix Out-of-bounds heap read in service_search_attr_req function
-
-Check if there is enough data to continue otherwise return an error.
----
- src/sdpd-request.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sdpd-request.c b/src/sdpd-request.c
-index 1eefdce..318d044 100644
---- a/src/sdpd-request.c
-+++ b/src/sdpd-request.c
-@@ -917,7 +917,7 @@ static int service_search_attr_req(sdp_req_t *req, sdp_buf_t *buf)
- } else {
- /* continuation State exists -> get from cache */
- sdp_buf_t *pCache = sdp_get_cached_rsp(cstate);
-- if (pCache) {
-+ if (pCache && cstate->cStateValue.maxBytesSent < pCache->data_size) {
- uint16_t sent = MIN(max, pCache->data_size - cstate->cStateValue.maxBytesSent);
- pResponse = pCache->data;
- memcpy(buf->data, pResponse + cstate->cStateValue.maxBytesSent, sent);
---
-cgit v1.1
diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend
index 543681550..ffb9d5b53 100644
--- a/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend
+++ b/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend
@@ -1,6 +1,5 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
-SRC_URI_append = " file://bluetooth.conf \
- file://cve-2017-1000250.patch"
+SRC_URI_append = " file://bluetooth.conf"
do_install_append() {
install -m 0644 ${WORKDIR}/bluetooth.conf ${D}${sysconfdir}/dbus-1/system.d/bluetooth.conf
diff --git a/meta-agl/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch b/meta-agl/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch
index b4704de68..95fc0a905 100644
--- a/meta-agl/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch
+++ b/meta-agl/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch
@@ -1,9 +1,10 @@
--- a/src/connman.service.in 2016-08-15 13:51:03.479478140 +0200
+++ b/src/connman.service.in 2016-08-15 13:51:33.469478267 +0200
-@@ -6,6 +6,7 @@ RequiresMountsFor=@localstatedir@/lib/co
+@@ -7,6 +7,7 @@ RequiresMountsFor=@localstatedir@/lib/co
After=dbus.service network-pre.target systemd-sysusers.service
Before=network.target multi-user.target shutdown.target
Wants=network.target
+ Conflicts=systemd-resolved.service
+ConditionKernelCommandLine=!root=/dev/nfs
[Service]
diff --git a/meta-agl/recipes-connectivity/rygel/files/0001-Add-LightMediaScanner-plugin.patch b/meta-agl/recipes-connectivity/rygel/files/0001-Add-LightMediaScanner-plugin.patch
deleted file mode 100644
index eca08ee84..000000000
--- a/meta-agl/recipes-connectivity/rygel/files/0001-Add-LightMediaScanner-plugin.patch
+++ /dev/null
@@ -1,2541 +0,0 @@
-From 8bb9ae73464dd76f5fa94f2e9ba76b0bd88114df Mon Sep 17 00:00:00 2001
-From: Manuel Bachmann <manuel.bachmann@iot.bzh>
-Date: Mon, 26 Oct 2015 04:18:33 +0000
-Subject: [PATCH] Add LightMediaScanner plugin
-
-Add a new plugin based on LightMediaScanner :
-https://github.com/profusion/lightmediascanner
-
-Shorty put, this plugin does not do the indexing itself as
-"media-export" does, but defers this task to the
-"lightmediascannerd" daemon, with which it communicates
-via a D-Bus interface.
-The remote indexing daemon installs itself as a separate
-package, and is designed to be ultra-lightweight and fast.
-
-This commit is the rebase and fusion of all work done
-first on Maemo (lms.garage.maemo.org), then on Tizen IVI
-(review.tizen.org/git/?p=profile/ivi/rygel.git) and right
-now on AGL (automotivelinux.org) where several components
-depend on LightMediaScanner.
-A splitted version (13 commits) can also be seen on :
-https://github.com/Tarnyko/rygel
-
-It difffers mostly in that it lets "media-export" plugin
-as the default, just adding itself in "rygel.conf" as an
-alternative.
-
-(note : reporter is not code Author, see patch for details)
-(note 2 : rebased on top of 0.26.1)
-
-Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Author: Alexander Kanavin <alex.kanavin@gmail.com>
-Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
----
- configure.ac | 18 +
- data/rygel.conf | 6 +-
- src/plugins/Makefile.am | 5 +
- src/plugins/lms/Makefile.am | 46 +++
- src/plugins/lms/README | 17 +
- src/plugins/lms/lms.plugin.in | 7 +
- src/plugins/lms/rygel-lms-album.vala | 173 +++++++++
- src/plugins/lms/rygel-lms-albums.vala | 175 +++++++++
- src/plugins/lms/rygel-lms-all-images.vala | 95 +++++
- src/plugins/lms/rygel-lms-all-music.vala | 169 ++++++++
- src/plugins/lms/rygel-lms-all-videos.vala | 123 ++++++
- src/plugins/lms/rygel-lms-artist.vala | 75 ++++
- src/plugins/lms/rygel-lms-artists.vala | 62 +++
- src/plugins/lms/rygel-lms-category-container.vala | 428 +++++++++++++++++++++
- src/plugins/lms/rygel-lms-collate.c | 49 +++
- src/plugins/lms/rygel-lms-database.vala | 294 ++++++++++++++
- src/plugins/lms/rygel-lms-dbus-interfaces.vala | 30 ++
- src/plugins/lms/rygel-lms-image-root.vala | 35 ++
- src/plugins/lms/rygel-lms-image-year.vala | 114 ++++++
- src/plugins/lms/rygel-lms-image-years.vala | 59 +++
- src/plugins/lms/rygel-lms-music-root.vala | 36 ++
- src/plugins/lms/rygel-lms-plugin-factory.vala | 40 ++
- src/plugins/lms/rygel-lms-plugin.vala | 35 ++
- src/plugins/lms/rygel-lms-root-container.vala | 58 +++
- src/plugins/lms/rygel-lms-sql-function.vala | 31 ++
- src/plugins/lms/rygel-lms-sql-operator.vala | 73 ++++
- 26 files changed, 2252 insertions(+), 1 deletion(-)
- create mode 100644 src/plugins/lms/Makefile.am
- create mode 100644 src/plugins/lms/README
- create mode 100644 src/plugins/lms/lms.plugin.in
- create mode 100644 src/plugins/lms/rygel-lms-album.vala
- create mode 100644 src/plugins/lms/rygel-lms-albums.vala
- create mode 100644 src/plugins/lms/rygel-lms-all-images.vala
- create mode 100644 src/plugins/lms/rygel-lms-all-music.vala
- create mode 100644 src/plugins/lms/rygel-lms-all-videos.vala
- create mode 100644 src/plugins/lms/rygel-lms-artist.vala
- create mode 100644 src/plugins/lms/rygel-lms-artists.vala
- create mode 100644 src/plugins/lms/rygel-lms-category-container.vala
- create mode 100644 src/plugins/lms/rygel-lms-collate.c
- create mode 100644 src/plugins/lms/rygel-lms-database.vala
- create mode 100644 src/plugins/lms/rygel-lms-dbus-interfaces.vala
- create mode 100644 src/plugins/lms/rygel-lms-image-root.vala
- create mode 100644 src/plugins/lms/rygel-lms-image-year.vala
- create mode 100644 src/plugins/lms/rygel-lms-image-years.vala
- create mode 100644 src/plugins/lms/rygel-lms-music-root.vala
- create mode 100644 src/plugins/lms/rygel-lms-plugin-factory.vala
- create mode 100644 src/plugins/lms/rygel-lms-plugin.vala
- create mode 100644 src/plugins/lms/rygel-lms-root-container.vala
- create mode 100644 src/plugins/lms/rygel-lms-sql-function.vala
- create mode 100644 src/plugins/lms/rygel-lms-sql-operator.vala
-
-diff --git a/configure.ac b/configure.ac
-index 7ae1105..275fd99 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -170,6 +170,18 @@ AS_IF([test "x$enable_ruih_plugin" = "xyes"],
- libxml-2.0 >= $LIBXML_REQUIRED])
- ])
-
-+
-+RYGEL_ADD_PLUGIN([lms],[LightMediaScanner],[yes])
-+AS_IF([test "x$enable_lms_plugin" = "xyes"],
-+ [
-+ PKG_CHECK_MODULES([RYGEL_PLUGIN_LMS_DEPS],
-+ [$RYGEL_COMMON_MODULES
-+ gio-2.0 >= $GIO_REQUIRED
-+ sqlite3 >= $LIBSQLITE3_REQUIRED])
-+ RYGEL_PLUGIN_LMS_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gio-2.0 --pkg gee-0.8 --pkg sqlite3"
-+ AC_SUBST([RYGEL_PLUGIN_LMS_DEPS_VALAFLAGS])
-+ ])
-+
- AS_IF([test "x$with_media_engine" = "xgstreamer"],
- [
- RYGEL_ADD_PLUGIN([playbin],[GStreamer playbin],[yes])
-@@ -332,6 +344,11 @@ then
- fi
- fi
-
-+dnl Check additional requirements for LMS plugin
-+if test "x$enable_lms_plugin" = "xyes";
-+then
-+ RYGEL_CHECK_PACKAGES([sqlite3])
-+fi
-
- RYGEL_ADD_PLUGIN([tracker],[Tracker],[yes])
- AS_IF([test "x$enable_tracker_plugin" = "xyes"],
-@@ -513,6 +530,7 @@ echo "
- version: ${tracker_api_version}
- mediathek: ${enable_mediathek_plugin}
- media-export ${enable_media_export_plugin}
-+ lightmediascanner ${enable_lms_plugin}
- external: ${enable_external_plugin}
- MPRIS2: ${enable_mpris_plugin}
- gst-launch: ${enable_gst_launch_plugin}
-diff --git a/data/rygel.conf b/data/rygel.conf
-index 6b1c1c4..8677a0d 100644
---- a/data/rygel.conf
-+++ b/data/rygel.conf
-@@ -99,7 +99,7 @@ strict-sharing=false
- title=@REALNAME@'s media on @PRETTY_HOSTNAME@
-
- [MediaExport]
--enabled=true
-+enabled=false
- title=@REALNAME@'s media on @PRETTY_HOSTNAME@
- # List of URIs to export. Following variables are automatically substituted by
- # the appropriate XDG standard media folders by Rygel for you.
-@@ -114,6 +114,10 @@ monitor-changes=true
- monitor-grace-timeout=5
- virtual-folders=true
-
-+[LightMediaScanner]
-+enabled=true
-+title=My Media
-+
- [Playbin]
- enabled=true
- title=Audio/Video playback on @PRETTY_HOSTNAME@
-diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
-index d116f09..40791f0 100644
---- a/src/plugins/Makefile.am
-+++ b/src/plugins/Makefile.am
-@@ -10,6 +10,10 @@ if BUILD_MEDIA_EXPORT_PLUGIN
- MEDIA_EXPORT_PLUGIN = media-export
- endif
-
-+if BUILD_LMS_PLUGIN
-+LMS_PLUGIN = lms
-+endif
-+
- if BUILD_EXTERNAL_PLUGIN
- EXTERNAL_PLUGIN = external
- endif
-@@ -33,6 +37,7 @@ endif
- SUBDIRS = $(TRACKER_PLUGIN) \
- $(MEDIATHEK_PLUGIN) \
- $(MEDIA_EXPORT_PLUGIN) \
-+ $(LMS_PLUGIN) \
- $(EXTERNAL_PLUGIN) \
- $(MPRIS_PLUGIN) \
- $(GST_LAUNCH_PLUGIN) \
-diff --git a/src/plugins/lms/Makefile.am b/src/plugins/lms/Makefile.am
-new file mode 100644
-index 0000000..f96a2ab
---- /dev/null
-+++ b/src/plugins/lms/Makefile.am
-@@ -0,0 +1,46 @@
-+include $(top_srcdir)/common.am
-+
-+plugin_LTLIBRARIES = librygel-lms.la
-+plugin_DATA = lms.plugin
-+
-+librygel_lms_la_SOURCES = \
-+ rygel-lms-plugin.vala \
-+ rygel-lms-plugin-factory.vala \
-+ rygel-lms-root-container.vala \
-+ rygel-lms-music-root.vala \
-+ rygel-lms-image-root.vala \
-+ rygel-lms-category-container.vala \
-+ rygel-lms-all-music.vala \
-+ rygel-lms-album.vala \
-+ rygel-lms-albums.vala \
-+ rygel-lms-artist.vala \
-+ rygel-lms-artists.vala \
-+ rygel-lms-all-videos.vala \
-+ rygel-lms-database.vala \
-+ rygel-lms-all-images.vala \
-+ rygel-lms-image-years.vala \
-+ rygel-lms-image-year.vala \
-+ rygel-lms-sql-function.vala \
-+ rygel-lms-sql-operator.vala \
-+ rygel-lms-collate.c \
-+ rygel-lms-dbus-interfaces.vala
-+
-+librygel_lms_la_VALAFLAGS = \
-+ --enable-experimental \
-+ $(RYGEL_PLUGIN_LMS_DEPS_VALAFLAGS) \
-+ $(RYGEL_COMMON_LIBRYGEL_SERVER_VALAFLAGS) \
-+ $(RYGEL_COMMON_VALAFLAGS)
-+
-+librygel_lms_la_CFLAGS = \
-+ $(RYGEL_PLUGIN_LMS_DEPS_CFLAGS) \
-+ $(RYGEL_COMMON_LIBRYGEL_SERVER_CFLAGS) \
-+ -DG_LOG_DOMAIN='"Lms"'
-+
-+librygel_lms_la_LIBADD = \
-+ $(RYGEL_PLUGIN_LMS_DEPS_LIBS) \
-+ $(RYGEL_COMMON_LIBRYGEL_SERVER_LIBS)
-+
-+librygel_lms_la_LDFLAGS = \
-+ $(RYGEL_PLUGIN_LINKER_FLAGS)
-+
-+EXTRA_DIST = lms.plugin.in
-diff --git a/src/plugins/lms/README b/src/plugins/lms/README
-new file mode 100644
-index 0000000..b741806
---- /dev/null
-+++ b/src/plugins/lms/README
-@@ -0,0 +1,17 @@
-+rygel-lms
-+=========
-+
-+A rygel mediaserver plugin that exposes a lightmediascanner database
-+as a Mediaserver.
-+
-+Configuration in rygel.conf:
-+
-+ [LightMediaScanner]
-+ db-path=/path/to/lightmediascannerd.sqlite3
-+ title=My Media
-+
-+* Supports browsing and searching (but in many cases searches will
-+ still fall back to the inefficient simple_search()).
-+* UpdateIDs are not yet supported as lightmediascanner seems to have
-+ not change signal support yet
-+* No real DLNA CTT testing has been done so far
-diff --git a/src/plugins/lms/lms.plugin.in b/src/plugins/lms/lms.plugin.in
-new file mode 100644
-index 0000000..9db9895
---- /dev/null
-+++ b/src/plugins/lms/lms.plugin.in
-@@ -0,0 +1,7 @@
-+[Plugin]
-+Version = @VERSION@
-+Module = lms
-+Name = LMS
-+License = LGPL
-+Description = LMS DMS plugin for Rygel
-+Copyright = Copyright © Intel
-diff --git a/src/plugins/lms/rygel-lms-album.vala b/src/plugins/lms/rygel-lms-album.vala
-new file mode 100644
-index 0000000..4fea17a
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-album.vala
-@@ -0,0 +1,173 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT_TEMPLATE =
-+ "SELECT COUNT(audios.id) " +
-+ "FROM audios, files " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;";
-+
-+ private static const string SQL_COUNT_WITH_FILTER_TEMPLATE =
-+ "SELECT COUNT(audios.id), audios.title as title, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;";
-+
-+ private static const string SQL_FIND_OBJECT_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name, " +
-+ "audio_albums.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id AND audios.album_id = %s;";
-+
-+ private static const string SQL_ADDED_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ private static const string SQL_REMOVED_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "WHERE dtime <> 0 AND audios.id = files.id AND audios.album_id = %s " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = statement.column_int (0);
-+ var path = statement.column_text (1);
-+ var mime_type = statement.column_text(10);
-+
-+ if (mime_type == null || mime_type.length == 0) {
-+ /* TODO is this correct? */
-+ debug ("Music item %d (%s) has no MIME type",
-+ id,
-+ path);
-+ }
-+
-+ var title = statement.column_text(3);
-+ var song_id = this.build_child_id (id);
-+ var song = new MusicItem (song_id, this, title);
-+ song.ref_id = this.build_reference_id (id);
-+ song.size = statement.column_int(2);
-+ song.track_number = statement.column_int(4);
-+ song.duration = statement.column_int(5);
-+ song.channels = statement.column_int(6);
-+ song.sample_freq = statement.column_int(7);
-+ song.bitrate = statement.column_int(8);
-+ song.dlna_profile = statement.column_text(9);
-+ song.mime_type = mime_type;
-+ song.artist = statement.column_text(11);
-+ song.album = statement.column_text(12);
-+ File file = File.new_for_path (path);
-+ song.add_uri (file.get_uri ());
-+
-+ return song;
-+ }
-+
-+ private static string get_sql_all (string db_id) {
-+ return (SQL_ALL_TEMPLATE.printf (db_id));
-+ }
-+ private static string get_sql_find_object (string db_id) {
-+ return (SQL_FIND_OBJECT_TEMPLATE.printf (db_id));
-+ }
-+ private static string get_sql_count (string db_id) {
-+ return (SQL_COUNT_TEMPLATE.printf (db_id));
-+ }
-+ private static string get_sql_added (string db_id) {
-+ return (SQL_ADDED_TEMPLATE.printf (db_id));
-+ }
-+ private static string get_sql_removed (string db_id) {
-+ return (SQL_REMOVED_TEMPLATE.printf (db_id));
-+ }
-+
-+ protected override string get_sql_all_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return this.sql_all;
-+ }
-+ var filter_str = "%s AND %s".printf (this.db_id, filter);
-+ return (SQL_ALL_TEMPLATE.printf (filter_str));
-+ }
-+
-+ protected override string get_sql_count_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return this.sql_count;
-+ }
-+ var filter_str = "%s AND %s".printf (this.db_id, filter);
-+ return (SQL_COUNT_WITH_FILTER_TEMPLATE.printf (filter_str));
-+ }
-+
-+ public Album (string db_id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db) {
-+ base (db_id,
-+ parent,
-+ title,
-+ lms_db,
-+ get_sql_all (db_id),
-+ get_sql_find_object (db_id),
-+ get_sql_count (db_id),
-+ get_sql_added (db_id),
-+ get_sql_removed (db_id)
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-albums.vala b/src/plugins/lms/rygel-lms-albums.vala
-new file mode 100644
-index 0000000..309a352
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-albums.vala
-@@ -0,0 +1,175 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.Albums : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL =
-+ "SELECT audio_albums.id, audio_albums.name as title, " +
-+ "audio_artists.name as artist " +
-+ "FROM audio_albums " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audio_albums.artist_id = audio_artists.id " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_ALL_WITH_FILTER_TEMPLATE =
-+ "SELECT audio_albums.id, audio_albums.name as title, " +
-+ "audio_artists.name as artist " +
-+ "FROM audio_albums " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audio_albums.artist_id = audio_artists.id " +
-+ "WHERE %s " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT COUNT(audio_albums.id) " +
-+ "FROM audio_albums;";
-+
-+ private static const string SQL_COUNT_WITH_FILTER_TEMPLATE =
-+ "SELECT COUNT(audio_albums.id), audio_albums.name as title, " +
-+ "audio_artists.name as artist " +
-+ "FROM audio_albums " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audio_albums.artist_id = audio_artists.id " +
-+ "WHERE %s;";
-+
-+ /* count songs inside albums */
-+ private static const string SQL_CHILD_COUNT_WITH_FILTER_TEMPLATE =
-+ "SELECT COUNT(audios.id), audios.title as title, " +
-+ "audio_artists.name as artist " +
-+ "FROM audios, files, audio_albums " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_albums.id %s;";
-+
-+ /* select songs inside albums */
-+ private static const string SQL_CHILD_ALL_WITH_FILTER_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name, audio_albums.id " +
-+ "FROM audios, files, audio_albums " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_albums.id %s " +
-+ "LIMIT ? OFFSET ?;";
-+
-+
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT audio_albums.id, audio_albums.name " +
-+ "FROM audio_albums " +
-+ "WHERE audio_albums.id = ?;";
-+
-+ protected override string get_sql_all_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return Albums.SQL_ALL;
-+ }
-+ return (Albums.SQL_ALL_WITH_FILTER_TEMPLATE.printf (filter));
-+ }
-+
-+ protected override string get_sql_count_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return Albums.SQL_COUNT;
-+ }
-+ return (Albums.SQL_COUNT_WITH_FILTER_TEMPLATE.printf (filter));
-+ }
-+
-+ protected override uint get_child_count_with_filter (string where_filter,
-+ ValueArray args)
-+ {
-+
-+ /* search the children (albums) as usual */
-+ var count = base.get_child_count_with_filter (where_filter, args);
-+
-+ /* now search the album contents */
-+ var filter = "";
-+ if (where_filter.length > 0) {
-+ filter = "AND %s".printf (where_filter);
-+ }
-+ var query = Albums.SQL_CHILD_COUNT_WITH_FILTER_TEMPLATE.printf (filter);
-+ try {
-+ var stmt = this.lms_db.prepare_and_init (query, args.values);
-+ if (stmt.step () == Sqlite.ROW) {
-+ count += stmt.column_int (0);
-+ }
-+ } catch (DatabaseError e) {
-+ warning ("Query failed: %s", e.message);
-+ }
-+
-+ return count;
-+ }
-+
-+ protected override MediaObjects? get_children_with_filter (string where_filter,
-+ ValueArray args,
-+ string sort_criteria,
-+ uint offset,
-+ uint max_count) {
-+ var children = base. get_children_with_filter (where_filter,
-+ args,
-+ sort_criteria,
-+ offset,
-+ max_count);
-+ var filter = "";
-+ if (where_filter.length > 0) {
-+ filter = "AND %s".printf (where_filter);
-+ }
-+ var query = Albums.SQL_CHILD_ALL_WITH_FILTER_TEMPLATE.printf (filter);
-+ try {
-+ var stmt = this.lms_db.prepare_and_init (query, args.values);
-+ while (Database.get_children_step (stmt)) {
-+ var album_id = stmt.column_text (13);
-+ var album = new Album (album_id, this, "", this.lms_db);
-+
-+ var song = album.object_from_statement (stmt);
-+ song.parent_ref = song.parent;
-+ children.add (song);
-+
-+ }
-+ } catch (DatabaseError e) {
-+ warning ("Query failed: %s", e.message);
-+ }
-+
-+ return children;
-+ }
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = "%d".printf (statement.column_int (0));
-+ LMS.Album album = new LMS.Album (id,
-+ this,
-+ statement.column_text (1),
-+ this.lms_db);
-+ return album;
-+ }
-+
-+ public Albums (MediaContainer parent,
-+ LMS.Database lms_db) {
-+ base ("albums",
-+ parent,
-+ _("Albums"),
-+ lms_db,
-+ Albums.SQL_ALL,
-+ Albums.SQL_FIND_OBJECT,
-+ Albums.SQL_COUNT,
-+ null, null);
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-all-images.vala b/src/plugins/lms/rygel-lms-all-images.vala
-new file mode 100644
-index 0000000..0b54c7f
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-images.vala
-@@ -0,0 +1,95 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.AllImages : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT count(images.id) " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id;";
-+
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND files.id = ? AND images.id = files.id;";
-+
-+ private static const string SQL_ADDED =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ private static const string SQL_REMOVED =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
-+ "FROM images, files " +
-+ "WHERE dtime <> 0 AND images.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = statement.column_int(0);
-+ var path = statement.column_text(6);
-+ var mime_type = statement.column_text(9);
-+
-+ if (mime_type == null || mime_type.length == 0){
-+ /* TODO is this correct? */
-+ debug ("Image item %d (%s) has no MIME type",
-+ id,
-+ path);
-+ }
-+
-+ var title = statement.column_text(1);
-+ var image = new ImageItem(this.build_child_id (id), this, title);
-+ image.creator = statement.column_text(2);
-+ TimeVal tv = { (long) statement.column_int(3), (long) 0 };
-+ image.date = tv.to_iso8601 ();
-+ image.width = statement.column_int(4);
-+ image.height = statement.column_int(5);
-+ image.size = statement.column_int(7);
-+ image.mime_type = mime_type;
-+ image.dlna_profile = statement.column_text(8);
-+ File file = File.new_for_path(path);
-+ image.add_uri (file.get_uri ());
-+
-+ return image;
-+ }
-+
-+ public AllImages (MediaContainer parent, LMS.Database lms_db) {
-+ base ("all",
-+ parent,
-+ _("All"),
-+ lms_db,
-+ AllImages.SQL_ALL,
-+ AllImages.SQL_FIND_OBJECT,
-+ AllImages.SQL_COUNT,
-+ AllImages.SQL_ADDED,
-+ AllImages.SQL_REMOVED
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-all-music.vala b/src/plugins/lms/rygel-lms-all-music.vala
-new file mode 100644
-index 0000000..2a7226f
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-music.vala
-@@ -0,0 +1,169 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL_TEMPLATE =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name, " +
-+ "files.mtime, " +
-+ "audio_genres.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "LEFT JOIN audio_genres " +
-+ "ON audios.genre_id = audio_genres.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id %s " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT COUNT(audios.id) " +
-+ "FROM audios, files " +
-+ "WHERE dtime = 0 AND audios.id = files.id;";
-+
-+ private static const string SQL_COUNT_WITH_FILTER_TEMPLATE =
-+ "SELECT COUNT(audios.id), audios.title as title, " +
-+ "audio_artists.name as artist " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id %s;";
-+
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name, " +
-+ "audio_albums.name, " +
-+ "files.mtime, " +
-+ "audio_genres.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "LEFT JOIN audio_genres " +
-+ "ON audios.genre_id = audio_genres.id " +
-+ "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id;";
-+
-+ private static const string SQL_ADDED =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name, " +
-+ "files.mtime, " +
-+ "audio_genres.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "LEFT JOIN audio_genres " +
-+ "ON audios.genre_id = audio_genres.id " +
-+ "WHERE dtime = 0 AND audios.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ private static const string SQL_REMOVED =
-+ "SELECT files.id, files.path, files.size, " +
-+ "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
-+ "audio_artists.name as artist, " +
-+ "audio_albums.name, " +
-+ "files.mtime, " +
-+ "audio_genres.name " +
-+ "FROM audios, files " +
-+ "LEFT JOIN audio_artists " +
-+ "ON audios.artist_id = audio_artists.id " +
-+ "LEFT JOIN audio_albums " +
-+ "ON audios.album_id = audio_albums.id " +
-+ "LEFT JOIN audio_genres " +
-+ "ON audios.genre_id = audio_genres.id " +
-+ "WHERE dtime <> 0 AND audios.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ protected override string get_sql_all_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return this.sql_all;
-+ }
-+ var filter_str = "AND %s".printf (filter);
-+ return (AllMusic.SQL_ALL_TEMPLATE.printf (filter_str));
-+ }
-+
-+ protected override string get_sql_count_with_filter (string filter) {
-+ if (filter.length == 0) {
-+ return this.sql_count;
-+ }
-+ var filter_str = "AND %s".printf (filter);
-+ return (AllMusic.SQL_COUNT_WITH_FILTER_TEMPLATE.printf (filter_str));
-+ }
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = statement.column_int (0);
-+ var path = statement.column_text (1);
-+ var mime_type = statement.column_text(10);
-+
-+ if (mime_type == null || mime_type.length == 0) {
-+ /* TODO is this correct? */
-+ debug ("Music item %d (%s) has no MIME type",
-+ id,
-+ path);
-+ }
-+
-+ var title = statement.column_text(3);
-+ var song_id = this.build_child_id (id);
-+ var song = new MusicItem (song_id, this, title);
-+ song.size = statement.column_int(2);
-+ song.track_number = statement.column_int(4);
-+ song.duration = statement.column_int(5);
-+ song.channels = statement.column_int(6);
-+ song.sample_freq = statement.column_int(7);
-+ song.bitrate = statement.column_int(8);
-+ song.dlna_profile = statement.column_text(9);
-+ song.mime_type = mime_type;
-+ song.artist = statement.column_text(11);
-+ song.album = statement.column_text(12);
-+ TimeVal tv = { (long) statement.column_int(13), (long) 0 };
-+ song.date = tv.to_iso8601 ();
-+ song.genre = statement.column_text(14);
-+ File file = File.new_for_path (path);
-+ song.add_uri (file.get_uri ());
-+
-+ return song;
-+ }
-+
-+ public AllMusic (MediaContainer parent, LMS.Database lms_db) {
-+ base("all",
-+ parent,
-+ _("All"),
-+ lms_db,
-+ AllMusic.SQL_ALL_TEMPLATE.printf (""),
-+ AllMusic.SQL_FIND_OBJECT,
-+ AllMusic.SQL_COUNT,
-+ AllMusic.SQL_ADDED,
-+ AllMusic.SQL_REMOVED
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-all-videos.vala b/src/plugins/lms/rygel-lms-all-videos.vala
-new file mode 100644
-index 0000000..dbde0db
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-videos.vala
-@@ -0,0 +1,123 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL =
-+ "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
-+ "FROM videos, files " +
-+ "WHERE dtime = 0 AND videos.id = files.id " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT count(videos.id) " +
-+ "FROM videos, files " +
-+ "WHERE dtime = 0 AND videos.id = files.id;";
-+
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
-+ "FROM videos, files " +
-+ "WHERE dtime = 0 AND files.id = ? AND videos.id = files.id;";
-+
-+ private static const string SQL_ADDED =
-+ "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
-+ "FROM videos, files " +
-+ "WHERE dtime = 0 AND videos.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ private static const string SQL_REMOVED =
-+ "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
-+ "FROM videos, files " +
-+ "WHERE dtime <> 0 AND videos.id = files.id " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = statement.column_int(0);
-+ var mime_type = statement.column_text(8);
-+ var path = statement.column_text(4);
-+ var file = File.new_for_path(path);
-+
-+ /* TODO: Temporary code to extract the MIME TYPE. LMS does not seem
-+ to compute the mime type of videos. Don't know why. */
-+
-+/* if (mime_type == null || mime_type.length == 0) {
-+ try {
-+ FileInfo info = file.query_info(FileAttribute.STANDARD_CONTENT_TYPE,
-+ FileQueryInfoFlags.NONE, null);
-+ mime_type = info.get_content_type();
-+ } catch {}
-+ }
-+*/
-+
-+ if (mime_type == null || mime_type.length == 0) {
-+ /* TODO is this correct? */
-+ debug ("Video item %d (%s) has no MIME type",
-+ id,
-+ path);
-+ }
-+
-+ var title = statement.column_text(1);
-+ var video = new VideoItem(this.build_child_id (id), this, title);
-+ video.creator = statement.column_text(2);
-+ video.duration = statement.column_int(3);
-+ TimeVal tv = { (long) statement.column_int(5), (long) 0 };
-+ video.date = tv.to_iso8601 ();
-+ video.size = statement.column_int(6);
-+ video.dlna_profile = statement.column_text(7);
-+ video.mime_type = mime_type;
-+ video.add_uri (file.get_uri ());
-+
-+ // Rygel does not support multiple video and audio tracks in a single file,
-+ // so we just take the first one
-+ var video_data = "select videos_videos.bitrate + videos_audios.bitrate, width, height, channels, sampling_rate " +
-+ "from videos, videos_audios, videos_videos where videos.id = ? " +
-+ "and videos.id = videos_audios.video_id and videos.id = videos_videos.video_id;";
-+ try {
-+ var stmt = this.lms_db.prepare(video_data);
-+ Rygel.LMS.Database.find_object("%d".printf(id), stmt);
-+ video.bitrate = stmt.column_int(0) / 8; //convert bits per second into bytes per second
-+ video.width = stmt.column_int(1);
-+ video.height = stmt.column_int(2);
-+ video.channels = stmt.column_int(3);
-+ video.sample_freq = stmt.column_int(4);
-+ } catch (DatabaseError e) {
-+ warning ("Query failed: %s", e.message);
-+ }
-+
-+ return video;
-+ }
-+
-+ public AllVideos (string id, MediaContainer parent, string title, LMS.Database lms_db){
-+ base (id,
-+ parent,
-+ title,
-+ lms_db,
-+ AllVideos.SQL_ALL,
-+ AllVideos.SQL_FIND_OBJECT,
-+ AllVideos.SQL_COUNT,
-+ AllVideos.SQL_ADDED,
-+ AllVideos.SQL_REMOVED
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-artist.vala b/src/plugins/lms/rygel-lms-artist.vala
-new file mode 100644
-index 0000000..31e9070
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-artist.vala
-@@ -0,0 +1,75 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.Artist : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL_TEMPLATE =
-+ "SELECT audio_albums.id, audio_albums.name " +
-+ "FROM audio_albums " +
-+ "WHERE audio_albums.artist_id = %s " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT_TEMPLATE =
-+ "SELECT COUNT(audio_albums.id) " +
-+ "FROM audio_albums " +
-+ "WHERE audio_albums.artist_id = %s";
-+
-+ private static const string SQL_FIND_OBJECT_TEMPLATE =
-+ "SELECT audio_albums.id, audio_albums.name " +
-+ "FROM audio_albums " +
-+ "WHERE audio_albums.id = ? AND audio_albums.artist_id = %s;";
-+
-+ private static string get_sql_all (string id) {
-+ return (SQL_ALL_TEMPLATE.printf (id));
-+ }
-+ private static string get_sql_find_object (string id) {
-+ return (SQL_FIND_OBJECT_TEMPLATE.printf (id));
-+ }
-+ private static string get_sql_count (string id) {
-+ return (SQL_COUNT_TEMPLATE.printf (id));
-+ }
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var db_id = "%d".printf (statement.column_int (0));
-+ var title = statement.column_text (1);
-+ return new LMS.Album (db_id, this, title, this.lms_db);
-+ }
-+
-+ public Artist (string id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db) {
-+
-+ base (id,
-+ parent,
-+ title,
-+ lms_db,
-+ get_sql_all (id),
-+ get_sql_find_object (id),
-+ get_sql_count (id),
-+ null, // LMS does not track adding or removing albums
-+ null
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-artists.vala b/src/plugins/lms/rygel-lms-artists.vala
-new file mode 100644
-index 0000000..a00b2ce
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-artists.vala
-@@ -0,0 +1,62 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.Artists : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL =
-+ "SELECT audio_artists.id, audio_artists.name " +
-+ "FROM audio_artists " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT COUNT(audio_artists.id) " +
-+ "FROM audio_artists;";
-+
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT audio_artists.id, audio_artists.name " +
-+ "FROM audio_artists " +
-+ "WHERE audio_artists.id = ?;";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var db_id = "%d".printf (statement.column_int (0));
-+ var title = statement.column_text (1);
-+
-+ return new LMS.Artist (db_id, this, title, this.lms_db);
-+ }
-+
-+ public Artists (string id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db) {
-+ base (id,
-+ parent,
-+ title,
-+ lms_db,
-+ Artists.SQL_ALL,
-+ Artists.SQL_FIND_OBJECT,
-+ Artists.SQL_COUNT,
-+ null, null
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-category-container.vala b/src/plugins/lms/rygel-lms-category-container.vala
-new file mode 100644
-index 0000000..e5430d1
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-category-container.vala
-@@ -0,0 +1,428 @@
-+/*
-+ * Copyright (C) 2009,2010 Jens Georg <mail@jensge.org>,
-+ * (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Gee;
-+using Sqlite;
-+
-+public errordomain Rygel.LMS.CategoryContainerError {
-+ SQLITE_ERROR,
-+ GENERAL_ERROR,
-+ INVALID_TYPE,
-+ UNSUPPORTED_SEARCH
-+}
-+
-+public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
-+ Rygel.TrackableContainer,
-+ Rygel.SearchableContainer {
-+ public ArrayList<string> search_classes { get; set; }
-+
-+ public unowned LMS.Database lms_db { get; construct; }
-+
-+ public string db_id { get; construct; }
-+
-+ public string sql_all { get; construct; }
-+ public string sql_find_object { get; construct; }
-+ public string sql_count { get; construct; }
-+ public string sql_added { get; construct; }
-+ public string sql_removed { get; construct; }
-+
-+ protected Statement stmt_all;
-+ protected Statement stmt_find_object;
-+ protected Statement stmt_added;
-+ protected Statement stmt_removed;
-+
-+ protected string child_prefix;
-+ protected string ref_prefix;
-+
-+ protected abstract MediaObject? object_from_statement (Statement statement);
-+
-+ /* TODO these should be abstract */
-+ protected virtual string get_sql_all_with_filter (string filter) {
-+ return this.sql_all;
-+ }
-+ protected virtual string get_sql_count_with_filter (string filter) {
-+ return this.sql_count;
-+ }
-+
-+ private static string? map_operand_to_column (string operand,
-+ out string? collate = null,
-+ bool for_sort = false)
-+ throws Error {
-+ string column = null;
-+ bool use_collation = false;
-+
-+ // TODO add all used aliases to sql queries
-+ switch (operand) {
-+ case "dc:title":
-+ column = "title";
-+ use_collation = true;
-+ break;
-+ case "upnp:artist":
-+ column = "artist";
-+ use_collation = true;
-+ break;
-+ case "dc:creator":
-+ column = "creator";
-+ use_collation = true;
-+ break;
-+ default:
-+ var message = "Unsupported column %s".printf (operand);
-+
-+ throw new CategoryContainerError.UNSUPPORTED_SEARCH (message);
-+ }
-+
-+ if (use_collation) {
-+ collate = "COLLATE CASEFOLD";
-+ } else {
-+ collate = "";
-+ }
-+
-+ return column;
-+ }
-+
-+ private static string? relational_expression_to_sql
-+ (RelationalExpression exp,
-+ GLib.ValueArray args)
-+ throws Error {
-+ GLib.Value? v = null;
-+ string collate = null;
-+
-+ string column = CategoryContainer.map_operand_to_column (exp.operand1,
-+ out collate);
-+ SqlOperator operator;
-+
-+ switch (exp.op) {
-+ case GUPnP.SearchCriteriaOp.EXISTS:
-+ string sql_function;
-+ if (exp.operand2 == "true") {
-+ sql_function = "%s IS NOT NULL AND %s != ''";
-+ } else {
-+ sql_function = "%s IS NULL OR %s = ''";
-+ }
-+
-+ return sql_function.printf (column, column);
-+ case GUPnP.SearchCriteriaOp.EQ:
-+ case GUPnP.SearchCriteriaOp.NEQ:
-+ case GUPnP.SearchCriteriaOp.LESS:
-+ case GUPnP.SearchCriteriaOp.LEQ:
-+ case GUPnP.SearchCriteriaOp.GREATER:
-+ case GUPnP.SearchCriteriaOp.GEQ:
-+ v = exp.operand2;
-+ operator = new SqlOperator.from_search_criteria_op
-+ (exp.op, column, collate);
-+ break;
-+ case GUPnP.SearchCriteriaOp.CONTAINS:
-+ operator = new SqlFunction ("contains", column);
-+ v = exp.operand2;
-+ break;
-+ case GUPnP.SearchCriteriaOp.DOES_NOT_CONTAIN:
-+ operator = new SqlFunction ("NOT contains", column);
-+ v = exp.operand2;
-+ break;
-+ case GUPnP.SearchCriteriaOp.DERIVED_FROM:
-+ operator = new SqlOperator ("LIKE", column);
-+ v = "%s%%".printf (exp.operand2);
-+ break;
-+ default:
-+ warning ("Unsupported op %d", exp.op);
-+ return null;
-+ }
-+
-+ if (v != null) {
-+ args.append (v);
-+ }
-+
-+ return operator.to_string ();
-+ }
-+
-+ private static string logical_expression_to_sql
-+ (LogicalExpression expression,
-+ GLib.ValueArray args)
-+ throws Error {
-+ string left_sql_string = CategoryContainer.search_expression_to_sql
-+ (expression.operand1,
-+ args);
-+ string right_sql_string = CategoryContainer.search_expression_to_sql
-+ (expression.operand2,
-+ args);
-+ unowned string operator_sql_string = "OR";
-+
-+ if (expression.op == LogicalOperator.AND) {
-+ operator_sql_string = "AND";
-+ }
-+
-+ return "(%s %s %s)".printf (left_sql_string,
-+ operator_sql_string,
-+ right_sql_string);
-+ }
-+
-+ private static string? search_expression_to_sql
-+ (SearchExpression? expression,
-+ GLib.ValueArray args)
-+ throws Error {
-+ if (expression == null) {
-+ return "";
-+ }
-+
-+ if (expression is LogicalExpression) {
-+ return CategoryContainer.logical_expression_to_sql
-+ (expression as LogicalExpression, args);
-+ } else {
-+ return CategoryContainer.relational_expression_to_sql
-+ (expression as RelationalExpression,
-+ args);
-+ }
-+ }
-+
-+ protected virtual uint get_child_count_with_filter (string where_filter,
-+ ValueArray args)
-+ {
-+ var query = this.get_sql_count_with_filter (where_filter);
-+ try {
-+ var stmt = this.lms_db.prepare_and_init (query, args.values);
-+ if (stmt.step () != Sqlite.ROW) {
-+ return 0;
-+ }
-+ return stmt.column_int (0);
-+ } catch (DatabaseError e) {
-+ warning ("Query failed: %s", e.message);
-+ return 0;
-+ }
-+ }
-+
-+ protected virtual MediaObjects? get_children_with_filter (string where_filter,
-+ ValueArray args,
-+ string sort_criteria,
-+ uint offset,
-+ uint max_count) {
-+ var children = new MediaObjects ();
-+ GLib.Value v = max_count;
-+ args.append (v);
-+ v = offset;
-+ args.append (v);
-+
-+ var query = this.get_sql_all_with_filter (where_filter);
-+ try {
-+ var stmt = this.lms_db.prepare_and_init (query, args.values);
-+ while (Database.get_children_step (stmt)) {
-+ children.add (this.object_from_statement (stmt));
-+ }
-+ } catch (DatabaseError e) {
-+ warning ("Query failed: %s", e.message);
-+ }
-+
-+ return children;
-+ }
-+
-+ public async MediaObjects? search (SearchExpression? expression,
-+ uint offset,
-+ uint max_count,
-+ out uint total_matches,
-+ string sort_criteria,
-+ Cancellable? cancellable)
-+ throws Error {
-+ debug ("search()");
-+ try {
-+ var args = new GLib.ValueArray (0);
-+ var filter = CategoryContainer.search_expression_to_sql (expression,
-+ args);
-+ total_matches = this.get_child_count_with_filter (filter, args);
-+
-+ if (expression != null) {
-+ debug (" Original search: %s", expression.to_string ());
-+ debug (" Parsed search expression: %s", filter);
-+ debug (" Filtered cild count is %u", total_matches);
-+ }
-+
-+ if (max_count == 0) {
-+ max_count = uint.MAX;
-+ }
-+ return this.get_children_with_filter (filter,
-+ args,
-+ sort_criteria,
-+ offset,
-+ max_count);
-+ } catch (Error e) {
-+ debug (" Falling back to simple_search(): %s", e.message);
-+ return yield this.simple_search (expression,
-+ offset,
-+ max_count,
-+ out total_matches,
-+ sort_criteria,
-+ cancellable);
-+ }
-+ }
-+
-+ public async override MediaObjects? get_children (uint offset,
-+ uint max_count,
-+ string sort_criteria,
-+ Cancellable? cancellable)
-+ throws Error {
-+ MediaObjects retval = new MediaObjects ();
-+
-+ Database.get_children_init (this.stmt_all,
-+ offset,
-+ max_count,
-+ sort_criteria);
-+ while (Database.get_children_step (this.stmt_all)) {
-+ retval.add (this.object_from_statement (this.stmt_all));
-+ }
-+
-+ return retval;
-+ }
-+
-+ public async override MediaObject? find_object (string id,
-+ Cancellable? cancellable)
-+ throws Error {
-+ if (!id.has_prefix (this.child_prefix)) {
-+ /* can't match anything in this container */
-+ return null;
-+ }
-+
-+ MediaObject object = null;
-+
-+ /* remove parent section from id */
-+ var real_id = id.substring (this.child_prefix.length);
-+ /* remove grandchildren from id */
-+ var index = real_id.index_of_char (':');
-+ if (index > 0) {
-+ real_id = real_id.slice (0, index);
-+ }
-+
-+ try {
-+ Database.find_object (real_id, this.stmt_find_object);
-+ var child = this.object_from_statement (this.stmt_find_object);
-+ if (index < 0) {
-+ object = child;
-+ } else {
-+ /* try grandchildren */
-+ var container = child as CategoryContainer;
-+ object = yield container.find_object (id, cancellable);
-+
-+ /* tell object to keep a reference to the parent --
-+ * otherwise parent is freed before object is serialized */
-+ object.parent_ref = object.parent;
-+ }
-+ } catch (DatabaseError e) {
-+ debug ("find_object %s in %s: %s", id, this.id, e.message);
-+ /* Happens e.g. if id is not an integer */
-+ }
-+
-+ return object;
-+ }
-+
-+ protected string build_child_id (int db_id) {
-+ return "%s%d".printf (this.child_prefix, db_id);
-+ }
-+
-+ protected string build_reference_id (int db_id) {
-+ return "%s%d".printf (this.ref_prefix, db_id);
-+ }
-+
-+ protected async void add_child (MediaObject object) {
-+ }
-+
-+ protected async void remove_child (MediaObject object) {
-+ }
-+
-+ private void on_db_updated(uint64 old_id, uint64 new_id) {
-+ try {
-+ var stmt_count = this.lms_db.prepare (this.sql_count);
-+
-+ if (stmt_count.step () == Sqlite.ROW) {
-+ this.child_count = stmt_count.column_int (0);
-+ }
-+
-+ Database.get_children_with_update_id_init (this.stmt_added,
-+ old_id,
-+ new_id);
-+ while (Database.get_children_step (this.stmt_added)) {
-+ this.add_child_tracked.begin(this.object_from_statement (this.stmt_added));
-+ }
-+
-+ Database.get_children_with_update_id_init (this.stmt_removed,
-+ old_id,
-+ new_id);
-+ while (Database.get_children_step (this.stmt_removed)) {
-+ this.remove_child_tracked.begin(this.object_from_statement (this.stmt_removed));
-+ }
-+
-+ } catch (DatabaseError e) {
-+ warning ("Can't perform container update: %s", e.message);
-+ }
-+
-+ }
-+
-+ public CategoryContainer (string db_id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db,
-+ string sql_all,
-+ string sql_find_object,
-+ string sql_count,
-+ string? sql_added,
-+ string? sql_removed
-+ ) {
-+ Object (id : "%s:%s".printf (parent.id, db_id),
-+ db_id : db_id,
-+ parent : parent,
-+ title : title,
-+ lms_db : lms_db,
-+ sql_all : sql_all,
-+ sql_find_object : sql_find_object,
-+ sql_count : sql_count,
-+ sql_added : sql_added,
-+ sql_removed: sql_removed
-+ );
-+ }
-+
-+ construct {
-+ this.search_classes = new ArrayList<string> ();
-+
-+ this.child_prefix = "%s:".printf (this.id);
-+
-+ var index = this.id.index_of_char (':');
-+ this.ref_prefix = this.id.slice (0, index) + ":all:";
-+
-+ try {
-+ this.stmt_all = this.lms_db.prepare (this.sql_all);
-+ this.stmt_find_object = this.lms_db.prepare (this.sql_find_object);
-+ var stmt_count = this.lms_db.prepare (this.sql_count);
-+
-+ if (stmt_count.step () == Sqlite.ROW) {
-+ this.child_count = stmt_count.column_int (0);
-+ }
-+ // some container implementations don't have a reasonable way to provide
-+ // id-based statements to fetch added or removed items
-+ if (this.sql_added != null && this.sql_removed != null) {
-+ this.stmt_added = this.lms_db.prepare (this.sql_added);
-+ this.stmt_removed = this.lms_db.prepare (this.sql_removed);
-+ lms_db.db_updated.connect(this.on_db_updated);
-+ }
-+ } catch (DatabaseError e) {
-+ warning ("Container %s: %s", this.title, e.message);
-+ }
-+
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-collate.c b/src/plugins/lms/rygel-lms-collate.c
-new file mode 100644
-index 0000000..8eee80b
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-collate.c
-@@ -0,0 +1,49 @@
-+/*
-+ * Copyright (C) 2012 Jens Georg <mail@jensge.org>.
-+ *
-+ * Author: Jens Georg <mail@jensge.org>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+
-+#ifdef HAVE_UNISTRING
-+# include <unistr.h>
-+#endif
-+
-+gint rygel_lms_utf8_collate_str (const char *a, gsize alen,
-+ const char *b, gsize blen)
-+{
-+ char *a_str, *b_str;
-+ gint result;
-+
-+ /* Make sure the passed strings are null terminated */
-+ a_str = g_strndup (a, alen);
-+ b_str = g_strndup (b, blen);
-+
-+#ifdef HAVE_UNISTRING
-+ result = u8_strcoll (a_str, b_str);
-+#else
-+ return g_utf8_collate (a_str, b_str);
-+#endif
-+
-+ g_free (a_str);
-+ g_free (b_str);
-+
-+ return result;
-+}
-diff --git a/src/plugins/lms/rygel-lms-database.vala b/src/plugins/lms/rygel-lms-database.vala
-new file mode 100644
-index 0000000..e898d66
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-database.vala
-@@ -0,0 +1,294 @@
-+/*
-+ * Copyright (C) 2009,2011 Jens Georg <mail@jensge.org>,
-+ * (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Gee;
-+using Sqlite;
-+
-+public errordomain Rygel.LMS.DatabaseError {
-+ OPEN,
-+ PREPARE,
-+ BIND,
-+ STEP,
-+ NOT_FOUND
-+}
-+
-+namespace Rygel.LMS {
-+ extern static int utf8_collate_str (uint8[] a, uint8[] b);
-+}
-+
-+public class Rygel.LMS.Database {
-+
-+ public signal void db_updated(uint64 old_update_id, uint64 new_update_id);
-+
-+ private Sqlite.Database db;
-+ private LMS.DBus lms_proxy;
-+ private uint64 update_id;
-+
-+ /**
-+ * Function to implement the custom SQL function 'contains'
-+ */
-+ private static void utf8_contains (Sqlite.Context context,
-+ Sqlite.Value[] args)
-+ requires (args.length == 2) {
-+ if (args[0].to_text () == null ||
-+ args[1].to_text () == null) {
-+ context.result_int (0);
-+
-+ return;
-+ }
-+
-+ var pattern = Regex.escape_string (args[1].to_text ());
-+ if (Regex.match_simple (pattern,
-+ args[0].to_text (),
-+ RegexCompileFlags.CASELESS)) {
-+ context.result_int (1);
-+ } else {
-+ context.result_int (0);
-+ }
-+ }
-+
-+ /**
-+ * Function to implement the custom SQLite collation 'CASEFOLD'.
-+ *
-+ * Uses utf8 case-fold to compare the strings.
-+ */
-+ private static int utf8_collate (int alen, void* a, int blen, void* b) {
-+ // unowned to prevent array copy
-+ unowned uint8[] _a = (uint8[]) a;
-+ _a.length = alen;
-+
-+ unowned uint8[] _b = (uint8[]) b;
-+ _b.length = blen;
-+
-+ return LMS.utf8_collate_str (_a, _b);
-+ }
-+
-+ public Database () throws DatabaseError {
-+ string db_path;
-+ try {
-+ lms_proxy = Bus.get_proxy_sync (BusType.SESSION,
-+ "org.lightmediascanner",
-+ "/org/lightmediascanner/Scanner1");
-+ db_path = lms_proxy.data_base_path;
-+ debug ("Got db path %s from LMS over dbus", db_path);
-+ update_id = lms_proxy.update_id;
-+ debug ("Got updated id %lld from LMS over dbus", update_id);
-+ lms_proxy.g_properties_changed.connect (this.on_lms_properties_changed);
-+
-+ } catch (IOError e) {
-+ warning("Couldn't get LMS Dbus proxy: %s", e.message);
-+ db_path = Environment.get_user_config_dir() +
-+ "/lightmediascannerd/db.sqlite3";
-+ debug ("Using default sqlite database location %s", db_path);
-+ }
-+
-+ Sqlite.Database.open (db_path, out this.db);
-+ if (this.db.errcode () != Sqlite.OK) {
-+ throw new DatabaseError.OPEN ("Failed to open '%s': %d",
-+ db_path,
-+ this.db.errcode () );
-+ }
-+
-+ this.db.create_function ("contains",
-+ 2,
-+ Sqlite.UTF8,
-+ null,
-+ LMS.Database.utf8_contains,
-+ null,
-+ null);
-+
-+ this.db.create_collation ("CASEFOLD",
-+ Sqlite.UTF8,
-+ LMS.Database.utf8_collate);
-+
-+ }
-+
-+ private void on_lms_properties_changed (DBusProxy lms_proxy,
-+ Variant changed,
-+ string[] invalidated) {
-+ if (!changed.get_type().equal (VariantType.VARDICT)) {
-+ return;
-+ }
-+
-+ foreach (var changed_prop in changed) {
-+ var key = (string) changed_prop.get_child_value (0);
-+ var value = changed_prop.get_child_value (1).get_child_value (0);
-+
-+ debug ("LMS property %s changed value to %s", key, value.print(true));
-+
-+ switch (key) {
-+ case "UpdateID":
-+ db_updated(update_id, (uint64)value);
-+ update_id = (uint64)value;
-+ break;
-+ }
-+ }
-+ }
-+
-+
-+ public Statement prepare (string query_string) throws DatabaseError {
-+ Statement statement;
-+
-+ var err = this.db.prepare_v2 (query_string, -1, out statement);
-+ if (err != Sqlite.OK)
-+ throw new DatabaseError.PREPARE ("Unable to create statement '%s': %d",
-+ query_string,
-+ err);
-+ return statement;
-+ }
-+
-+
-+ public Statement prepare_and_init (string query,
-+ GLib.Value[]? arguments)
-+ throws DatabaseError {
-+
-+ Statement statement;
-+
-+ var err = this.db.prepare_v2 (query, -1, out statement);
-+ if (err != Sqlite.OK)
-+ throw new DatabaseError.PREPARE ("Unable to create statement '%s': %d",
-+ query,
-+ err);
-+
-+ for (var i = 1; i <= arguments.length; ++i) {
-+ int sqlite_err;
-+ unowned GLib.Value current_value = arguments[i - 1];
-+
-+ if (current_value.holds (typeof (int))) {
-+ sqlite_err = statement.bind_int (i, current_value.get_int ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (int64))) {
-+ sqlite_err = statement.bind_int64 (i, current_value.get_int64 ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (uint64))) {
-+ sqlite_err = statement.bind_int64 (i, (int64) current_value.get_uint64 ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (long))) {
-+ sqlite_err = statement.bind_int64 (i, current_value.get_long ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (uint))) {
-+ sqlite_err = statement.bind_int64 (i, current_value.get_uint ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (string))) {
-+ sqlite_err = statement.bind_text (i, current_value.get_string ());
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else if (current_value.holds (typeof (void *))) {
-+ if (current_value.peek_pointer () == null) {
-+ sqlite_err = statement.bind_null (i);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind value %d",
-+ sqlite_err);
-+ } else {
-+ assert_not_reached ();
-+ }
-+ } else {
-+ var type = current_value.type ();
-+ warning (_("Unsupported type %s"), type.name ());
-+ assert_not_reached ();
-+ }
-+ }
-+
-+ return statement;
-+ }
-+
-+ public static void find_object(string id, Statement stmt) throws DatabaseError {
-+
-+ (void) stmt.reset();
-+
-+ int integer_id = int.parse(id);
-+ int sqlite_err = stmt.bind_int(1, integer_id);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind id %d", sqlite_err);
-+
-+ sqlite_err = stmt.step();
-+ if (sqlite_err != Sqlite.ROW)
-+ throw new DatabaseError.STEP("Unable to find id %s", id);
-+ }
-+
-+ public static void get_children_init (Statement stmt,
-+ uint offset, uint max_count, string sort_criteria) throws DatabaseError {
-+
-+ int sqlite_err;
-+
-+ (void) stmt.reset();
-+
-+ sqlite_err = stmt.bind_int(1, (int) max_count);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind max_count %d",
-+ sqlite_err);
-+
-+ sqlite_err = stmt.bind_int(2, (int) offset);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind offset %d",
-+ sqlite_err);
-+ }
-+
-+ public static void get_children_with_update_id_init (Statement stmt,
-+ uint64 old_id, uint64 new_id) throws DatabaseError {
-+
-+ int sqlite_err;
-+
-+ (void) stmt.reset();
-+
-+ if (new_id < old_id) // id value wrapped over
-+ sqlite_err = stmt.bind_int64(1, 0);
-+ else
-+ sqlite_err = stmt.bind_int64(1, (int64)old_id);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind old_id %d",
-+ sqlite_err);
-+
-+ sqlite_err = stmt.bind_int64(2, (int64)new_id);
-+ if (sqlite_err != Sqlite.OK)
-+ throw new DatabaseError.BIND("Unable to bind new_id %d",
-+ sqlite_err);
-+ }
-+
-+ public static bool get_children_step(Statement stmt) throws DatabaseError {
-+
-+ bool retval;
-+ int sqlite_err;
-+
-+ sqlite_err = stmt.step();
-+ retval = sqlite_err == Sqlite.ROW;
-+
-+ if (!retval && (sqlite_err != Sqlite.DONE))
-+ throw new DatabaseError.STEP("Error iterating through rows %d",
-+ sqlite_err);
-+
-+ return retval;
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-dbus-interfaces.vala b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
-new file mode 100644
-index 0000000..13f00cb
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
-@@ -0,0 +1,30 @@
-+/*
-+ * Copyright (C) 2014 Intel Corporation.
-+ *
-+ * Author: Alexander Kanavin <alex.kanavin@gmail.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+[DBus (name = "org.lightmediascanner.Scanner1")]
-+interface Rygel.LMS.DBus : DBusProxy {
-+ public abstract string data_base_path { owned get; }
-+ [DBus (name = "UpdateID")]
-+ public abstract uint64 update_id { get; }
-+
-+ //TODO: add all the other API items which are currently unused
-+}
-\ No newline at end of file
-diff --git a/src/plugins/lms/rygel-lms-image-root.vala b/src/plugins/lms/rygel-lms-image-root.vala
-new file mode 100644
-index 0000000..466bbe2
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-root.vala
-@@ -0,0 +1,35 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+
-+public class Rygel.LMS.ImageRoot : Rygel.SimpleContainer {
-+ public ImageRoot (string id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db) {
-+ base (id, parent, title);
-+
-+ this.add_child_container (new AllImages (this, lms_db));
-+ this.add_child_container (new ImageYears (this, lms_db));
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-image-year.vala b/src/plugins/lms/rygel-lms-image-year.vala
-new file mode 100644
-index 0000000..a7768f0
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-year.vala
-@@ -0,0 +1,114 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.ImageYear : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL_TEMPLATE =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT_TEMPLATE =
-+ "SELECT count(images.id), strftime('%Y', date, 'unixepoch') as year " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id AND year = '%s';";
-+
-+ private static const string SQL_FIND_OBJECT_TEMPLATE =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND files.id = ? AND images.id = files.id AND year = '%s';";
-+
-+ private static const string SQL_ADDED_TEMPLATE =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
-+ "FROM images, files " +
-+ "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ private static const string SQL_REMOVED_TEMPLATE =
-+ "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
-+ "FROM images, files " +
-+ "WHERE dtime <> 0 AND images.id = files.id AND year = '%s' " +
-+ "AND update_id > ? AND update_id <= ?;";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ var id = statement.column_int(0);
-+ var path = statement.column_text(6);
-+ var mime_type = statement.column_text(9);
-+
-+ if (mime_type == null || mime_type.length == 0){
-+ /* TODO is this correct? */
-+ debug ("Image item %d (%s) has no MIME type",
-+ id,
-+ path);
-+ }
-+
-+ var title = statement.column_text(1);
-+ var image = new ImageItem(this.build_child_id (id), this, title);
-+ image.ref_id = this.build_reference_id (id);
-+ image.creator = statement.column_text(2);
-+ TimeVal tv = { (long) statement.column_int(3), (long) 0 };
-+ image.date = tv.to_iso8601 ();
-+ image.width = statement.column_int(4);
-+ image.height = statement.column_int(5);
-+ image.size = statement.column_int(7);
-+ image.mime_type = mime_type;
-+ image.dlna_profile = statement.column_text(8);
-+ File file = File.new_for_path(path);
-+ image.add_uri (file.get_uri ());
-+
-+ return image;
-+ }
-+
-+ private static string get_sql_all (string year) {
-+ return (SQL_ALL_TEMPLATE.printf (year));
-+ }
-+ private static string get_sql_find_object (string year) {
-+ return (SQL_FIND_OBJECT_TEMPLATE.printf (year));
-+ }
-+ private static string get_sql_count (string year) {
-+ return (SQL_COUNT_TEMPLATE.printf (year));
-+ }
-+ private static string get_sql_added (string year) {
-+ return (SQL_ADDED_TEMPLATE.printf (year));
-+ }
-+ private static string get_sql_removed (string year) {
-+ return (SQL_REMOVED_TEMPLATE.printf (year));
-+ }
-+
-+ public ImageYear (MediaContainer parent,
-+ string year,
-+ LMS.Database lms_db) {
-+ base ("%s".printf (year),
-+ parent,
-+ year,
-+ lms_db,
-+ get_sql_all (year),
-+ get_sql_find_object (year),
-+ get_sql_count (year),
-+ get_sql_added (year),
-+ get_sql_removed (year)
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-image-years.vala b/src/plugins/lms/rygel-lms-image-years.vala
-new file mode 100644
-index 0000000..636f4d1
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-years.vala
-@@ -0,0 +1,59 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+using Sqlite;
-+
-+public class Rygel.LMS.ImageYears : Rygel.LMS.CategoryContainer {
-+ private static const string SQL_ALL =
-+ "SELECT DISTINCT(strftime('%Y', images.date, 'unixepoch')) as year " +
-+ "FROM images " +
-+ "LIMIT ? OFFSET ?;";
-+
-+ private static const string SQL_COUNT =
-+ "SELECT COUNT(DISTINCT(strftime('%Y', images.date, 'unixepoch'))) " +
-+ "FROM images;";
-+
-+ /* actually returns multiple times the same result (because no DISTINCT) */
-+ /* Casting the year is a workaround so we can keep using
-+ * Database.find_object() without making the argument a variant or something like it*/
-+ private static const string SQL_FIND_OBJECT =
-+ "SELECT strftime('%Y', images.date, 'unixepoch') as year " +
-+ "FROM images " +
-+ "WHERE year = CAST(? AS TEXT)";
-+
-+ protected override MediaObject? object_from_statement (Statement statement) {
-+ return new LMS.ImageYear (this, statement.column_text (0), this.lms_db);
-+ }
-+
-+ public ImageYears (MediaContainer parent, LMS.Database lms_db) {
-+ base ("years",
-+ parent,
-+ _("Years"),
-+ lms_db,
-+ ImageYears.SQL_ALL,
-+ ImageYears.SQL_FIND_OBJECT,
-+ ImageYears.SQL_COUNT,
-+ null, null
-+ );
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-music-root.vala b/src/plugins/lms/rygel-lms-music-root.vala
-new file mode 100644
-index 0000000..7b1eb0f
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-music-root.vala
-@@ -0,0 +1,36 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+
-+public class Rygel.LMS.MusicRoot : Rygel.SimpleContainer {
-+ public MusicRoot (string id,
-+ MediaContainer parent,
-+ string title,
-+ LMS.Database lms_db) {
-+ base (id, parent, title);
-+
-+ this.add_child_container (new AllMusic (this, lms_db));
-+ this.add_child_container (new Artists ("artists", this, _("Artists"), lms_db));
-+ this.add_child_container (new Albums (this, lms_db));
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-plugin-factory.vala b/src/plugins/lms/rygel-lms-plugin-factory.vala
-new file mode 100644
-index 0000000..9fa8ccd
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-plugin-factory.vala
-@@ -0,0 +1,40 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+
-+private Rygel.LMS.PluginFactory plugin_factory;
-+
-+public void module_init(PluginLoader loader) {
-+ plugin_factory = new Rygel.LMS.PluginFactory(loader);
-+}
-+
-+public class Rygel.LMS.PluginFactory {
-+
-+ PluginLoader loader;
-+
-+ public PluginFactory(PluginLoader loader) {
-+ this.loader = loader;
-+ this.loader.add_plugin(new LMS.Plugin());
-+ }
-+
-+}
-diff --git a/src/plugins/lms/rygel-lms-plugin.vala b/src/plugins/lms/rygel-lms-plugin.vala
-new file mode 100644
-index 0000000..8bf1284
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-plugin.vala
-@@ -0,0 +1,35 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+
-+public class Rygel.LMS.Plugin : Rygel.MediaServerPlugin {
-+ public const string NAME = "LMS";
-+
-+ private static RootContainer root;
-+
-+ public Plugin() {
-+ if (root == null)
-+ root = new RootContainer();
-+ base(root, Plugin.NAME, null, PluginCapabilities.TRACK_CHANGES);
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-root-container.vala b/src/plugins/lms/rygel-lms-root-container.vala
-new file mode 100644
-index 0000000..1623fa3
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-root-container.vala
-@@ -0,0 +1,58 @@
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using Rygel;
-+
-+using Sqlite;
-+
-+public class Rygel.LMS.RootContainer : Rygel.SimpleContainer {
-+
-+ private LMS.Database lms_db = null;
-+
-+ public RootContainer() {
-+ var config = MetaConfig.get_default ();
-+
-+ var title = _("Shared media");
-+ try {
-+ title = config.get_string ("LightMediaScanner", "title");
-+ } catch (GLib.Error error) {}
-+
-+ base.root(title);
-+
-+ try {
-+ this.lms_db = new LMS.Database ();
-+
-+ this.add_child_container (new MusicRoot ("music", this, _("Music"), this.lms_db));
-+ this.add_child_container (new AllVideos ("all-videos", this, _("Videos"), this.lms_db));
-+ this.add_child_container (new ImageRoot ("images", this, _("Pictures"), this.lms_db));
-+
-+ } catch (DatabaseError e) {
-+ warning ("%s\n", e.message);
-+
-+ /* TODO if db does not exist we should
-+ wait for it to be created and then add folders. Best to wait for the
-+ LMS notification API. */
-+ }
-+
-+ }
-+
-+}
-diff --git a/src/plugins/lms/rygel-lms-sql-function.vala b/src/plugins/lms/rygel-lms-sql-function.vala
-new file mode 100644
-index 0000000..e8580cc
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-sql-function.vala
-@@ -0,0 +1,31 @@
-+/*
-+ * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
-+ *
-+ * Author: Jens Georg <mail@jensge.org>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+internal class Rygel.LMS.SqlFunction : SqlOperator {
-+ public SqlFunction (string name, string arg) {
-+ base (name, arg);
-+ }
-+
-+ public override string to_string () {
-+ return "%s(%s,?)".printf (name, arg);
-+ }
-+}
-diff --git a/src/plugins/lms/rygel-lms-sql-operator.vala b/src/plugins/lms/rygel-lms-sql-operator.vala
-new file mode 100644
-index 0000000..fc4e907
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-sql-operator.vala
-@@ -0,0 +1,73 @@
-+/*
-+ * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
-+ *
-+ * Author: Jens Georg <mail@jensge.org>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+using GUPnP;
-+
-+internal class Rygel.LMS.SqlOperator : GLib.Object {
-+ protected string name;
-+ protected string arg;
-+ protected string collate;
-+
-+ public SqlOperator (string name,
-+ string arg,
-+ string collate = "") {
-+ this.name = name;
-+ this.arg = arg;
-+ this.collate = collate;
-+ }
-+
-+ public SqlOperator.from_search_criteria_op (SearchCriteriaOp op,
-+ string arg,
-+ string collate) {
-+ string sql = null;
-+ switch (op) {
-+ case SearchCriteriaOp.EQ:
-+ sql = "=";
-+ break;
-+ case SearchCriteriaOp.NEQ:
-+ sql = "!=";
-+ break;
-+ case SearchCriteriaOp.LESS:
-+ sql = "<";
-+ break;
-+ case SearchCriteriaOp.LEQ:
-+ sql = "<=";
-+ break;
-+ case SearchCriteriaOp.GREATER:
-+ sql = ">";
-+ break;
-+ case SearchCriteriaOp.GEQ:
-+ sql = ">=";
-+ break;
-+ default:
-+ assert_not_reached ();
-+ }
-+
-+ this (sql, arg, collate);
-+ }
-+
-+ public virtual string to_string () {
-+ return "(%s %s ? %s)".printf (arg, name, collate);
-+ }
-+}
-+
-+
---
-1.7.10.4
-
diff --git a/meta-agl/recipes-connectivity/rygel/files/0002-lms-add-C-source-files.patch b/meta-agl/recipes-connectivity/rygel/files/0002-lms-add-C-source-files.patch
deleted file mode 100644
index bbd61aa27..000000000
--- a/meta-agl/recipes-connectivity/rygel/files/0002-lms-add-C-source-files.patch
+++ /dev/null
@@ -1,9455 +0,0 @@
-From 5a91b6b6efdaf28a6640126a32e819aef7e10a74 Mon Sep 17 00:00:00 2001
-From: Manuel Bachmann <manuel.bachmann@iot.bzh>
-Date: Sun, 25 Oct 2015 14:21:28 +0100
-Subject: [PATCH] lms: add C source files
-
-C source files are normally generated by Vala at compile
-time, but we do not use Vala for Rygel under OpenEmbedded
-(because it requires GObject-Introspection support in
-dependencies such as GUPnP, and that is still buggy).
-
-A full tarball release would contain the C files anyway,
-so let us include them so the build succeeds with OE.
-
-Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
----
- src/plugins/lms/librygel_lms_la_vala.stamp | 1 +
- src/plugins/lms/rygel-lms-album.c | 514 +++++
- src/plugins/lms/rygel-lms-albums.c | 569 +++++
- src/plugins/lms/rygel-lms-all-images.c | 305 +++
- src/plugins/lms/rygel-lms-all-music.c | 417 ++++
- src/plugins/lms/rygel-lms-all-videos.c | 456 ++++
- src/plugins/lms/rygel-lms-artist.c | 274 +++
- src/plugins/lms/rygel-lms-artists.c | 214 ++
- src/plugins/lms/rygel-lms-category-container.c | 2772 ++++++++++++++++++++++++
- src/plugins/lms/rygel-lms-database.c | 1349 ++++++++++++
- src/plugins/lms/rygel-lms-dbus-interfaces.c | 261 +++
- src/plugins/lms/rygel-lms-image-root.c | 178 ++
- src/plugins/lms/rygel-lms-image-year.c | 422 ++++
- src/plugins/lms/rygel-lms-image-years.c | 196 ++
- src/plugins/lms/rygel-lms-music-root.c | 202 ++
- src/plugins/lms/rygel-lms-plugin-factory.c | 307 +++
- src/plugins/lms/rygel-lms-plugin.c | 134 ++
- src/plugins/lms/rygel-lms-root-container.c | 318 +++
- src/plugins/lms/rygel-lms-sql-function.c | 146 ++
- src/plugins/lms/rygel-lms-sql-operator.c | 240 ++
- 21 files changed, 9276 insertions(+), 1 deletion(-)
- create mode 100644 src/plugins/lms/librygel_lms_la_vala.stamp
- create mode 100644 src/plugins/lms/rygel-lms-album.c
- create mode 100644 src/plugins/lms/rygel-lms-albums.c
- create mode 100644 src/plugins/lms/rygel-lms-all-images.c
- create mode 100644 src/plugins/lms/rygel-lms-all-music.c
- create mode 100644 src/plugins/lms/rygel-lms-all-videos.c
- create mode 100644 src/plugins/lms/rygel-lms-artist.c
- create mode 100644 src/plugins/lms/rygel-lms-artists.c
- create mode 100644 src/plugins/lms/rygel-lms-category-container.c
- create mode 100644 src/plugins/lms/rygel-lms-database.c
- create mode 100644 src/plugins/lms/rygel-lms-dbus-interfaces.c
- create mode 100644 src/plugins/lms/rygel-lms-image-root.c
- create mode 100644 src/plugins/lms/rygel-lms-image-year.c
- create mode 100644 src/plugins/lms/rygel-lms-image-years.c
- create mode 100644 src/plugins/lms/rygel-lms-music-root.c
- create mode 100644 src/plugins/lms/rygel-lms-plugin-factory.c
- create mode 100644 src/plugins/lms/rygel-lms-plugin.c
- create mode 100644 src/plugins/lms/rygel-lms-root-container.c
- create mode 100644 src/plugins/lms/rygel-lms-sql-function.c
- create mode 100644 src/plugins/lms/rygel-lms-sql-operator.c
-
-diff --git a/src/plugins/lms/librygel_lms_la_vala.stamp b/src/plugins/lms/librygel_lms_la_vala.stamp
-new file mode 100644
-index 0000000..859afb1
---- /dev/null
-+++ b/src/plugins/lms/librygel_lms_la_vala.stamp
-@@ -0,0 +1 @@
-+stamp
-diff --git a/src/plugins/lms/rygel-lms-album.c b/src/plugins/lms/rygel-lms-album.c
-new file mode 100644
-index 0000000..9da60bc
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-album.c
-@@ -0,0 +1,514 @@
-+/* rygel-lms-album.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-album.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gio/gio.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ALBUM (rygel_lms_album_get_type ())
-+#define RYGEL_LMS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbum))
-+#define RYGEL_LMS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+#define RYGEL_LMS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+
-+typedef struct _RygelLMSAlbum RygelLMSAlbum;
-+typedef struct _RygelLMSAlbumClass RygelLMSAlbumClass;
-+typedef struct _RygelLMSAlbumPrivate RygelLMSAlbumPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSAlbum {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSAlbumPrivate * priv;
-+};
-+
-+struct _RygelLMSAlbumClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_album_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_album_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ALBUM_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ALBUM_SQL_ALL_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALBUM_SQL_COUNT_TEMPLATE "SELECT COUNT(audios.id) " "FROM audios, files " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;"
-+#define RYGEL_LMS_ALBUM_SQL_COUNT_WITH_FILTER_TEMPLATE "SELECT COUNT(audios.id), audios.title as title, " "audio_artists.name as artist, " "audio_albums.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;"
-+#define RYGEL_LMS_ALBUM_SQL_FIND_OBJECT_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title, audios.trackno, audios.length, audios.channels, audios.s" \
-+"ampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " "audio_artists.name, " "audio_albums.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id AND audios.a" \
-+"lbum_id = %s;"
-+#define RYGEL_LMS_ALBUM_SQL_ADDED_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s " "AND update_id > ? AND update_id <= ?;"
-+#define RYGEL_LMS_ALBUM_SQL_REMOVED_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "WHERE dtime <> 0 AND audios.id = files.id AND audios.album_id = %s " "AND update_id > ? AND update_id <= ?;"
-+static RygelMediaObject* rygel_lms_album_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gchar* rygel_lms_category_container_build_reference_id (RygelLMSCategoryContainer* self, gint db_id);
-+static gchar* rygel_lms_album_get_sql_all (const gchar* db_id);
-+static gchar* rygel_lms_album_get_sql_find_object (const gchar* db_id);
-+static gchar* rygel_lms_album_get_sql_count (const gchar* db_id);
-+static gchar* rygel_lms_album_get_sql_added (const gchar* db_id);
-+static gchar* rygel_lms_album_get_sql_removed (const gchar* db_id);
-+static gchar* rygel_lms_album_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_all (RygelLMSCategoryContainer* self);
-+const gchar* rygel_lms_category_container_get_db_id (RygelLMSCategoryContainer* self);
-+static gchar* rygel_lms_album_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_count (RygelLMSCategoryContainer* self);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSAlbum* rygel_lms_album_new (const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAlbum* rygel_lms_album_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_album_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSAlbum * self;
-+ RygelMediaObject* result = NULL;
-+ gint id = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* path = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* mime_type = NULL;
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ gboolean _tmp8_ = FALSE;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ gchar* song_id = NULL;
-+ gint _tmp18_ = 0;
-+ gchar* _tmp19_ = NULL;
-+ RygelMusicItem* song = NULL;
-+ RygelMusicItem* _tmp20_ = NULL;
-+ gint _tmp21_ = 0;
-+ gchar* _tmp22_ = NULL;
-+ gchar* _tmp23_ = NULL;
-+ sqlite3_stmt* _tmp24_ = NULL;
-+ gint _tmp25_ = 0;
-+ sqlite3_stmt* _tmp26_ = NULL;
-+ gint _tmp27_ = 0;
-+ sqlite3_stmt* _tmp28_ = NULL;
-+ gint _tmp29_ = 0;
-+ sqlite3_stmt* _tmp30_ = NULL;
-+ gint _tmp31_ = 0;
-+ sqlite3_stmt* _tmp32_ = NULL;
-+ gint _tmp33_ = 0;
-+ sqlite3_stmt* _tmp34_ = NULL;
-+ gint _tmp35_ = 0;
-+ sqlite3_stmt* _tmp36_ = NULL;
-+ const gchar* _tmp37_ = NULL;
-+ const gchar* _tmp38_ = NULL;
-+ sqlite3_stmt* _tmp39_ = NULL;
-+ const gchar* _tmp40_ = NULL;
-+ sqlite3_stmt* _tmp41_ = NULL;
-+ const gchar* _tmp42_ = NULL;
-+ GFile* file = NULL;
-+ const gchar* _tmp43_ = NULL;
-+ GFile* _tmp44_ = NULL;
-+ gchar* _tmp45_ = NULL;
-+ gchar* _tmp46_ = NULL;
-+ self = (RygelLMSAlbum*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ id = _tmp1_;
-+ _tmp2_ = statement;
-+ _tmp3_ = sqlite3_column_text (_tmp2_, 1);
-+ _tmp4_ = g_strdup (_tmp3_);
-+ path = _tmp4_;
-+ _tmp5_ = statement;
-+ _tmp6_ = sqlite3_column_text (_tmp5_, 10);
-+ _tmp7_ = g_strdup (_tmp6_);
-+ mime_type = _tmp7_;
-+ _tmp9_ = mime_type;
-+ if (_tmp9_ == NULL) {
-+ _tmp8_ = TRUE;
-+ } else {
-+ const gchar* _tmp10_ = NULL;
-+ gint _tmp11_ = 0;
-+ gint _tmp12_ = 0;
-+ _tmp10_ = mime_type;
-+ _tmp11_ = strlen (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp8_ = _tmp12_ == 0;
-+ }
-+ if (_tmp8_) {
-+ gint _tmp13_ = 0;
-+ const gchar* _tmp14_ = NULL;
-+ _tmp13_ = id;
-+ _tmp14_ = path;
-+ g_debug ("rygel-lms-album.vala:101: Music item %d (%s) has no MIME type", _tmp13_, _tmp14_);
-+ }
-+ _tmp15_ = statement;
-+ _tmp16_ = sqlite3_column_text (_tmp15_, 3);
-+ _tmp17_ = g_strdup (_tmp16_);
-+ title = _tmp17_;
-+ _tmp18_ = id;
-+ _tmp19_ = rygel_lms_category_container_build_child_id ((RygelLMSCategoryContainer*) self, _tmp18_);
-+ song_id = _tmp19_;
-+ _tmp20_ = rygel_music_item_new (song_id, (RygelMediaContainer*) self, title, RYGEL_MUSIC_ITEM_UPNP_CLASS);
-+ song = _tmp20_;
-+ _tmp21_ = id;
-+ _tmp22_ = rygel_lms_category_container_build_reference_id ((RygelLMSCategoryContainer*) self, _tmp21_);
-+ _tmp23_ = _tmp22_;
-+ rygel_media_object_set_ref_id ((RygelMediaObject*) song, _tmp23_);
-+ _g_free0 (_tmp23_);
-+ _tmp24_ = statement;
-+ _tmp25_ = sqlite3_column_int (_tmp24_, 2);
-+ rygel_media_file_item_set_size ((RygelMediaFileItem*) song, (gint64) _tmp25_);
-+ _tmp26_ = statement;
-+ _tmp27_ = sqlite3_column_int (_tmp26_, 4);
-+ rygel_music_item_set_track_number (song, _tmp27_);
-+ _tmp28_ = statement;
-+ _tmp29_ = sqlite3_column_int (_tmp28_, 5);
-+ rygel_audio_item_set_duration ((RygelAudioItem*) song, (glong) _tmp29_);
-+ _tmp30_ = statement;
-+ _tmp31_ = sqlite3_column_int (_tmp30_, 6);
-+ rygel_audio_item_set_channels ((RygelAudioItem*) song, _tmp31_);
-+ _tmp32_ = statement;
-+ _tmp33_ = sqlite3_column_int (_tmp32_, 7);
-+ rygel_audio_item_set_sample_freq ((RygelAudioItem*) song, _tmp33_);
-+ _tmp34_ = statement;
-+ _tmp35_ = sqlite3_column_int (_tmp34_, 8);
-+ rygel_audio_item_set_bitrate ((RygelAudioItem*) song, _tmp35_);
-+ _tmp36_ = statement;
-+ _tmp37_ = sqlite3_column_text (_tmp36_, 9);
-+ rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) song, _tmp37_);
-+ _tmp38_ = mime_type;
-+ rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) song, _tmp38_);
-+ _tmp39_ = statement;
-+ _tmp40_ = sqlite3_column_text (_tmp39_, 11);
-+ rygel_media_object_set_artist ((RygelMediaObject*) song, _tmp40_);
-+ _tmp41_ = statement;
-+ _tmp42_ = sqlite3_column_text (_tmp41_, 12);
-+ rygel_audio_item_set_album ((RygelAudioItem*) song, _tmp42_);
-+ _tmp43_ = path;
-+ _tmp44_ = g_file_new_for_path (_tmp43_);
-+ file = _tmp44_;
-+ _tmp45_ = g_file_get_uri (file);
-+ _tmp46_ = _tmp45_;
-+ rygel_media_object_add_uri ((RygelMediaObject*) song, _tmp46_);
-+ _g_free0 (_tmp46_);
-+ result = (RygelMediaObject*) song;
-+ _g_object_unref0 (file);
-+ _g_free0 (song_id);
-+ _g_free0 (title);
-+ _g_free0 (mime_type);
-+ _g_free0 (path);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_get_sql_all (const gchar* db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_ALL_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_get_sql_find_object (const gchar* db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_FIND_OBJECT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_get_sql_count (const gchar* db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_COUNT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_get_sql_added (const gchar* db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_ADDED_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_get_sql_removed (const gchar* db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_REMOVED_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAlbum * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ gchar* filter_str = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ self = (RygelLMSAlbum*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ const gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ _tmp3_ = rygel_lms_category_container_get_sql_all ((RygelLMSCategoryContainer*) self);
-+ _tmp4_ = _tmp3_;
-+ _tmp5_ = g_strdup (_tmp4_);
-+ result = _tmp5_;
-+ return result;
-+ }
-+ _tmp6_ = rygel_lms_category_container_get_db_id ((RygelLMSCategoryContainer*) self);
-+ _tmp7_ = _tmp6_;
-+ _tmp8_ = filter;
-+ _tmp9_ = g_strdup_printf ("%s AND %s", _tmp7_, _tmp8_);
-+ filter_str = _tmp9_;
-+ _tmp10_ = filter_str;
-+ _tmp11_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_ALL_TEMPLATE, _tmp10_);
-+ result = _tmp11_;
-+ _g_free0 (filter_str);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_album_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAlbum * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ gchar* filter_str = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ self = (RygelLMSAlbum*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ const gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ _tmp3_ = rygel_lms_category_container_get_sql_count ((RygelLMSCategoryContainer*) self);
-+ _tmp4_ = _tmp3_;
-+ _tmp5_ = g_strdup (_tmp4_);
-+ result = _tmp5_;
-+ return result;
-+ }
-+ _tmp6_ = rygel_lms_category_container_get_db_id ((RygelLMSCategoryContainer*) self);
-+ _tmp7_ = _tmp6_;
-+ _tmp8_ = filter;
-+ _tmp9_ = g_strdup_printf ("%s AND %s", _tmp7_, _tmp8_);
-+ filter_str = _tmp9_;
-+ _tmp10_ = filter_str;
-+ _tmp11_ = g_strdup_printf (RYGEL_LMS_ALBUM_SQL_COUNT_WITH_FILTER_TEMPLATE, _tmp10_);
-+ result = _tmp11_;
-+ _g_free0 (filter_str);
-+ return result;
-+}
-+
-+
-+RygelLMSAlbum* rygel_lms_album_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSAlbum * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ gchar* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ const gchar* _tmp13_ = NULL;
-+ gchar* _tmp14_ = NULL;
-+ gchar* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ gchar* _tmp18_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = db_id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ _tmp3_ = lms_db;
-+ _tmp4_ = db_id;
-+ _tmp5_ = rygel_lms_album_get_sql_all (_tmp4_);
-+ _tmp6_ = _tmp5_;
-+ _tmp7_ = db_id;
-+ _tmp8_ = rygel_lms_album_get_sql_find_object (_tmp7_);
-+ _tmp9_ = _tmp8_;
-+ _tmp10_ = db_id;
-+ _tmp11_ = rygel_lms_album_get_sql_count (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp13_ = db_id;
-+ _tmp14_ = rygel_lms_album_get_sql_added (_tmp13_);
-+ _tmp15_ = _tmp14_;
-+ _tmp16_ = db_id;
-+ _tmp17_ = rygel_lms_album_get_sql_removed (_tmp16_);
-+ _tmp18_ = _tmp17_;
-+ self = (RygelLMSAlbum*) rygel_lms_category_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp6_, _tmp9_, _tmp12_, _tmp15_, _tmp18_);
-+ _g_free0 (_tmp18_);
-+ _g_free0 (_tmp15_);
-+ _g_free0 (_tmp12_);
-+ _g_free0 (_tmp9_);
-+ _g_free0 (_tmp6_);
-+ return self;
-+}
-+
-+
-+RygelLMSAlbum* rygel_lms_album_new (const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_album_construct (RYGEL_LMS_TYPE_ALBUM, db_id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_album_class_init (RygelLMSAlbumClass * klass) {
-+ rygel_lms_album_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_album_real_object_from_statement;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_all_with_filter = rygel_lms_album_real_get_sql_all_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_count_with_filter = rygel_lms_album_real_get_sql_count_with_filter;
-+}
-+
-+
-+static void rygel_lms_album_instance_init (RygelLMSAlbum * self) {
-+}
-+
-+
-+GType rygel_lms_album_get_type (void) {
-+ static volatile gsize rygel_lms_album_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_album_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSAlbumClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_album_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSAlbum), 0, (GInstanceInitFunc) rygel_lms_album_instance_init, NULL };
-+ GType rygel_lms_album_type_id;
-+ rygel_lms_album_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSAlbum", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_album_type_id__volatile, rygel_lms_album_type_id);
-+ }
-+ return rygel_lms_album_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-albums.c b/src/plugins/lms/rygel-lms-albums.c
-new file mode 100644
-index 0000000..f9fabe7
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-albums.c
-@@ -0,0 +1,569 @@
-+/* rygel-lms-albums.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-albums.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gee.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ALBUMS (rygel_lms_albums_get_type ())
-+#define RYGEL_LMS_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbums))
-+#define RYGEL_LMS_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbumsClass))
-+#define RYGEL_LMS_IS_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALBUMS))
-+#define RYGEL_LMS_IS_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALBUMS))
-+#define RYGEL_LMS_ALBUMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbumsClass))
-+
-+typedef struct _RygelLMSAlbums RygelLMSAlbums;
-+typedef struct _RygelLMSAlbumsClass RygelLMSAlbumsClass;
-+typedef struct _RygelLMSAlbumsPrivate RygelLMSAlbumsPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
-+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_ALBUM (rygel_lms_album_get_type ())
-+#define RYGEL_LMS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbum))
-+#define RYGEL_LMS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+#define RYGEL_LMS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+
-+typedef struct _RygelLMSAlbum RygelLMSAlbum;
-+typedef struct _RygelLMSAlbumClass RygelLMSAlbumClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSAlbums {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSAlbumsPrivate * priv;
-+};
-+
-+struct _RygelLMSAlbumsClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+typedef enum {
-+ RYGEL_LMS_DATABASE_ERROR_OPEN,
-+ RYGEL_LMS_DATABASE_ERROR_PREPARE,
-+ RYGEL_LMS_DATABASE_ERROR_BIND,
-+ RYGEL_LMS_DATABASE_ERROR_STEP,
-+ RYGEL_LMS_DATABASE_ERROR_NOT_FOUND
-+} RygelLMSDatabaseError;
-+#define RYGEL_LMS_DATABASE_ERROR rygel_lms_database_error_quark ()
-+
-+static gpointer rygel_lms_albums_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_albums_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ALBUMS_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ALBUMS_SQL_ALL "SELECT audio_albums.id, audio_albums.name as title, " "audio_artists.name as artist " "FROM audio_albums " "LEFT JOIN audio_artists " "ON audio_albums.artist_id = audio_artists.id " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALBUMS_SQL_ALL_WITH_FILTER_TEMPLATE "SELECT audio_albums.id, audio_albums.name as title, " "audio_artists.name as artist " "FROM audio_albums " "LEFT JOIN audio_artists " "ON audio_albums.artist_id = audio_artists.id " "WHERE %s " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALBUMS_SQL_COUNT "SELECT COUNT(audio_albums.id) " "FROM audio_albums;"
-+#define RYGEL_LMS_ALBUMS_SQL_COUNT_WITH_FILTER_TEMPLATE "SELECT COUNT(audio_albums.id), audio_albums.name as title, " "audio_artists.name as artist " "FROM audio_albums " "LEFT JOIN audio_artists " "ON audio_albums.artist_id = audio_artists.id " "WHERE %s;"
-+#define RYGEL_LMS_ALBUMS_SQL_CHILD_COUNT_WITH_FILTER_TEMPLATE "SELECT COUNT(audios.id), audios.title as title, " "audio_artists.name as artist " "FROM audios, files, audio_albums " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_a" \
-+"lbums.id %s;"
-+#define RYGEL_LMS_ALBUMS_SQL_CHILD_ALL_WITH_FILTER_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name, audio_albums.id " "FROM audios, files, audio_albums " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_a" \
-+"lbums.id %s " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALBUMS_SQL_FIND_OBJECT "SELECT audio_albums.id, audio_albums.name " "FROM audio_albums " "WHERE audio_albums.id = ?;"
-+static gchar* rygel_lms_albums_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+static gchar* rygel_lms_albums_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+static guint rygel_lms_albums_real_get_child_count_with_filter (RygelLMSCategoryContainer* base, const gchar* where_filter, GValueArray* args);
-+guint rygel_lms_category_container_get_child_count_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+GQuark rygel_lms_database_error_quark (void);
-+sqlite3_stmt* rygel_lms_database_prepare_and_init (RygelLMSDatabase* self, const gchar* query, GValue* arguments, int arguments_length1, GError** error);
-+static RygelMediaObjects* rygel_lms_albums_real_get_children_with_filter (RygelLMSCategoryContainer* base, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+RygelMediaObjects* rygel_lms_category_container_get_children_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+gboolean rygel_lms_database_get_children_step (sqlite3_stmt* stmt, GError** error);
-+GType rygel_lms_album_get_type (void) G_GNUC_CONST;
-+RygelLMSAlbum* rygel_lms_album_new (const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAlbum* rygel_lms_album_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelMediaObject* rygel_lms_category_container_object_from_statement (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+static RygelMediaObject* rygel_lms_albums_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+RygelLMSAlbums* rygel_lms_albums_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAlbums* rygel_lms_albums_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static gchar* rygel_lms_albums_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAlbums * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ self = (RygelLMSAlbums*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ gchar* _tmp3_ = NULL;
-+ _tmp3_ = g_strdup (RYGEL_LMS_ALBUMS_SQL_ALL);
-+ result = _tmp3_;
-+ return result;
-+ }
-+ _tmp4_ = filter;
-+ _tmp5_ = g_strdup_printf (RYGEL_LMS_ALBUMS_SQL_ALL_WITH_FILTER_TEMPLATE, _tmp4_);
-+ result = _tmp5_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_albums_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAlbums * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ self = (RygelLMSAlbums*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ gchar* _tmp3_ = NULL;
-+ _tmp3_ = g_strdup (RYGEL_LMS_ALBUMS_SQL_COUNT);
-+ result = _tmp3_;
-+ return result;
-+ }
-+ _tmp4_ = filter;
-+ _tmp5_ = g_strdup_printf (RYGEL_LMS_ALBUMS_SQL_COUNT_WITH_FILTER_TEMPLATE, _tmp4_);
-+ result = _tmp5_;
-+ return result;
-+}
-+
-+
-+static guint rygel_lms_albums_real_get_child_count_with_filter (RygelLMSCategoryContainer* base, const gchar* where_filter, GValueArray* args) {
-+ RygelLMSAlbums * self;
-+ guint result = 0U;
-+ guint count = 0U;
-+ const gchar* _tmp0_ = NULL;
-+ GValueArray* _tmp1_ = NULL;
-+ guint _tmp2_ = 0U;
-+ gchar* filter = NULL;
-+ gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gint _tmp5_ = 0;
-+ gint _tmp6_ = 0;
-+ gchar* query = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* _tmp10_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ self = (RygelLMSAlbums*) base;
-+ g_return_val_if_fail (where_filter != NULL, 0U);
-+ g_return_val_if_fail (args != NULL, 0U);
-+ _tmp0_ = where_filter;
-+ _tmp1_ = args;
-+ _tmp2_ = RYGEL_LMS_CATEGORY_CONTAINER_CLASS (rygel_lms_albums_parent_class)->get_child_count_with_filter (G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer), _tmp0_, _tmp1_);
-+ count = _tmp2_;
-+ _tmp3_ = g_strdup ("");
-+ filter = _tmp3_;
-+ _tmp4_ = where_filter;
-+ _tmp5_ = strlen (_tmp4_);
-+ _tmp6_ = _tmp5_;
-+ if (_tmp6_ > 0) {
-+ const gchar* _tmp7_ = NULL;
-+ gchar* _tmp8_ = NULL;
-+ _tmp7_ = where_filter;
-+ _tmp8_ = g_strdup_printf ("AND %s", _tmp7_);
-+ _g_free0 (filter);
-+ filter = _tmp8_;
-+ }
-+ _tmp9_ = filter;
-+ _tmp10_ = g_strdup_printf (RYGEL_LMS_ALBUMS_SQL_CHILD_COUNT_WITH_FILTER_TEMPLATE, _tmp9_);
-+ query = _tmp10_;
-+ {
-+ sqlite3_stmt* stmt = NULL;
-+ RygelLMSDatabase* _tmp11_ = NULL;
-+ RygelLMSDatabase* _tmp12_ = NULL;
-+ GValueArray* _tmp13_ = NULL;
-+ GValue* _tmp14_ = NULL;
-+ gint _tmp14__length1 = 0;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ gint _tmp16_ = 0;
-+ _tmp11_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp12_ = _tmp11_;
-+ _tmp13_ = args;
-+ _tmp14_ = _tmp13_->values;
-+ _tmp14__length1 = (gint) _tmp13_->n_values;
-+ _tmp15_ = rygel_lms_database_prepare_and_init (_tmp12_, query, _tmp14_, _tmp14__length1, &_inner_error_);
-+ stmt = _tmp15_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch8_rygel_lms_database_error;
-+ }
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return 0U;
-+ }
-+ _tmp16_ = sqlite3_step (stmt);
-+ if (_tmp16_ == SQLITE_ROW) {
-+ guint _tmp17_ = 0U;
-+ gint _tmp18_ = 0;
-+ _tmp17_ = count;
-+ _tmp18_ = sqlite3_column_int (stmt, 0);
-+ count = _tmp17_ + _tmp18_;
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ }
-+ goto __finally8;
-+ __catch8_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp19_ = NULL;
-+ const gchar* _tmp20_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp19_ = e;
-+ _tmp20_ = _tmp19_->message;
-+ g_warning ("rygel-lms-albums.vala:116: Query failed: %s", _tmp20_);
-+ _g_error_free0 (e);
-+ }
-+ __finally8:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return 0U;
-+ }
-+ result = count;
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ return result;
-+}
-+
-+
-+static RygelMediaObjects* rygel_lms_albums_real_get_children_with_filter (RygelLMSCategoryContainer* base, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count) {
-+ RygelLMSAlbums * self;
-+ RygelMediaObjects* result = NULL;
-+ RygelMediaObjects* children = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ GValueArray* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ guint _tmp3_ = 0U;
-+ guint _tmp4_ = 0U;
-+ RygelMediaObjects* _tmp5_ = NULL;
-+ gchar* filter = NULL;
-+ gchar* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ gint _tmp8_ = 0;
-+ gint _tmp9_ = 0;
-+ gchar* query = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ self = (RygelLMSAlbums*) base;
-+ g_return_val_if_fail (where_filter != NULL, NULL);
-+ g_return_val_if_fail (args != NULL, NULL);
-+ g_return_val_if_fail (sort_criteria != NULL, NULL);
-+ _tmp0_ = where_filter;
-+ _tmp1_ = args;
-+ _tmp2_ = sort_criteria;
-+ _tmp3_ = offset;
-+ _tmp4_ = max_count;
-+ _tmp5_ = RYGEL_LMS_CATEGORY_CONTAINER_CLASS (rygel_lms_albums_parent_class)->get_children_with_filter (G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer), _tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp4_);
-+ children = _tmp5_;
-+ _tmp6_ = g_strdup ("");
-+ filter = _tmp6_;
-+ _tmp7_ = where_filter;
-+ _tmp8_ = strlen (_tmp7_);
-+ _tmp9_ = _tmp8_;
-+ if (_tmp9_ > 0) {
-+ const gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ _tmp10_ = where_filter;
-+ _tmp11_ = g_strdup_printf ("AND %s", _tmp10_);
-+ _g_free0 (filter);
-+ filter = _tmp11_;
-+ }
-+ _tmp12_ = filter;
-+ _tmp13_ = g_strdup_printf (RYGEL_LMS_ALBUMS_SQL_CHILD_ALL_WITH_FILTER_TEMPLATE, _tmp12_);
-+ query = _tmp13_;
-+ {
-+ sqlite3_stmt* stmt = NULL;
-+ RygelLMSDatabase* _tmp14_ = NULL;
-+ RygelLMSDatabase* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ GValueArray* _tmp17_ = NULL;
-+ GValue* _tmp18_ = NULL;
-+ gint _tmp18__length1 = 0;
-+ sqlite3_stmt* _tmp19_ = NULL;
-+ _tmp14_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp15_ = _tmp14_;
-+ _tmp16_ = query;
-+ _tmp17_ = args;
-+ _tmp18_ = _tmp17_->values;
-+ _tmp18__length1 = (gint) _tmp17_->n_values;
-+ _tmp19_ = rygel_lms_database_prepare_and_init (_tmp15_, _tmp16_, _tmp18_, _tmp18__length1, &_inner_error_);
-+ stmt = _tmp19_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch9_rygel_lms_database_error;
-+ }
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ while (TRUE) {
-+ gboolean _tmp20_ = FALSE;
-+ sqlite3_stmt* _tmp21_ = NULL;
-+ gboolean _tmp22_ = FALSE;
-+ gchar* album_id = NULL;
-+ sqlite3_stmt* _tmp23_ = NULL;
-+ const gchar* _tmp24_ = NULL;
-+ gchar* _tmp25_ = NULL;
-+ RygelLMSAlbum* album = NULL;
-+ const gchar* _tmp26_ = NULL;
-+ RygelLMSDatabase* _tmp27_ = NULL;
-+ RygelLMSDatabase* _tmp28_ = NULL;
-+ RygelLMSAlbum* _tmp29_ = NULL;
-+ RygelMediaObject* song = NULL;
-+ RygelLMSAlbum* _tmp30_ = NULL;
-+ sqlite3_stmt* _tmp31_ = NULL;
-+ RygelMediaObject* _tmp32_ = NULL;
-+ RygelMediaObject* _tmp33_ = NULL;
-+ RygelMediaObject* _tmp34_ = NULL;
-+ RygelMediaContainer* _tmp35_ = NULL;
-+ RygelMediaContainer* _tmp36_ = NULL;
-+ RygelMediaObjects* _tmp37_ = NULL;
-+ RygelMediaObject* _tmp38_ = NULL;
-+ _tmp21_ = stmt;
-+ _tmp22_ = rygel_lms_database_get_children_step (_tmp21_, &_inner_error_);
-+ _tmp20_ = _tmp22_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch9_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ if (!_tmp20_) {
-+ break;
-+ }
-+ _tmp23_ = stmt;
-+ _tmp24_ = sqlite3_column_text (_tmp23_, 13);
-+ _tmp25_ = g_strdup (_tmp24_);
-+ album_id = _tmp25_;
-+ _tmp26_ = album_id;
-+ _tmp27_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp28_ = _tmp27_;
-+ _tmp29_ = rygel_lms_album_new (_tmp26_, (RygelMediaContainer*) self, "", _tmp28_);
-+ album = _tmp29_;
-+ _tmp30_ = album;
-+ _tmp31_ = stmt;
-+ _tmp32_ = rygel_lms_category_container_object_from_statement ((RygelLMSCategoryContainer*) _tmp30_, _tmp31_);
-+ song = _tmp32_;
-+ _tmp33_ = song;
-+ _tmp34_ = song;
-+ _tmp35_ = rygel_media_object_get_parent (_tmp34_);
-+ _tmp36_ = _tmp35_;
-+ rygel_media_object_set_parent_ref (_tmp33_, _tmp36_);
-+ _tmp37_ = children;
-+ _tmp38_ = song;
-+ gee_abstract_collection_add ((GeeAbstractCollection*) _tmp37_, _tmp38_);
-+ _g_object_unref0 (song);
-+ _g_object_unref0 (album);
-+ _g_free0 (album_id);
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ }
-+ goto __finally9;
-+ __catch9_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp39_ = NULL;
-+ const gchar* _tmp40_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp39_ = e;
-+ _tmp40_ = _tmp39_->message;
-+ g_warning ("rygel-lms-albums.vala:149: Query failed: %s", _tmp40_);
-+ _g_error_free0 (e);
-+ }
-+ __finally9:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ result = children;
-+ _g_free0 (query);
-+ _g_free0 (filter);
-+ return result;
-+}
-+
-+
-+static RygelMediaObject* rygel_lms_albums_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSAlbums * self;
-+ RygelMediaObject* result = NULL;
-+ gchar* id = NULL;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* _tmp2_ = NULL;
-+ RygelLMSAlbum* album = NULL;
-+ sqlite3_stmt* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ RygelLMSDatabase* _tmp5_ = NULL;
-+ RygelLMSDatabase* _tmp6_ = NULL;
-+ RygelLMSAlbum* _tmp7_ = NULL;
-+ self = (RygelLMSAlbums*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ _tmp2_ = g_strdup_printf ("%d", _tmp1_);
-+ id = _tmp2_;
-+ _tmp3_ = statement;
-+ _tmp4_ = sqlite3_column_text (_tmp3_, 1);
-+ _tmp5_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp6_ = _tmp5_;
-+ _tmp7_ = rygel_lms_album_new (id, (RygelMediaContainer*) self, _tmp4_, _tmp6_);
-+ album = _tmp7_;
-+ result = (RygelMediaObject*) album;
-+ _g_free0 (id);
-+ return result;
-+}
-+
-+
-+RygelLMSAlbums* rygel_lms_albums_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ RygelLMSAlbums * self = NULL;
-+ RygelMediaContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = parent;
-+ _tmp1_ = _ ("Albums");
-+ _tmp2_ = lms_db;
-+ self = (RygelLMSAlbums*) rygel_lms_category_container_construct (object_type, "albums", _tmp0_, _tmp1_, _tmp2_, RYGEL_LMS_ALBUMS_SQL_ALL, RYGEL_LMS_ALBUMS_SQL_FIND_OBJECT, RYGEL_LMS_ALBUMS_SQL_COUNT, NULL, NULL);
-+ return self;
-+}
-+
-+
-+RygelLMSAlbums* rygel_lms_albums_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_albums_construct (RYGEL_LMS_TYPE_ALBUMS, parent, lms_db);
-+}
-+
-+
-+static void rygel_lms_albums_class_init (RygelLMSAlbumsClass * klass) {
-+ rygel_lms_albums_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_all_with_filter = rygel_lms_albums_real_get_sql_all_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_count_with_filter = rygel_lms_albums_real_get_sql_count_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_child_count_with_filter = rygel_lms_albums_real_get_child_count_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_children_with_filter = rygel_lms_albums_real_get_children_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_albums_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_albums_instance_init (RygelLMSAlbums * self) {
-+}
-+
-+
-+GType rygel_lms_albums_get_type (void) {
-+ static volatile gsize rygel_lms_albums_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_albums_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSAlbumsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_albums_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSAlbums), 0, (GInstanceInitFunc) rygel_lms_albums_instance_init, NULL };
-+ GType rygel_lms_albums_type_id;
-+ rygel_lms_albums_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSAlbums", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_albums_type_id__volatile, rygel_lms_albums_type_id);
-+ }
-+ return rygel_lms_albums_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-all-images.c b/src/plugins/lms/rygel-lms-all-images.c
-new file mode 100644
-index 0000000..33fb8c1
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-images.c
-@@ -0,0 +1,305 @@
-+/* rygel-lms-all-images.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-all-images.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gio/gio.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ALL_IMAGES (rygel_lms_all_images_get_type ())
-+#define RYGEL_LMS_ALL_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImages))
-+#define RYGEL_LMS_ALL_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImagesClass))
-+#define RYGEL_LMS_IS_ALL_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_IMAGES))
-+#define RYGEL_LMS_IS_ALL_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_IMAGES))
-+#define RYGEL_LMS_ALL_IMAGES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImagesClass))
-+
-+typedef struct _RygelLMSAllImages RygelLMSAllImages;
-+typedef struct _RygelLMSAllImagesClass RygelLMSAllImagesClass;
-+typedef struct _RygelLMSAllImagesPrivate RygelLMSAllImagesPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSAllImages {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSAllImagesPrivate * priv;
-+};
-+
-+struct _RygelLMSAllImagesClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_all_images_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_images_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ALL_IMAGES_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ALL_IMAGES_SQL_ALL "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALL_IMAGES_SQL_COUNT "SELECT count(images.id) " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id;"
-+#define RYGEL_LMS_ALL_IMAGES_SQL_FIND_OBJECT "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime " "FROM images, files " "WHERE dtime = 0 AND files.id = ? AND images.id = files.id;"
-+#define RYGEL_LMS_ALL_IMAGES_SQL_ADDED "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+#define RYGEL_LMS_ALL_IMAGES_SQL_REMOVED "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime " "FROM images, files " "WHERE dtime <> 0 AND images.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+static RygelMediaObject* rygel_lms_all_images_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSAllImages* rygel_lms_all_images_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAllImages* rygel_lms_all_images_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_all_images_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSAllImages * self;
-+ RygelMediaObject* result = NULL;
-+ gint id = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* path = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* mime_type = NULL;
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ gboolean _tmp8_ = FALSE;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ RygelImageItem* image = NULL;
-+ gint _tmp18_ = 0;
-+ gchar* _tmp19_ = NULL;
-+ gchar* _tmp20_ = NULL;
-+ RygelImageItem* _tmp21_ = NULL;
-+ RygelImageItem* _tmp22_ = NULL;
-+ sqlite3_stmt* _tmp23_ = NULL;
-+ const gchar* _tmp24_ = NULL;
-+ GTimeVal tv = {0};
-+ sqlite3_stmt* _tmp25_ = NULL;
-+ gint _tmp26_ = 0;
-+ GTimeVal _tmp27_ = {0};
-+ gchar* _tmp28_ = NULL;
-+ gchar* _tmp29_ = NULL;
-+ sqlite3_stmt* _tmp30_ = NULL;
-+ gint _tmp31_ = 0;
-+ sqlite3_stmt* _tmp32_ = NULL;
-+ gint _tmp33_ = 0;
-+ sqlite3_stmt* _tmp34_ = NULL;
-+ gint _tmp35_ = 0;
-+ const gchar* _tmp36_ = NULL;
-+ sqlite3_stmt* _tmp37_ = NULL;
-+ const gchar* _tmp38_ = NULL;
-+ GFile* file = NULL;
-+ const gchar* _tmp39_ = NULL;
-+ GFile* _tmp40_ = NULL;
-+ gchar* _tmp41_ = NULL;
-+ gchar* _tmp42_ = NULL;
-+ self = (RygelLMSAllImages*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ id = _tmp1_;
-+ _tmp2_ = statement;
-+ _tmp3_ = sqlite3_column_text (_tmp2_, 6);
-+ _tmp4_ = g_strdup (_tmp3_);
-+ path = _tmp4_;
-+ _tmp5_ = statement;
-+ _tmp6_ = sqlite3_column_text (_tmp5_, 9);
-+ _tmp7_ = g_strdup (_tmp6_);
-+ mime_type = _tmp7_;
-+ _tmp9_ = mime_type;
-+ if (_tmp9_ == NULL) {
-+ _tmp8_ = TRUE;
-+ } else {
-+ const gchar* _tmp10_ = NULL;
-+ gint _tmp11_ = 0;
-+ gint _tmp12_ = 0;
-+ _tmp10_ = mime_type;
-+ _tmp11_ = strlen (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp8_ = _tmp12_ == 0;
-+ }
-+ if (_tmp8_) {
-+ gint _tmp13_ = 0;
-+ const gchar* _tmp14_ = NULL;
-+ _tmp13_ = id;
-+ _tmp14_ = path;
-+ g_debug ("rygel-lms-all-images.vala:62: Image item %d (%s) has no MIME type", _tmp13_, _tmp14_);
-+ }
-+ _tmp15_ = statement;
-+ _tmp16_ = sqlite3_column_text (_tmp15_, 1);
-+ _tmp17_ = g_strdup (_tmp16_);
-+ title = _tmp17_;
-+ _tmp18_ = id;
-+ _tmp19_ = rygel_lms_category_container_build_child_id ((RygelLMSCategoryContainer*) self, _tmp18_);
-+ _tmp20_ = _tmp19_;
-+ _tmp21_ = rygel_image_item_new (_tmp20_, (RygelMediaContainer*) self, title, RYGEL_IMAGE_ITEM_UPNP_CLASS);
-+ _tmp22_ = _tmp21_;
-+ _g_free0 (_tmp20_);
-+ image = _tmp22_;
-+ _tmp23_ = statement;
-+ _tmp24_ = sqlite3_column_text (_tmp23_, 2);
-+ rygel_media_object_set_creator ((RygelMediaObject*) image, _tmp24_);
-+ _tmp25_ = statement;
-+ _tmp26_ = sqlite3_column_int (_tmp25_, 3);
-+ _tmp27_.tv_sec = (glong) _tmp26_;
-+ _tmp27_.tv_usec = (glong) 0;
-+ tv = _tmp27_;
-+ _tmp28_ = g_time_val_to_iso8601 (&tv);
-+ _tmp29_ = _tmp28_;
-+ rygel_media_object_set_date ((RygelMediaObject*) image, _tmp29_);
-+ _g_free0 (_tmp29_);
-+ _tmp30_ = statement;
-+ _tmp31_ = sqlite3_column_int (_tmp30_, 4);
-+ rygel_visual_item_set_width ((RygelVisualItem*) image, _tmp31_);
-+ _tmp32_ = statement;
-+ _tmp33_ = sqlite3_column_int (_tmp32_, 5);
-+ rygel_visual_item_set_height ((RygelVisualItem*) image, _tmp33_);
-+ _tmp34_ = statement;
-+ _tmp35_ = sqlite3_column_int (_tmp34_, 7);
-+ rygel_media_file_item_set_size ((RygelMediaFileItem*) image, (gint64) _tmp35_);
-+ _tmp36_ = mime_type;
-+ rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) image, _tmp36_);
-+ _tmp37_ = statement;
-+ _tmp38_ = sqlite3_column_text (_tmp37_, 8);
-+ rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) image, _tmp38_);
-+ _tmp39_ = path;
-+ _tmp40_ = g_file_new_for_path (_tmp39_);
-+ file = _tmp40_;
-+ _tmp41_ = g_file_get_uri (file);
-+ _tmp42_ = _tmp41_;
-+ rygel_media_object_add_uri ((RygelMediaObject*) image, _tmp42_);
-+ _g_free0 (_tmp42_);
-+ result = (RygelMediaObject*) image;
-+ _g_object_unref0 (file);
-+ _g_free0 (title);
-+ _g_free0 (mime_type);
-+ _g_free0 (path);
-+ return result;
-+}
-+
-+
-+RygelLMSAllImages* rygel_lms_all_images_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ RygelLMSAllImages * self = NULL;
-+ RygelMediaContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = parent;
-+ _tmp1_ = _ ("All");
-+ _tmp2_ = lms_db;
-+ self = (RygelLMSAllImages*) rygel_lms_category_container_construct (object_type, "all", _tmp0_, _tmp1_, _tmp2_, RYGEL_LMS_ALL_IMAGES_SQL_ALL, RYGEL_LMS_ALL_IMAGES_SQL_FIND_OBJECT, RYGEL_LMS_ALL_IMAGES_SQL_COUNT, RYGEL_LMS_ALL_IMAGES_SQL_ADDED, RYGEL_LMS_ALL_IMAGES_SQL_REMOVED);
-+ return self;
-+}
-+
-+
-+RygelLMSAllImages* rygel_lms_all_images_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_all_images_construct (RYGEL_LMS_TYPE_ALL_IMAGES, parent, lms_db);
-+}
-+
-+
-+static void rygel_lms_all_images_class_init (RygelLMSAllImagesClass * klass) {
-+ rygel_lms_all_images_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_all_images_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_all_images_instance_init (RygelLMSAllImages * self) {
-+}
-+
-+
-+GType rygel_lms_all_images_get_type (void) {
-+ static volatile gsize rygel_lms_all_images_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_all_images_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSAllImagesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_all_images_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSAllImages), 0, (GInstanceInitFunc) rygel_lms_all_images_instance_init, NULL };
-+ GType rygel_lms_all_images_type_id;
-+ rygel_lms_all_images_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSAllImages", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_all_images_type_id__volatile, rygel_lms_all_images_type_id);
-+ }
-+ return rygel_lms_all_images_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-all-music.c b/src/plugins/lms/rygel-lms-all-music.c
-new file mode 100644
-index 0000000..ee6118f
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-music.c
-@@ -0,0 +1,417 @@
-+/* rygel-lms-all-music.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-all-music.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gio/gio.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ALL_MUSIC (rygel_lms_all_music_get_type ())
-+#define RYGEL_LMS_ALL_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusic))
-+#define RYGEL_LMS_ALL_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusicClass))
-+#define RYGEL_LMS_IS_ALL_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_MUSIC))
-+#define RYGEL_LMS_IS_ALL_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_MUSIC))
-+#define RYGEL_LMS_ALL_MUSIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusicClass))
-+
-+typedef struct _RygelLMSAllMusic RygelLMSAllMusic;
-+typedef struct _RygelLMSAllMusicClass RygelLMSAllMusicClass;
-+typedef struct _RygelLMSAllMusicPrivate RygelLMSAllMusicPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSAllMusic {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSAllMusicPrivate * priv;
-+};
-+
-+struct _RygelLMSAllMusicClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_all_music_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_music_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ALL_MUSIC_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ALL_MUSIC_SQL_ALL_TEMPLATE "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name, " "files.mtime, " "audio_genres.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "LEFT JOIN audio_genres " "ON audios.genre_id = audio_genres.id " "WHERE dtime = 0 AND audios.id = files.id %s " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALL_MUSIC_SQL_COUNT "SELECT COUNT(audios.id) " "FROM audios, files " "WHERE dtime = 0 AND audios.id = files.id;"
-+#define RYGEL_LMS_ALL_MUSIC_SQL_COUNT_WITH_FILTER_TEMPLATE "SELECT COUNT(audios.id), audios.title as title, " "audio_artists.name as artist " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "WHERE dtime = 0 AND audios.id = files.id %s;"
-+#define RYGEL_LMS_ALL_MUSIC_SQL_FIND_OBJECT "SELECT files.id, files.path, files.size, " "audios.title, audios.trackno, audios.length, audios.channels, audios.s" \
-+"ampling_rate, audios.bitrate, audios.dlna_profile, audios.dlna_mime, " "audio_artists.name, " "audio_albums.name, " "files.mtime, " "audio_genres.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "LEFT JOIN audio_genres " "ON audios.genre_id = audio_genres.id " "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id;"
-+#define RYGEL_LMS_ALL_MUSIC_SQL_ADDED "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name, " "files.mtime, " "audio_genres.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "LEFT JOIN audio_genres " "ON audios.genre_id = audio_genres.id " "WHERE dtime = 0 AND audios.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+#define RYGEL_LMS_ALL_MUSIC_SQL_REMOVED "SELECT files.id, files.path, files.size, " "audios.title as title, audios.trackno, audios.length, audios.channels," \
-+" audios.sampling_rate, audios.bitrate, audios.dlna_profile, audios.dln" \
-+"a_mime, " "audio_artists.name as artist, " "audio_albums.name, " "files.mtime, " "audio_genres.name " "FROM audios, files " "LEFT JOIN audio_artists " "ON audios.artist_id = audio_artists.id " "LEFT JOIN audio_albums " "ON audios.album_id = audio_albums.id " "LEFT JOIN audio_genres " "ON audios.genre_id = audio_genres.id " "WHERE dtime <> 0 AND audios.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+static gchar* rygel_lms_all_music_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_all (RygelLMSCategoryContainer* self);
-+static gchar* rygel_lms_all_music_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_count (RygelLMSCategoryContainer* self);
-+static RygelMediaObject* rygel_lms_all_music_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSAllMusic* rygel_lms_all_music_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAllMusic* rygel_lms_all_music_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static gchar* rygel_lms_all_music_real_get_sql_all_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAllMusic * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ gchar* filter_str = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ self = (RygelLMSAllMusic*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ const gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ _tmp3_ = rygel_lms_category_container_get_sql_all ((RygelLMSCategoryContainer*) self);
-+ _tmp4_ = _tmp3_;
-+ _tmp5_ = g_strdup (_tmp4_);
-+ result = _tmp5_;
-+ return result;
-+ }
-+ _tmp6_ = filter;
-+ _tmp7_ = g_strdup_printf ("AND %s", _tmp6_);
-+ filter_str = _tmp7_;
-+ _tmp8_ = filter_str;
-+ _tmp9_ = g_strdup_printf (RYGEL_LMS_ALL_MUSIC_SQL_ALL_TEMPLATE, _tmp8_);
-+ result = _tmp9_;
-+ _g_free0 (filter_str);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_all_music_real_get_sql_count_with_filter (RygelLMSCategoryContainer* base, const gchar* filter) {
-+ RygelLMSAllMusic * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ gchar* filter_str = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ self = (RygelLMSAllMusic*) base;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = filter;
-+ _tmp1_ = strlen (_tmp0_);
-+ _tmp2_ = _tmp1_;
-+ if (_tmp2_ == 0) {
-+ const gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ _tmp3_ = rygel_lms_category_container_get_sql_count ((RygelLMSCategoryContainer*) self);
-+ _tmp4_ = _tmp3_;
-+ _tmp5_ = g_strdup (_tmp4_);
-+ result = _tmp5_;
-+ return result;
-+ }
-+ _tmp6_ = filter;
-+ _tmp7_ = g_strdup_printf ("AND %s", _tmp6_);
-+ filter_str = _tmp7_;
-+ _tmp8_ = filter_str;
-+ _tmp9_ = g_strdup_printf (RYGEL_LMS_ALL_MUSIC_SQL_COUNT_WITH_FILTER_TEMPLATE, _tmp8_);
-+ result = _tmp9_;
-+ _g_free0 (filter_str);
-+ return result;
-+}
-+
-+
-+static RygelMediaObject* rygel_lms_all_music_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSAllMusic * self;
-+ RygelMediaObject* result = NULL;
-+ gint id = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* path = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* mime_type = NULL;
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ gboolean _tmp8_ = FALSE;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ gchar* song_id = NULL;
-+ gint _tmp18_ = 0;
-+ gchar* _tmp19_ = NULL;
-+ RygelMusicItem* song = NULL;
-+ RygelMusicItem* _tmp20_ = NULL;
-+ sqlite3_stmt* _tmp21_ = NULL;
-+ gint _tmp22_ = 0;
-+ sqlite3_stmt* _tmp23_ = NULL;
-+ gint _tmp24_ = 0;
-+ sqlite3_stmt* _tmp25_ = NULL;
-+ gint _tmp26_ = 0;
-+ sqlite3_stmt* _tmp27_ = NULL;
-+ gint _tmp28_ = 0;
-+ sqlite3_stmt* _tmp29_ = NULL;
-+ gint _tmp30_ = 0;
-+ sqlite3_stmt* _tmp31_ = NULL;
-+ gint _tmp32_ = 0;
-+ sqlite3_stmt* _tmp33_ = NULL;
-+ const gchar* _tmp34_ = NULL;
-+ const gchar* _tmp35_ = NULL;
-+ sqlite3_stmt* _tmp36_ = NULL;
-+ const gchar* _tmp37_ = NULL;
-+ sqlite3_stmt* _tmp38_ = NULL;
-+ const gchar* _tmp39_ = NULL;
-+ GTimeVal tv = {0};
-+ sqlite3_stmt* _tmp40_ = NULL;
-+ gint _tmp41_ = 0;
-+ GTimeVal _tmp42_ = {0};
-+ gchar* _tmp43_ = NULL;
-+ gchar* _tmp44_ = NULL;
-+ sqlite3_stmt* _tmp45_ = NULL;
-+ const gchar* _tmp46_ = NULL;
-+ GFile* file = NULL;
-+ const gchar* _tmp47_ = NULL;
-+ GFile* _tmp48_ = NULL;
-+ gchar* _tmp49_ = NULL;
-+ gchar* _tmp50_ = NULL;
-+ self = (RygelLMSAllMusic*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ id = _tmp1_;
-+ _tmp2_ = statement;
-+ _tmp3_ = sqlite3_column_text (_tmp2_, 1);
-+ _tmp4_ = g_strdup (_tmp3_);
-+ path = _tmp4_;
-+ _tmp5_ = statement;
-+ _tmp6_ = sqlite3_column_text (_tmp5_, 10);
-+ _tmp7_ = g_strdup (_tmp6_);
-+ mime_type = _tmp7_;
-+ _tmp9_ = mime_type;
-+ if (_tmp9_ == NULL) {
-+ _tmp8_ = TRUE;
-+ } else {
-+ const gchar* _tmp10_ = NULL;
-+ gint _tmp11_ = 0;
-+ gint _tmp12_ = 0;
-+ _tmp10_ = mime_type;
-+ _tmp11_ = strlen (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp8_ = _tmp12_ == 0;
-+ }
-+ if (_tmp8_) {
-+ gint _tmp13_ = 0;
-+ const gchar* _tmp14_ = NULL;
-+ _tmp13_ = id;
-+ _tmp14_ = path;
-+ g_debug ("rygel-lms-all-music.vala:130: Music item %d (%s) has no MIME type", _tmp13_, _tmp14_);
-+ }
-+ _tmp15_ = statement;
-+ _tmp16_ = sqlite3_column_text (_tmp15_, 3);
-+ _tmp17_ = g_strdup (_tmp16_);
-+ title = _tmp17_;
-+ _tmp18_ = id;
-+ _tmp19_ = rygel_lms_category_container_build_child_id ((RygelLMSCategoryContainer*) self, _tmp18_);
-+ song_id = _tmp19_;
-+ _tmp20_ = rygel_music_item_new (song_id, (RygelMediaContainer*) self, title, RYGEL_MUSIC_ITEM_UPNP_CLASS);
-+ song = _tmp20_;
-+ _tmp21_ = statement;
-+ _tmp22_ = sqlite3_column_int (_tmp21_, 2);
-+ rygel_media_file_item_set_size ((RygelMediaFileItem*) song, (gint64) _tmp22_);
-+ _tmp23_ = statement;
-+ _tmp24_ = sqlite3_column_int (_tmp23_, 4);
-+ rygel_music_item_set_track_number (song, _tmp24_);
-+ _tmp25_ = statement;
-+ _tmp26_ = sqlite3_column_int (_tmp25_, 5);
-+ rygel_audio_item_set_duration ((RygelAudioItem*) song, (glong) _tmp26_);
-+ _tmp27_ = statement;
-+ _tmp28_ = sqlite3_column_int (_tmp27_, 6);
-+ rygel_audio_item_set_channels ((RygelAudioItem*) song, _tmp28_);
-+ _tmp29_ = statement;
-+ _tmp30_ = sqlite3_column_int (_tmp29_, 7);
-+ rygel_audio_item_set_sample_freq ((RygelAudioItem*) song, _tmp30_);
-+ _tmp31_ = statement;
-+ _tmp32_ = sqlite3_column_int (_tmp31_, 8);
-+ rygel_audio_item_set_bitrate ((RygelAudioItem*) song, _tmp32_);
-+ _tmp33_ = statement;
-+ _tmp34_ = sqlite3_column_text (_tmp33_, 9);
-+ rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) song, _tmp34_);
-+ _tmp35_ = mime_type;
-+ rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) song, _tmp35_);
-+ _tmp36_ = statement;
-+ _tmp37_ = sqlite3_column_text (_tmp36_, 11);
-+ rygel_media_object_set_artist ((RygelMediaObject*) song, _tmp37_);
-+ _tmp38_ = statement;
-+ _tmp39_ = sqlite3_column_text (_tmp38_, 12);
-+ rygel_audio_item_set_album ((RygelAudioItem*) song, _tmp39_);
-+ _tmp40_ = statement;
-+ _tmp41_ = sqlite3_column_int (_tmp40_, 13);
-+ _tmp42_.tv_sec = (glong) _tmp41_;
-+ _tmp42_.tv_usec = (glong) 0;
-+ tv = _tmp42_;
-+ _tmp43_ = g_time_val_to_iso8601 (&tv);
-+ _tmp44_ = _tmp43_;
-+ rygel_media_object_set_date ((RygelMediaObject*) song, _tmp44_);
-+ _g_free0 (_tmp44_);
-+ _tmp45_ = statement;
-+ _tmp46_ = sqlite3_column_text (_tmp45_, 14);
-+ rygel_media_object_set_genre ((RygelMediaObject*) song, _tmp46_);
-+ _tmp47_ = path;
-+ _tmp48_ = g_file_new_for_path (_tmp47_);
-+ file = _tmp48_;
-+ _tmp49_ = g_file_get_uri (file);
-+ _tmp50_ = _tmp49_;
-+ rygel_media_object_add_uri ((RygelMediaObject*) song, _tmp50_);
-+ _g_free0 (_tmp50_);
-+ result = (RygelMediaObject*) song;
-+ _g_object_unref0 (file);
-+ _g_free0 (song_id);
-+ _g_free0 (title);
-+ _g_free0 (mime_type);
-+ _g_free0 (path);
-+ return result;
-+}
-+
-+
-+RygelLMSAllMusic* rygel_lms_all_music_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ RygelLMSAllMusic * self = NULL;
-+ RygelMediaContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = parent;
-+ _tmp1_ = _ ("All");
-+ _tmp2_ = lms_db;
-+ _tmp3_ = g_strdup_printf (RYGEL_LMS_ALL_MUSIC_SQL_ALL_TEMPLATE, "");
-+ _tmp4_ = _tmp3_;
-+ self = (RygelLMSAllMusic*) rygel_lms_category_container_construct (object_type, "all", _tmp0_, _tmp1_, _tmp2_, _tmp4_, RYGEL_LMS_ALL_MUSIC_SQL_FIND_OBJECT, RYGEL_LMS_ALL_MUSIC_SQL_COUNT, RYGEL_LMS_ALL_MUSIC_SQL_ADDED, RYGEL_LMS_ALL_MUSIC_SQL_REMOVED);
-+ _g_free0 (_tmp4_);
-+ return self;
-+}
-+
-+
-+RygelLMSAllMusic* rygel_lms_all_music_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_all_music_construct (RYGEL_LMS_TYPE_ALL_MUSIC, parent, lms_db);
-+}
-+
-+
-+static void rygel_lms_all_music_class_init (RygelLMSAllMusicClass * klass) {
-+ rygel_lms_all_music_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_all_with_filter = rygel_lms_all_music_real_get_sql_all_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_count_with_filter = rygel_lms_all_music_real_get_sql_count_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_all_music_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_all_music_instance_init (RygelLMSAllMusic * self) {
-+}
-+
-+
-+GType rygel_lms_all_music_get_type (void) {
-+ static volatile gsize rygel_lms_all_music_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_all_music_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSAllMusicClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_all_music_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSAllMusic), 0, (GInstanceInitFunc) rygel_lms_all_music_instance_init, NULL };
-+ GType rygel_lms_all_music_type_id;
-+ rygel_lms_all_music_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSAllMusic", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_all_music_type_id__volatile, rygel_lms_all_music_type_id);
-+ }
-+ return rygel_lms_all_music_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-all-videos.c b/src/plugins/lms/rygel-lms-all-videos.c
-new file mode 100644
-index 0000000..51ba52c
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-all-videos.c
-@@ -0,0 +1,456 @@
-+/* rygel-lms-all-videos.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-all-videos.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gio/gio.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ALL_VIDEOS (rygel_lms_all_videos_get_type ())
-+#define RYGEL_LMS_ALL_VIDEOS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideos))
-+#define RYGEL_LMS_ALL_VIDEOS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideosClass))
-+#define RYGEL_LMS_IS_ALL_VIDEOS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS))
-+#define RYGEL_LMS_IS_ALL_VIDEOS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_VIDEOS))
-+#define RYGEL_LMS_ALL_VIDEOS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideosClass))
-+
-+typedef struct _RygelLMSAllVideos RygelLMSAllVideos;
-+typedef struct _RygelLMSAllVideosClass RygelLMSAllVideosClass;
-+typedef struct _RygelLMSAllVideosPrivate RygelLMSAllVideosPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
-+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSAllVideos {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSAllVideosPrivate * priv;
-+};
-+
-+struct _RygelLMSAllVideosClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+typedef enum {
-+ RYGEL_LMS_DATABASE_ERROR_OPEN,
-+ RYGEL_LMS_DATABASE_ERROR_PREPARE,
-+ RYGEL_LMS_DATABASE_ERROR_BIND,
-+ RYGEL_LMS_DATABASE_ERROR_STEP,
-+ RYGEL_LMS_DATABASE_ERROR_NOT_FOUND
-+} RygelLMSDatabaseError;
-+#define RYGEL_LMS_DATABASE_ERROR rygel_lms_database_error_quark ()
-+
-+static gpointer rygel_lms_all_videos_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_videos_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ALL_VIDEOS_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ALL_VIDEOS_SQL_ALL "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profi" \
-+"le, dlna_mime " "FROM videos, files " "WHERE dtime = 0 AND videos.id = files.id " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ALL_VIDEOS_SQL_COUNT "SELECT count(videos.id) " "FROM videos, files " "WHERE dtime = 0 AND videos.id = files.id;"
-+#define RYGEL_LMS_ALL_VIDEOS_SQL_FIND_OBJECT "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profi" \
-+"le, dlna_mime " "FROM videos, files " "WHERE dtime = 0 AND files.id = ? AND videos.id = files.id;"
-+#define RYGEL_LMS_ALL_VIDEOS_SQL_ADDED "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profi" \
-+"le, dlna_mime " "FROM videos, files " "WHERE dtime = 0 AND videos.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+#define RYGEL_LMS_ALL_VIDEOS_SQL_REMOVED "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profi" \
-+"le, dlna_mime " "FROM videos, files " "WHERE dtime <> 0 AND videos.id = files.id " "AND update_id > ? AND update_id <= ?;"
-+static RygelMediaObject* rygel_lms_all_videos_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+GQuark rygel_lms_database_error_quark (void);
-+sqlite3_stmt* rygel_lms_database_prepare (RygelLMSDatabase* self, const gchar* query_string, GError** error);
-+void rygel_lms_database_find_object (const gchar* id, sqlite3_stmt* stmt, GError** error);
-+RygelLMSAllVideos* rygel_lms_all_videos_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAllVideos* rygel_lms_all_videos_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_all_videos_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSAllVideos * self;
-+ RygelMediaObject* result = NULL;
-+ gint id = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* mime_type = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* path = NULL;
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ GFile* file = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ GFile* _tmp9_ = NULL;
-+ gboolean _tmp10_ = FALSE;
-+ const gchar* _tmp11_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp17_ = NULL;
-+ const gchar* _tmp18_ = NULL;
-+ gchar* _tmp19_ = NULL;
-+ RygelVideoItem* video = NULL;
-+ gint _tmp20_ = 0;
-+ gchar* _tmp21_ = NULL;
-+ gchar* _tmp22_ = NULL;
-+ const gchar* _tmp23_ = NULL;
-+ RygelVideoItem* _tmp24_ = NULL;
-+ RygelVideoItem* _tmp25_ = NULL;
-+ RygelVideoItem* _tmp26_ = NULL;
-+ sqlite3_stmt* _tmp27_ = NULL;
-+ const gchar* _tmp28_ = NULL;
-+ RygelVideoItem* _tmp29_ = NULL;
-+ sqlite3_stmt* _tmp30_ = NULL;
-+ gint _tmp31_ = 0;
-+ GTimeVal tv = {0};
-+ sqlite3_stmt* _tmp32_ = NULL;
-+ gint _tmp33_ = 0;
-+ GTimeVal _tmp34_ = {0};
-+ RygelVideoItem* _tmp35_ = NULL;
-+ gchar* _tmp36_ = NULL;
-+ gchar* _tmp37_ = NULL;
-+ RygelVideoItem* _tmp38_ = NULL;
-+ sqlite3_stmt* _tmp39_ = NULL;
-+ gint _tmp40_ = 0;
-+ RygelVideoItem* _tmp41_ = NULL;
-+ sqlite3_stmt* _tmp42_ = NULL;
-+ const gchar* _tmp43_ = NULL;
-+ RygelVideoItem* _tmp44_ = NULL;
-+ const gchar* _tmp45_ = NULL;
-+ RygelVideoItem* _tmp46_ = NULL;
-+ GFile* _tmp47_ = NULL;
-+ gchar* _tmp48_ = NULL;
-+ gchar* _tmp49_ = NULL;
-+ gchar* video_data = NULL;
-+ gchar* _tmp50_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ self = (RygelLMSAllVideos*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ id = _tmp1_;
-+ _tmp2_ = statement;
-+ _tmp3_ = sqlite3_column_text (_tmp2_, 8);
-+ _tmp4_ = g_strdup (_tmp3_);
-+ mime_type = _tmp4_;
-+ _tmp5_ = statement;
-+ _tmp6_ = sqlite3_column_text (_tmp5_, 4);
-+ _tmp7_ = g_strdup (_tmp6_);
-+ path = _tmp7_;
-+ _tmp8_ = path;
-+ _tmp9_ = g_file_new_for_path (_tmp8_);
-+ file = _tmp9_;
-+ _tmp11_ = mime_type;
-+ if (_tmp11_ == NULL) {
-+ _tmp10_ = TRUE;
-+ } else {
-+ const gchar* _tmp12_ = NULL;
-+ gint _tmp13_ = 0;
-+ gint _tmp14_ = 0;
-+ _tmp12_ = mime_type;
-+ _tmp13_ = strlen (_tmp12_);
-+ _tmp14_ = _tmp13_;
-+ _tmp10_ = _tmp14_ == 0;
-+ }
-+ if (_tmp10_) {
-+ gint _tmp15_ = 0;
-+ const gchar* _tmp16_ = NULL;
-+ _tmp15_ = id;
-+ _tmp16_ = path;
-+ g_debug ("rygel-lms-all-videos.vala:75: Video item %d (%s) has no MIME type", _tmp15_, _tmp16_);
-+ }
-+ _tmp17_ = statement;
-+ _tmp18_ = sqlite3_column_text (_tmp17_, 1);
-+ _tmp19_ = g_strdup (_tmp18_);
-+ title = _tmp19_;
-+ _tmp20_ = id;
-+ _tmp21_ = rygel_lms_category_container_build_child_id ((RygelLMSCategoryContainer*) self, _tmp20_);
-+ _tmp22_ = _tmp21_;
-+ _tmp23_ = title;
-+ _tmp24_ = rygel_video_item_new (_tmp22_, (RygelMediaContainer*) self, _tmp23_, RYGEL_VIDEO_ITEM_UPNP_CLASS);
-+ _tmp25_ = _tmp24_;
-+ _g_free0 (_tmp22_);
-+ video = _tmp25_;
-+ _tmp26_ = video;
-+ _tmp27_ = statement;
-+ _tmp28_ = sqlite3_column_text (_tmp27_, 2);
-+ rygel_media_object_set_creator ((RygelMediaObject*) _tmp26_, _tmp28_);
-+ _tmp29_ = video;
-+ _tmp30_ = statement;
-+ _tmp31_ = sqlite3_column_int (_tmp30_, 3);
-+ rygel_audio_item_set_duration ((RygelAudioItem*) _tmp29_, (glong) _tmp31_);
-+ _tmp32_ = statement;
-+ _tmp33_ = sqlite3_column_int (_tmp32_, 5);
-+ _tmp34_.tv_sec = (glong) _tmp33_;
-+ _tmp34_.tv_usec = (glong) 0;
-+ tv = _tmp34_;
-+ _tmp35_ = video;
-+ _tmp36_ = g_time_val_to_iso8601 (&tv);
-+ _tmp37_ = _tmp36_;
-+ rygel_media_object_set_date ((RygelMediaObject*) _tmp35_, _tmp37_);
-+ _g_free0 (_tmp37_);
-+ _tmp38_ = video;
-+ _tmp39_ = statement;
-+ _tmp40_ = sqlite3_column_int (_tmp39_, 6);
-+ rygel_media_file_item_set_size ((RygelMediaFileItem*) _tmp38_, (gint64) _tmp40_);
-+ _tmp41_ = video;
-+ _tmp42_ = statement;
-+ _tmp43_ = sqlite3_column_text (_tmp42_, 7);
-+ rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) _tmp41_, _tmp43_);
-+ _tmp44_ = video;
-+ _tmp45_ = mime_type;
-+ rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) _tmp44_, _tmp45_);
-+ _tmp46_ = video;
-+ _tmp47_ = file;
-+ _tmp48_ = g_file_get_uri (_tmp47_);
-+ _tmp49_ = _tmp48_;
-+ rygel_media_object_add_uri ((RygelMediaObject*) _tmp46_, _tmp49_);
-+ _g_free0 (_tmp49_);
-+ _tmp50_ = g_strdup ("select videos_videos.bitrate + videos_audios.bitrate, width, height, c" \
-+"hannels, sampling_rate " "from videos, videos_audios, videos_videos where videos.id = ? " "and videos.id = videos_audios.video_id and videos.id = videos_videos.v" \
-+"ideo_id;");
-+ video_data = _tmp50_;
-+ {
-+ sqlite3_stmt* stmt = NULL;
-+ RygelLMSDatabase* _tmp51_ = NULL;
-+ RygelLMSDatabase* _tmp52_ = NULL;
-+ const gchar* _tmp53_ = NULL;
-+ sqlite3_stmt* _tmp54_ = NULL;
-+ gint _tmp55_ = 0;
-+ gchar* _tmp56_ = NULL;
-+ gchar* _tmp57_ = NULL;
-+ sqlite3_stmt* _tmp58_ = NULL;
-+ RygelVideoItem* _tmp59_ = NULL;
-+ sqlite3_stmt* _tmp60_ = NULL;
-+ gint _tmp61_ = 0;
-+ RygelVideoItem* _tmp62_ = NULL;
-+ sqlite3_stmt* _tmp63_ = NULL;
-+ gint _tmp64_ = 0;
-+ RygelVideoItem* _tmp65_ = NULL;
-+ sqlite3_stmt* _tmp66_ = NULL;
-+ gint _tmp67_ = 0;
-+ RygelVideoItem* _tmp68_ = NULL;
-+ sqlite3_stmt* _tmp69_ = NULL;
-+ gint _tmp70_ = 0;
-+ RygelVideoItem* _tmp71_ = NULL;
-+ sqlite3_stmt* _tmp72_ = NULL;
-+ gint _tmp73_ = 0;
-+ _tmp51_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp52_ = _tmp51_;
-+ _tmp53_ = video_data;
-+ _tmp54_ = rygel_lms_database_prepare (_tmp52_, _tmp53_, &_inner_error_);
-+ stmt = _tmp54_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch10_rygel_lms_database_error;
-+ }
-+ _g_free0 (video_data);
-+ _g_object_unref0 (video);
-+ _g_free0 (title);
-+ _g_object_unref0 (file);
-+ _g_free0 (path);
-+ _g_free0 (mime_type);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _tmp55_ = id;
-+ _tmp56_ = g_strdup_printf ("%d", _tmp55_);
-+ _tmp57_ = _tmp56_;
-+ _tmp58_ = stmt;
-+ rygel_lms_database_find_object (_tmp57_, _tmp58_, &_inner_error_);
-+ _g_free0 (_tmp57_);
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch10_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ _g_free0 (video_data);
-+ _g_object_unref0 (video);
-+ _g_free0 (title);
-+ _g_object_unref0 (file);
-+ _g_free0 (path);
-+ _g_free0 (mime_type);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _tmp59_ = video;
-+ _tmp60_ = stmt;
-+ _tmp61_ = sqlite3_column_int (_tmp60_, 0);
-+ rygel_audio_item_set_bitrate ((RygelAudioItem*) _tmp59_, _tmp61_ / 8);
-+ _tmp62_ = video;
-+ _tmp63_ = stmt;
-+ _tmp64_ = sqlite3_column_int (_tmp63_, 1);
-+ rygel_visual_item_set_width ((RygelVisualItem*) _tmp62_, _tmp64_);
-+ _tmp65_ = video;
-+ _tmp66_ = stmt;
-+ _tmp67_ = sqlite3_column_int (_tmp66_, 2);
-+ rygel_visual_item_set_height ((RygelVisualItem*) _tmp65_, _tmp67_);
-+ _tmp68_ = video;
-+ _tmp69_ = stmt;
-+ _tmp70_ = sqlite3_column_int (_tmp69_, 3);
-+ rygel_audio_item_set_channels ((RygelAudioItem*) _tmp68_, _tmp70_);
-+ _tmp71_ = video;
-+ _tmp72_ = stmt;
-+ _tmp73_ = sqlite3_column_int (_tmp72_, 4);
-+ rygel_audio_item_set_sample_freq ((RygelAudioItem*) _tmp71_, _tmp73_);
-+ _sqlite3_finalize0 (stmt);
-+ }
-+ goto __finally10;
-+ __catch10_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp74_ = NULL;
-+ const gchar* _tmp75_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp74_ = e;
-+ _tmp75_ = _tmp74_->message;
-+ g_warning ("rygel-lms-all-videos.vala:105: Query failed: %s", _tmp75_);
-+ _g_error_free0 (e);
-+ }
-+ __finally10:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (video_data);
-+ _g_object_unref0 (video);
-+ _g_free0 (title);
-+ _g_object_unref0 (file);
-+ _g_free0 (path);
-+ _g_free0 (mime_type);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ result = (RygelMediaObject*) video;
-+ _g_free0 (video_data);
-+ _g_free0 (title);
-+ _g_object_unref0 (file);
-+ _g_free0 (path);
-+ _g_free0 (mime_type);
-+ return result;
-+}
-+
-+
-+RygelLMSAllVideos* rygel_lms_all_videos_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSAllVideos * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ _tmp3_ = lms_db;
-+ self = (RygelLMSAllVideos*) rygel_lms_category_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_, RYGEL_LMS_ALL_VIDEOS_SQL_ALL, RYGEL_LMS_ALL_VIDEOS_SQL_FIND_OBJECT, RYGEL_LMS_ALL_VIDEOS_SQL_COUNT, RYGEL_LMS_ALL_VIDEOS_SQL_ADDED, RYGEL_LMS_ALL_VIDEOS_SQL_REMOVED);
-+ return self;
-+}
-+
-+
-+RygelLMSAllVideos* rygel_lms_all_videos_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_all_videos_construct (RYGEL_LMS_TYPE_ALL_VIDEOS, id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_all_videos_class_init (RygelLMSAllVideosClass * klass) {
-+ rygel_lms_all_videos_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_all_videos_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_all_videos_instance_init (RygelLMSAllVideos * self) {
-+}
-+
-+
-+GType rygel_lms_all_videos_get_type (void) {
-+ static volatile gsize rygel_lms_all_videos_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_all_videos_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSAllVideosClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_all_videos_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSAllVideos), 0, (GInstanceInitFunc) rygel_lms_all_videos_instance_init, NULL };
-+ GType rygel_lms_all_videos_type_id;
-+ rygel_lms_all_videos_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSAllVideos", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_all_videos_type_id__volatile, rygel_lms_all_videos_type_id);
-+ }
-+ return rygel_lms_all_videos_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-artist.c b/src/plugins/lms/rygel-lms-artist.c
-new file mode 100644
-index 0000000..e686ea4
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-artist.c
-@@ -0,0 +1,274 @@
-+/* rygel-lms-artist.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-artist.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ARTIST (rygel_lms_artist_get_type ())
-+#define RYGEL_LMS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtist))
-+#define RYGEL_LMS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtistClass))
-+#define RYGEL_LMS_IS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ARTIST))
-+#define RYGEL_LMS_IS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ARTIST))
-+#define RYGEL_LMS_ARTIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtistClass))
-+
-+typedef struct _RygelLMSArtist RygelLMSArtist;
-+typedef struct _RygelLMSArtistClass RygelLMSArtistClass;
-+typedef struct _RygelLMSArtistPrivate RygelLMSArtistPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+#define RYGEL_LMS_TYPE_ALBUM (rygel_lms_album_get_type ())
-+#define RYGEL_LMS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbum))
-+#define RYGEL_LMS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+#define RYGEL_LMS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALBUM))
-+#define RYGEL_LMS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALBUM, RygelLMSAlbumClass))
-+
-+typedef struct _RygelLMSAlbum RygelLMSAlbum;
-+typedef struct _RygelLMSAlbumClass RygelLMSAlbumClass;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSArtist {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSArtistPrivate * priv;
-+};
-+
-+struct _RygelLMSArtistClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_artist_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_artist_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ARTIST_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ARTIST_SQL_ALL_TEMPLATE "SELECT audio_albums.id, audio_albums.name " "FROM audio_albums " "WHERE audio_albums.artist_id = %s " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ARTIST_SQL_COUNT_TEMPLATE "SELECT COUNT(audio_albums.id) " "FROM audio_albums " "WHERE audio_albums.artist_id = %s"
-+#define RYGEL_LMS_ARTIST_SQL_FIND_OBJECT_TEMPLATE "SELECT audio_albums.id, audio_albums.name " "FROM audio_albums " "WHERE audio_albums.id = ? AND audio_albums.artist_id = %s;"
-+static gchar* rygel_lms_artist_get_sql_all (const gchar* id);
-+static gchar* rygel_lms_artist_get_sql_find_object (const gchar* id);
-+static gchar* rygel_lms_artist_get_sql_count (const gchar* id);
-+static RygelMediaObject* rygel_lms_artist_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+RygelLMSAlbum* rygel_lms_album_new (const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAlbum* rygel_lms_album_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_album_get_type (void) G_GNUC_CONST;
-+RygelLMSArtist* rygel_lms_artist_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSArtist* rygel_lms_artist_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static gchar* rygel_lms_artist_get_sql_all (const gchar* id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ARTIST_SQL_ALL_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_artist_get_sql_find_object (const gchar* id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ARTIST_SQL_FIND_OBJECT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_artist_get_sql_count (const gchar* id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_ARTIST_SQL_COUNT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static RygelMediaObject* rygel_lms_artist_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSArtist * self;
-+ RygelMediaObject* result = NULL;
-+ gchar* db_id = NULL;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* _tmp2_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ RygelLMSDatabase* _tmp6_ = NULL;
-+ RygelLMSDatabase* _tmp7_ = NULL;
-+ RygelLMSAlbum* _tmp8_ = NULL;
-+ self = (RygelLMSArtist*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ _tmp2_ = g_strdup_printf ("%d", _tmp1_);
-+ db_id = _tmp2_;
-+ _tmp3_ = statement;
-+ _tmp4_ = sqlite3_column_text (_tmp3_, 1);
-+ _tmp5_ = g_strdup (_tmp4_);
-+ title = _tmp5_;
-+ _tmp6_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp7_ = _tmp6_;
-+ _tmp8_ = rygel_lms_album_new (db_id, (RygelMediaContainer*) self, title, _tmp7_);
-+ result = (RygelMediaObject*) _tmp8_;
-+ _g_free0 (title);
-+ _g_free0 (db_id);
-+ return result;
-+}
-+
-+
-+RygelLMSArtist* rygel_lms_artist_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSArtist * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ gchar* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ gchar* _tmp8_ = NULL;
-+ gchar* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ _tmp3_ = lms_db;
-+ _tmp4_ = id;
-+ _tmp5_ = rygel_lms_artist_get_sql_all (_tmp4_);
-+ _tmp6_ = _tmp5_;
-+ _tmp7_ = id;
-+ _tmp8_ = rygel_lms_artist_get_sql_find_object (_tmp7_);
-+ _tmp9_ = _tmp8_;
-+ _tmp10_ = id;
-+ _tmp11_ = rygel_lms_artist_get_sql_count (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ self = (RygelLMSArtist*) rygel_lms_category_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp6_, _tmp9_, _tmp12_, NULL, NULL);
-+ _g_free0 (_tmp12_);
-+ _g_free0 (_tmp9_);
-+ _g_free0 (_tmp6_);
-+ return self;
-+}
-+
-+
-+RygelLMSArtist* rygel_lms_artist_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_artist_construct (RYGEL_LMS_TYPE_ARTIST, id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_artist_class_init (RygelLMSArtistClass * klass) {
-+ rygel_lms_artist_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_artist_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_artist_instance_init (RygelLMSArtist * self) {
-+}
-+
-+
-+GType rygel_lms_artist_get_type (void) {
-+ static volatile gsize rygel_lms_artist_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_artist_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSArtistClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_artist_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSArtist), 0, (GInstanceInitFunc) rygel_lms_artist_instance_init, NULL };
-+ GType rygel_lms_artist_type_id;
-+ rygel_lms_artist_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSArtist", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_artist_type_id__volatile, rygel_lms_artist_type_id);
-+ }
-+ return rygel_lms_artist_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-artists.c b/src/plugins/lms/rygel-lms-artists.c
-new file mode 100644
-index 0000000..3ac85bc
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-artists.c
-@@ -0,0 +1,214 @@
-+/* rygel-lms-artists.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-artists.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_ARTISTS (rygel_lms_artists_get_type ())
-+#define RYGEL_LMS_ARTISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtists))
-+#define RYGEL_LMS_ARTISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtistsClass))
-+#define RYGEL_LMS_IS_ARTISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ARTISTS))
-+#define RYGEL_LMS_IS_ARTISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ARTISTS))
-+#define RYGEL_LMS_ARTISTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtistsClass))
-+
-+typedef struct _RygelLMSArtists RygelLMSArtists;
-+typedef struct _RygelLMSArtistsClass RygelLMSArtistsClass;
-+typedef struct _RygelLMSArtistsPrivate RygelLMSArtistsPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+#define RYGEL_LMS_TYPE_ARTIST (rygel_lms_artist_get_type ())
-+#define RYGEL_LMS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtist))
-+#define RYGEL_LMS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtistClass))
-+#define RYGEL_LMS_IS_ARTIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ARTIST))
-+#define RYGEL_LMS_IS_ARTIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ARTIST))
-+#define RYGEL_LMS_ARTIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ARTIST, RygelLMSArtistClass))
-+
-+typedef struct _RygelLMSArtist RygelLMSArtist;
-+typedef struct _RygelLMSArtistClass RygelLMSArtistClass;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSArtists {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSArtistsPrivate * priv;
-+};
-+
-+struct _RygelLMSArtistsClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_artists_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_artists_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_ARTISTS_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_ARTISTS_SQL_ALL "SELECT audio_artists.id, audio_artists.name " "FROM audio_artists " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_ARTISTS_SQL_COUNT "SELECT COUNT(audio_artists.id) " "FROM audio_artists;"
-+#define RYGEL_LMS_ARTISTS_SQL_FIND_OBJECT "SELECT audio_artists.id, audio_artists.name " "FROM audio_artists " "WHERE audio_artists.id = ?;"
-+static RygelMediaObject* rygel_lms_artists_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+RygelLMSArtist* rygel_lms_artist_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSArtist* rygel_lms_artist_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_artist_get_type (void) G_GNUC_CONST;
-+RygelLMSArtists* rygel_lms_artists_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSArtists* rygel_lms_artists_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_artists_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSArtists * self;
-+ RygelMediaObject* result = NULL;
-+ gchar* db_id = NULL;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* _tmp2_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ RygelLMSDatabase* _tmp6_ = NULL;
-+ RygelLMSDatabase* _tmp7_ = NULL;
-+ RygelLMSArtist* _tmp8_ = NULL;
-+ self = (RygelLMSArtists*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ _tmp2_ = g_strdup_printf ("%d", _tmp1_);
-+ db_id = _tmp2_;
-+ _tmp3_ = statement;
-+ _tmp4_ = sqlite3_column_text (_tmp3_, 1);
-+ _tmp5_ = g_strdup (_tmp4_);
-+ title = _tmp5_;
-+ _tmp6_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp7_ = _tmp6_;
-+ _tmp8_ = rygel_lms_artist_new (db_id, (RygelMediaContainer*) self, title, _tmp7_);
-+ result = (RygelMediaObject*) _tmp8_;
-+ _g_free0 (title);
-+ _g_free0 (db_id);
-+ return result;
-+}
-+
-+
-+RygelLMSArtists* rygel_lms_artists_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSArtists * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ _tmp3_ = lms_db;
-+ self = (RygelLMSArtists*) rygel_lms_category_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_, RYGEL_LMS_ARTISTS_SQL_ALL, RYGEL_LMS_ARTISTS_SQL_FIND_OBJECT, RYGEL_LMS_ARTISTS_SQL_COUNT, NULL, NULL);
-+ return self;
-+}
-+
-+
-+RygelLMSArtists* rygel_lms_artists_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_artists_construct (RYGEL_LMS_TYPE_ARTISTS, id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_artists_class_init (RygelLMSArtistsClass * klass) {
-+ rygel_lms_artists_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_artists_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_artists_instance_init (RygelLMSArtists * self) {
-+}
-+
-+
-+GType rygel_lms_artists_get_type (void) {
-+ static volatile gsize rygel_lms_artists_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_artists_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSArtistsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_artists_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSArtists), 0, (GInstanceInitFunc) rygel_lms_artists_instance_init, NULL };
-+ GType rygel_lms_artists_type_id;
-+ rygel_lms_artists_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSArtists", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_artists_type_id__volatile, rygel_lms_artists_type_id);
-+ }
-+ return rygel_lms_artists_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-category-container.c b/src/plugins/lms/rygel-lms-category-container.c
-new file mode 100644
-index 0000000..21692d0
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-category-container.c
-@@ -0,0 +1,2772 @@
-+/* rygel-lms-category-container.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-category-container.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2009,2010 Jens Georg <mail@jensge.org>,
-+ * (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gee.h>
-+#include <libgupnp-av/gupnp-av.h>
-+#include <gio/gio.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
-+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_SQL_OPERATOR (rygel_lms_sql_operator_get_type ())
-+#define RYGEL_LMS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperator))
-+#define RYGEL_LMS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+#define RYGEL_LMS_IS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_IS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_SQL_OPERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+
-+typedef struct _RygelLMSSqlOperator RygelLMSSqlOperator;
-+typedef struct _RygelLMSSqlOperatorClass RygelLMSSqlOperatorClass;
-+
-+#define RYGEL_LMS_TYPE_SQL_FUNCTION (rygel_lms_sql_function_get_type ())
-+#define RYGEL_LMS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunction))
-+#define RYGEL_LMS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunctionClass))
-+#define RYGEL_LMS_IS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION))
-+#define RYGEL_LMS_IS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_SQL_FUNCTION))
-+#define RYGEL_LMS_SQL_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunctionClass))
-+
-+typedef struct _RygelLMSSqlFunction RygelLMSSqlFunction;
-+typedef struct _RygelLMSSqlFunctionClass RygelLMSSqlFunctionClass;
-+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-+#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
-+#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
-+typedef struct _RygelLmsCategoryContainerSearchData RygelLmsCategoryContainerSearchData;
-+typedef struct _RygelLmsCategoryContainerGetChildrenData RygelLmsCategoryContainerGetChildrenData;
-+typedef struct _RygelLmsCategoryContainerFindObjectData RygelLmsCategoryContainerFindObjectData;
-+typedef struct _RygelLmsCategoryContainerAddChildData RygelLmsCategoryContainerAddChildData;
-+typedef struct _RygelLmsCategoryContainerRemoveChildData RygelLmsCategoryContainerRemoveChildData;
-+
-+typedef enum {
-+ RYGEL_LMS_CATEGORY_CONTAINER_ERROR_SQLITE_ERROR,
-+ RYGEL_LMS_CATEGORY_CONTAINER_ERROR_GENERAL_ERROR,
-+ RYGEL_LMS_CATEGORY_CONTAINER_ERROR_INVALID_TYPE,
-+ RYGEL_LMS_CATEGORY_CONTAINER_ERROR_UNSUPPORTED_SEARCH
-+} RygelLMSCategoryContainerError;
-+#define RYGEL_LMS_CATEGORY_CONTAINER_ERROR rygel_lms_category_container_error_quark ()
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSCategoryContainerPrivate {
-+ GeeArrayList* _search_classes;
-+ RygelLMSDatabase* _lms_db;
-+ gchar* _db_id;
-+ gchar* _sql_all;
-+ gchar* _sql_find_object;
-+ gchar* _sql_count;
-+ gchar* _sql_added;
-+ gchar* _sql_removed;
-+};
-+
-+typedef enum {
-+ RYGEL_LMS_DATABASE_ERROR_OPEN,
-+ RYGEL_LMS_DATABASE_ERROR_PREPARE,
-+ RYGEL_LMS_DATABASE_ERROR_BIND,
-+ RYGEL_LMS_DATABASE_ERROR_STEP,
-+ RYGEL_LMS_DATABASE_ERROR_NOT_FOUND
-+} RygelLMSDatabaseError;
-+#define RYGEL_LMS_DATABASE_ERROR rygel_lms_database_error_quark ()
-+struct _RygelLmsCategoryContainerSearchData {
-+ int _state_;
-+ GObject* _source_object_;
-+ GAsyncResult* _res_;
-+ GSimpleAsyncResult* _async_result;
-+ RygelLMSCategoryContainer* self;
-+ RygelSearchExpression* expression;
-+ guint offset;
-+ guint max_count;
-+ guint total_matches;
-+ gchar* sort_criteria;
-+ GCancellable* cancellable;
-+ RygelMediaObjects* result;
-+ GValueArray* args;
-+ GValueArray* _tmp0_;
-+ gchar* filter;
-+ RygelSearchExpression* _tmp1_;
-+ GValueArray* _tmp2_;
-+ gchar* _tmp3_;
-+ const gchar* _tmp4_;
-+ GValueArray* _tmp5_;
-+ guint _tmp6_;
-+ RygelSearchExpression* _tmp7_;
-+ RygelSearchExpression* _tmp8_;
-+ gchar* _tmp9_;
-+ gchar* _tmp10_;
-+ const gchar* _tmp11_;
-+ guint _tmp12_;
-+ guint _tmp13_;
-+ const gchar* _tmp14_;
-+ GValueArray* _tmp15_;
-+ const gchar* _tmp16_;
-+ guint _tmp17_;
-+ guint _tmp18_;
-+ RygelMediaObjects* _tmp19_;
-+ GError* e;
-+ GError* _tmp20_;
-+ const gchar* _tmp21_;
-+ RygelMediaObjects* _tmp22_;
-+ RygelSearchExpression* _tmp23_;
-+ guint _tmp24_;
-+ guint _tmp25_;
-+ const gchar* _tmp26_;
-+ GCancellable* _tmp27_;
-+ guint _tmp28_;
-+ RygelMediaObjects* _tmp29_;
-+ RygelMediaObjects* _tmp30_;
-+ GError * _inner_error_;
-+};
-+
-+struct _RygelLmsCategoryContainerGetChildrenData {
-+ int _state_;
-+ GObject* _source_object_;
-+ GAsyncResult* _res_;
-+ GSimpleAsyncResult* _async_result;
-+ RygelLMSCategoryContainer* self;
-+ guint offset;
-+ guint max_count;
-+ gchar* sort_criteria;
-+ GCancellable* cancellable;
-+ RygelMediaObjects* result;
-+ RygelMediaObjects* retval;
-+ RygelMediaObjects* _tmp0_;
-+ sqlite3_stmt* _tmp1_;
-+ guint _tmp2_;
-+ guint _tmp3_;
-+ const gchar* _tmp4_;
-+ gboolean _tmp5_;
-+ sqlite3_stmt* _tmp6_;
-+ gboolean _tmp7_;
-+ RygelMediaObjects* _tmp8_;
-+ sqlite3_stmt* _tmp9_;
-+ RygelMediaObject* _tmp10_;
-+ RygelMediaObject* _tmp11_;
-+ GError * _inner_error_;
-+};
-+
-+struct _RygelLmsCategoryContainerFindObjectData {
-+ int _state_;
-+ GObject* _source_object_;
-+ GAsyncResult* _res_;
-+ GSimpleAsyncResult* _async_result;
-+ RygelLMSCategoryContainer* self;
-+ gchar* id;
-+ GCancellable* cancellable;
-+ RygelMediaObject* result;
-+ const gchar* _tmp0_;
-+ const gchar* _tmp1_;
-+ gboolean _tmp2_;
-+ RygelMediaObject* object;
-+ gchar* real_id;
-+ const gchar* _tmp3_;
-+ const gchar* _tmp4_;
-+ gint _tmp5_;
-+ gint _tmp6_;
-+ gchar* _tmp7_;
-+ gint index;
-+ const gchar* _tmp8_;
-+ gint _tmp9_;
-+ gint _tmp10_;
-+ const gchar* _tmp11_;
-+ gint _tmp12_;
-+ gchar* _tmp13_;
-+ const gchar* _tmp14_;
-+ sqlite3_stmt* _tmp15_;
-+ RygelMediaObject* child;
-+ sqlite3_stmt* _tmp16_;
-+ RygelMediaObject* _tmp17_;
-+ gint _tmp18_;
-+ RygelMediaObject* _tmp19_;
-+ RygelMediaObject* _tmp20_;
-+ RygelLMSCategoryContainer* container;
-+ RygelMediaObject* _tmp21_;
-+ RygelLMSCategoryContainer* _tmp22_;
-+ RygelMediaObject* _tmp23_;
-+ RygelLMSCategoryContainer* _tmp24_;
-+ const gchar* _tmp25_;
-+ GCancellable* _tmp26_;
-+ RygelMediaObject* _tmp27_;
-+ RygelMediaObject* _tmp28_;
-+ RygelMediaObject* _tmp29_;
-+ RygelMediaObject* _tmp30_;
-+ RygelMediaContainer* _tmp31_;
-+ RygelMediaContainer* _tmp32_;
-+ GError* e;
-+ const gchar* _tmp33_;
-+ const gchar* _tmp34_;
-+ const gchar* _tmp35_;
-+ GError* _tmp36_;
-+ const gchar* _tmp37_;
-+ GError * _inner_error_;
-+};
-+
-+struct _RygelLmsCategoryContainerAddChildData {
-+ int _state_;
-+ GObject* _source_object_;
-+ GAsyncResult* _res_;
-+ GSimpleAsyncResult* _async_result;
-+ RygelLMSCategoryContainer* self;
-+ RygelMediaObject* object;
-+};
-+
-+struct _RygelLmsCategoryContainerRemoveChildData {
-+ int _state_;
-+ GObject* _source_object_;
-+ GAsyncResult* _res_;
-+ GSimpleAsyncResult* _async_result;
-+ RygelLMSCategoryContainer* self;
-+ RygelMediaObject* object;
-+};
-+
-+
-+static gpointer rygel_lms_category_container_parent_class = NULL;
-+static RygelTrackableContainerIface* rygel_lms_category_container_rygel_trackable_container_parent_iface = NULL;
-+static RygelSearchableContainerIface* rygel_lms_category_container_rygel_searchable_container_parent_iface = NULL;
-+
-+GQuark rygel_lms_category_container_error_quark (void);
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerPrivate))
-+enum {
-+ RYGEL_LMS_CATEGORY_CONTAINER_DUMMY_PROPERTY,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SEARCH_CLASSES,
-+ RYGEL_LMS_CATEGORY_CONTAINER_LMS_DB,
-+ RYGEL_LMS_CATEGORY_CONTAINER_DB_ID,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SQL_ALL,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SQL_FIND_OBJECT,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SQL_COUNT,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SQL_ADDED,
-+ RYGEL_LMS_CATEGORY_CONTAINER_SQL_REMOVED
-+};
-+RygelMediaObject* rygel_lms_category_container_object_from_statement (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+static RygelMediaObject* rygel_lms_category_container_real_object_from_statement (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_get_sql_all_with_filter (RygelLMSCategoryContainer* self, const gchar* filter);
-+static gchar* rygel_lms_category_container_real_get_sql_all_with_filter (RygelLMSCategoryContainer* self, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_all (RygelLMSCategoryContainer* self);
-+gchar* rygel_lms_category_container_get_sql_count_with_filter (RygelLMSCategoryContainer* self, const gchar* filter);
-+static gchar* rygel_lms_category_container_real_get_sql_count_with_filter (RygelLMSCategoryContainer* self, const gchar* filter);
-+const gchar* rygel_lms_category_container_get_sql_count (RygelLMSCategoryContainer* self);
-+static gchar* rygel_lms_category_container_map_operand_to_column (const gchar* operand, gchar** collate, gboolean for_sort, GError** error);
-+static gchar* rygel_lms_category_container_relational_expression_to_sql (RygelRelationalExpression* exp, GValueArray* args, GError** error);
-+static void _vala_GValue_free (GValue* self);
-+GType rygel_lms_sql_operator_get_type (void) G_GNUC_CONST;
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new_from_search_criteria_op (GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct_from_search_criteria_op (GType object_type, GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-+RygelLMSSqlFunction* rygel_lms_sql_function_new (const gchar* name, const gchar* arg);
-+RygelLMSSqlFunction* rygel_lms_sql_function_construct (GType object_type, const gchar* name, const gchar* arg);
-+GType rygel_lms_sql_function_get_type (void) G_GNUC_CONST;
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate);
-+gchar* rygel_lms_sql_operator_to_string (RygelLMSSqlOperator* self);
-+static gchar* rygel_lms_category_container_logical_expression_to_sql (RygelLogicalExpression* expression, GValueArray* args, GError** error);
-+static gchar* rygel_lms_category_container_search_expression_to_sql (RygelSearchExpression* expression, GValueArray* args, GError** error);
-+guint rygel_lms_category_container_get_child_count_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+static guint rygel_lms_category_container_real_get_child_count_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+GQuark rygel_lms_database_error_quark (void);
-+sqlite3_stmt* rygel_lms_database_prepare_and_init (RygelLMSDatabase* self, const gchar* query, GValue* arguments, int arguments_length1, GError** error);
-+RygelMediaObjects* rygel_lms_category_container_get_children_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+static RygelMediaObjects* rygel_lms_category_container_real_get_children_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+gboolean rygel_lms_database_get_children_step (sqlite3_stmt* stmt, GError** error);
-+static void rygel_lms_category_container_real_search_data_free (gpointer _data);
-+static void rygel_lms_category_container_real_search (RygelSearchableContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-+static gboolean rygel_lms_category_container_real_search_co (RygelLmsCategoryContainerSearchData* _data_);
-+static void rygel_lms_category_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
-+static void rygel_lms_category_container_real_get_children_data_free (gpointer _data);
-+static void rygel_lms_category_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-+static gboolean rygel_lms_category_container_real_get_children_co (RygelLmsCategoryContainerGetChildrenData* _data_);
-+void rygel_lms_database_get_children_init (sqlite3_stmt* stmt, guint offset, guint max_count, const gchar* sort_criteria, GError** error);
-+static void rygel_lms_category_container_real_find_object_data_free (gpointer _data);
-+static void rygel_lms_category_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-+static gboolean rygel_lms_category_container_real_find_object_co (RygelLmsCategoryContainerFindObjectData* _data_);
-+void rygel_lms_database_find_object (const gchar* id, sqlite3_stmt* stmt, GError** error);
-+static void rygel_lms_category_container_find_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gchar* rygel_lms_category_container_build_reference_id (RygelLMSCategoryContainer* self, gint db_id);
-+static void rygel_lms_category_container_real_add_child_data_free (gpointer _data);
-+static void rygel_lms_category_container_real_add_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_);
-+static gboolean rygel_lms_category_container_real_add_child_co (RygelLmsCategoryContainerAddChildData* _data_);
-+static void rygel_lms_category_container_real_remove_child_data_free (gpointer _data);
-+static void rygel_lms_category_container_real_remove_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_);
-+static gboolean rygel_lms_category_container_real_remove_child_co (RygelLmsCategoryContainerRemoveChildData* _data_);
-+static void rygel_lms_category_container_on_db_updated (RygelLMSCategoryContainer* self, guint64 old_id, guint64 new_id);
-+sqlite3_stmt* rygel_lms_database_prepare (RygelLMSDatabase* self, const gchar* query_string, GError** error);
-+void rygel_lms_database_get_children_with_update_id_init (sqlite3_stmt* stmt, guint64 old_id, guint64 new_id, GError** error);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+static void rygel_lms_category_container_set_lms_db (RygelLMSCategoryContainer* self, RygelLMSDatabase* value);
-+const gchar* rygel_lms_category_container_get_db_id (RygelLMSCategoryContainer* self);
-+static void rygel_lms_category_container_set_db_id (RygelLMSCategoryContainer* self, const gchar* value);
-+static void rygel_lms_category_container_set_sql_all (RygelLMSCategoryContainer* self, const gchar* value);
-+const gchar* rygel_lms_category_container_get_sql_find_object (RygelLMSCategoryContainer* self);
-+static void rygel_lms_category_container_set_sql_find_object (RygelLMSCategoryContainer* self, const gchar* value);
-+static void rygel_lms_category_container_set_sql_count (RygelLMSCategoryContainer* self, const gchar* value);
-+const gchar* rygel_lms_category_container_get_sql_added (RygelLMSCategoryContainer* self);
-+static void rygel_lms_category_container_set_sql_added (RygelLMSCategoryContainer* self, const gchar* value);
-+const gchar* rygel_lms_category_container_get_sql_removed (RygelLMSCategoryContainer* self);
-+static void rygel_lms_category_container_set_sql_removed (RygelLMSCategoryContainer* self, const gchar* value);
-+static GObject * rygel_lms_category_container_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
-+static void _rygel_lms_category_container_on_db_updated_rygel_lms_database_db_updated (RygelLMSDatabase* _sender, guint64 old_update_id, guint64 new_update_id, gpointer self);
-+static void rygel_lms_category_container_finalize (GObject* obj);
-+static void _vala_rygel_lms_category_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
-+static void _vala_rygel_lms_category_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
-+
-+
-+GQuark rygel_lms_category_container_error_quark (void) {
-+ return g_quark_from_static_string ("rygel_lms_category_container_error-quark");
-+}
-+
-+
-+static RygelMediaObject* rygel_lms_category_container_real_object_from_statement (RygelLMSCategoryContainer* self, sqlite3_stmt* statement) {
-+ g_critical ("Type `%s' does not implement abstract method `rygel_lms_category_container_object_from_statement'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
-+ return NULL;
-+}
-+
-+
-+RygelMediaObject* rygel_lms_category_container_object_from_statement (RygelLMSCategoryContainer* self, sqlite3_stmt* statement) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS (self)->object_from_statement (self, statement);
-+}
-+
-+
-+static gchar* rygel_lms_category_container_real_get_sql_all_with_filter (RygelLMSCategoryContainer* self, const gchar* filter) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_all;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+gchar* rygel_lms_category_container_get_sql_all_with_filter (RygelLMSCategoryContainer* self, const gchar* filter) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS (self)->get_sql_all_with_filter (self, filter);
-+}
-+
-+
-+static gchar* rygel_lms_category_container_real_get_sql_count_with_filter (RygelLMSCategoryContainer* self, const gchar* filter) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (filter != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_count;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+gchar* rygel_lms_category_container_get_sql_count_with_filter (RygelLMSCategoryContainer* self, const gchar* filter) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS (self)->get_sql_count_with_filter (self, filter);
-+}
-+
-+
-+static gchar* rygel_lms_category_container_map_operand_to_column (const gchar* operand, gchar** collate, gboolean for_sort, GError** error) {
-+ gchar* _vala_collate = NULL;
-+ gchar* result = NULL;
-+ gchar* column = NULL;
-+ gboolean use_collation = FALSE;
-+ const gchar* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ GQuark _tmp3_ = 0U;
-+ static GQuark _tmp2_label0 = 0;
-+ static GQuark _tmp2_label1 = 0;
-+ static GQuark _tmp2_label2 = 0;
-+ gboolean _tmp11_ = FALSE;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (operand != NULL, NULL);
-+ column = NULL;
-+ use_collation = FALSE;
-+ _tmp0_ = operand;
-+ _tmp1_ = _tmp0_;
-+ _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
-+ if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("dc:title")))) {
-+ switch (0) {
-+ default:
-+ {
-+ gchar* _tmp4_ = NULL;
-+ _tmp4_ = g_strdup ("title");
-+ _g_free0 (column);
-+ column = _tmp4_;
-+ use_collation = TRUE;
-+ break;
-+ }
-+ }
-+ } else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("upnp:artist")))) {
-+ switch (0) {
-+ default:
-+ {
-+ gchar* _tmp5_ = NULL;
-+ _tmp5_ = g_strdup ("artist");
-+ _g_free0 (column);
-+ column = _tmp5_;
-+ use_collation = TRUE;
-+ break;
-+ }
-+ }
-+ } else if (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("dc:creator")))) {
-+ switch (0) {
-+ default:
-+ {
-+ gchar* _tmp6_ = NULL;
-+ _tmp6_ = g_strdup ("creator");
-+ _g_free0 (column);
-+ column = _tmp6_;
-+ use_collation = TRUE;
-+ break;
-+ }
-+ }
-+ } else {
-+ switch (0) {
-+ default:
-+ {
-+ gchar* message = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ gchar* _tmp8_ = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ GError* _tmp10_ = NULL;
-+ _tmp7_ = operand;
-+ _tmp8_ = g_strdup_printf ("Unsupported column %s", _tmp7_);
-+ message = _tmp8_;
-+ _tmp9_ = message;
-+ _tmp10_ = g_error_new_literal (RYGEL_LMS_CATEGORY_CONTAINER_ERROR, RYGEL_LMS_CATEGORY_CONTAINER_ERROR_UNSUPPORTED_SEARCH, _tmp9_);
-+ _inner_error_ = _tmp10_;
-+ g_propagate_error (error, _inner_error_);
-+ _g_free0 (message);
-+ _g_free0 (column);
-+ return NULL;
-+ }
-+ }
-+ }
-+ _tmp11_ = use_collation;
-+ if (_tmp11_) {
-+ gchar* _tmp12_ = NULL;
-+ _tmp12_ = g_strdup ("COLLATE CASEFOLD");
-+ _g_free0 (_vala_collate);
-+ _vala_collate = _tmp12_;
-+ } else {
-+ gchar* _tmp13_ = NULL;
-+ _tmp13_ = g_strdup ("");
-+ _g_free0 (_vala_collate);
-+ _vala_collate = _tmp13_;
-+ }
-+ result = column;
-+ if (collate) {
-+ *collate = _vala_collate;
-+ } else {
-+ _g_free0 (_vala_collate);
-+ }
-+ return result;
-+}
-+
-+
-+static void _vala_GValue_free (GValue* self) {
-+ g_value_unset (self);
-+ g_free (self);
-+}
-+
-+
-+static gchar* rygel_lms_category_container_relational_expression_to_sql (RygelRelationalExpression* exp, GValueArray* args, GError** error) {
-+ gchar* result = NULL;
-+ GValue* v = NULL;
-+ gchar* collate = NULL;
-+ gchar* column = NULL;
-+ RygelRelationalExpression* _tmp0_ = NULL;
-+ gconstpointer _tmp1_ = NULL;
-+ gchar* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ RygelLMSSqlOperator* operator = NULL;
-+ RygelRelationalExpression* _tmp4_ = NULL;
-+ gconstpointer _tmp5_ = NULL;
-+ GValue* _tmp40_ = NULL;
-+ RygelLMSSqlOperator* _tmp44_ = NULL;
-+ gchar* _tmp45_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (exp != NULL, NULL);
-+ g_return_val_if_fail (args != NULL, NULL);
-+ v = NULL;
-+ collate = NULL;
-+ _tmp0_ = exp;
-+ _tmp1_ = ((RygelSearchExpression*) _tmp0_)->operand1;
-+ _tmp3_ = rygel_lms_category_container_map_operand_to_column ((const gchar*) _tmp1_, &_tmp2_, FALSE, &_inner_error_);
-+ _g_free0 (collate);
-+ collate = _tmp2_;
-+ column = _tmp3_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_propagate_error (error, _inner_error_);
-+ _g_free0 (collate);
-+ __vala_GValue_free0 (v);
-+ return NULL;
-+ }
-+ _tmp4_ = exp;
-+ _tmp5_ = ((RygelSearchExpression*) _tmp4_)->op;
-+ switch ((GUPnPSearchCriteriaOp) ((gintptr) _tmp5_)) {
-+ case GUPNP_SEARCH_CRITERIA_OP_EXISTS:
-+ {
-+ gchar* sql_function = NULL;
-+ RygelRelationalExpression* _tmp6_ = NULL;
-+ gconstpointer _tmp7_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ const gchar* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ _tmp6_ = exp;
-+ _tmp7_ = ((RygelSearchExpression*) _tmp6_)->operand2;
-+ if (g_strcmp0 ((const gchar*) _tmp7_, "true") == 0) {
-+ gchar* _tmp8_ = NULL;
-+ _tmp8_ = g_strdup ("%s IS NOT NULL AND %s != ''");
-+ _g_free0 (sql_function);
-+ sql_function = _tmp8_;
-+ } else {
-+ gchar* _tmp9_ = NULL;
-+ _tmp9_ = g_strdup ("%s IS NULL OR %s = ''");
-+ _g_free0 (sql_function);
-+ sql_function = _tmp9_;
-+ }
-+ _tmp10_ = sql_function;
-+ _tmp11_ = column;
-+ _tmp12_ = column;
-+ _tmp13_ = g_strdup_printf (_tmp10_, _tmp11_, _tmp12_);
-+ result = _tmp13_;
-+ _g_free0 (sql_function);
-+ _g_object_unref0 (operator);
-+ _g_free0 (column);
-+ _g_free0 (collate);
-+ __vala_GValue_free0 (v);
-+ return result;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_EQ:
-+ case GUPNP_SEARCH_CRITERIA_OP_NEQ:
-+ case GUPNP_SEARCH_CRITERIA_OP_LESS:
-+ case GUPNP_SEARCH_CRITERIA_OP_LEQ:
-+ case GUPNP_SEARCH_CRITERIA_OP_GREATER:
-+ case GUPNP_SEARCH_CRITERIA_OP_GEQ:
-+ {
-+ RygelRelationalExpression* _tmp14_ = NULL;
-+ gconstpointer _tmp15_ = NULL;
-+ GValue* _tmp16_ = NULL;
-+ RygelRelationalExpression* _tmp17_ = NULL;
-+ gconstpointer _tmp18_ = NULL;
-+ const gchar* _tmp19_ = NULL;
-+ const gchar* _tmp20_ = NULL;
-+ RygelLMSSqlOperator* _tmp21_ = NULL;
-+ _tmp14_ = exp;
-+ _tmp15_ = ((RygelSearchExpression*) _tmp14_)->operand2;
-+ _tmp16_ = g_new0 (GValue, 1);
-+ g_value_init (_tmp16_, G_TYPE_STRING);
-+ g_value_set_string (_tmp16_, (const gchar*) _tmp15_);
-+ __vala_GValue_free0 (v);
-+ v = _tmp16_;
-+ _tmp17_ = exp;
-+ _tmp18_ = ((RygelSearchExpression*) _tmp17_)->op;
-+ _tmp19_ = column;
-+ _tmp20_ = collate;
-+ _tmp21_ = rygel_lms_sql_operator_new_from_search_criteria_op ((GUPnPSearchCriteriaOp) ((gintptr) _tmp18_), _tmp19_, _tmp20_);
-+ _g_object_unref0 (operator);
-+ operator = _tmp21_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_CONTAINS:
-+ {
-+ const gchar* _tmp22_ = NULL;
-+ RygelLMSSqlFunction* _tmp23_ = NULL;
-+ RygelRelationalExpression* _tmp24_ = NULL;
-+ gconstpointer _tmp25_ = NULL;
-+ GValue* _tmp26_ = NULL;
-+ _tmp22_ = column;
-+ _tmp23_ = rygel_lms_sql_function_new ("contains", _tmp22_);
-+ _g_object_unref0 (operator);
-+ operator = (RygelLMSSqlOperator*) _tmp23_;
-+ _tmp24_ = exp;
-+ _tmp25_ = ((RygelSearchExpression*) _tmp24_)->operand2;
-+ _tmp26_ = g_new0 (GValue, 1);
-+ g_value_init (_tmp26_, G_TYPE_STRING);
-+ g_value_set_string (_tmp26_, (const gchar*) _tmp25_);
-+ __vala_GValue_free0 (v);
-+ v = _tmp26_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_DOES_NOT_CONTAIN:
-+ {
-+ const gchar* _tmp27_ = NULL;
-+ RygelLMSSqlFunction* _tmp28_ = NULL;
-+ RygelRelationalExpression* _tmp29_ = NULL;
-+ gconstpointer _tmp30_ = NULL;
-+ GValue* _tmp31_ = NULL;
-+ _tmp27_ = column;
-+ _tmp28_ = rygel_lms_sql_function_new ("NOT contains", _tmp27_);
-+ _g_object_unref0 (operator);
-+ operator = (RygelLMSSqlOperator*) _tmp28_;
-+ _tmp29_ = exp;
-+ _tmp30_ = ((RygelSearchExpression*) _tmp29_)->operand2;
-+ _tmp31_ = g_new0 (GValue, 1);
-+ g_value_init (_tmp31_, G_TYPE_STRING);
-+ g_value_set_string (_tmp31_, (const gchar*) _tmp30_);
-+ __vala_GValue_free0 (v);
-+ v = _tmp31_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_DERIVED_FROM:
-+ {
-+ const gchar* _tmp32_ = NULL;
-+ RygelLMSSqlOperator* _tmp33_ = NULL;
-+ RygelRelationalExpression* _tmp34_ = NULL;
-+ gconstpointer _tmp35_ = NULL;
-+ gchar* _tmp36_ = NULL;
-+ GValue* _tmp37_ = NULL;
-+ _tmp32_ = column;
-+ _tmp33_ = rygel_lms_sql_operator_new ("LIKE", _tmp32_, "");
-+ _g_object_unref0 (operator);
-+ operator = _tmp33_;
-+ _tmp34_ = exp;
-+ _tmp35_ = ((RygelSearchExpression*) _tmp34_)->operand2;
-+ _tmp36_ = g_strdup_printf ("%s%%", (const gchar*) _tmp35_);
-+ _tmp37_ = g_new0 (GValue, 1);
-+ g_value_init (_tmp37_, G_TYPE_STRING);
-+ g_value_take_string (_tmp37_, _tmp36_);
-+ __vala_GValue_free0 (v);
-+ v = _tmp37_;
-+ break;
-+ }
-+ default:
-+ {
-+ RygelRelationalExpression* _tmp38_ = NULL;
-+ gconstpointer _tmp39_ = NULL;
-+ _tmp38_ = exp;
-+ _tmp39_ = ((RygelSearchExpression*) _tmp38_)->op;
-+ g_warning ("rygel-lms-category-container.vala:148: Unsupported op %d", (gint) ((GUPnPSearchCriteriaOp) ((gintptr) _tmp39_)));
-+ result = NULL;
-+ _g_object_unref0 (operator);
-+ _g_free0 (column);
-+ _g_free0 (collate);
-+ __vala_GValue_free0 (v);
-+ return result;
-+ }
-+ }
-+ _tmp40_ = v;
-+ if (_tmp40_ != NULL) {
-+ GValueArray* _tmp41_ = NULL;
-+ GValue* _tmp42_ = NULL;
-+ GValue _tmp43_ = {0};
-+ _tmp41_ = args;
-+ _tmp42_ = v;
-+ _tmp43_ = *_tmp42_;
-+ g_value_array_append (_tmp41_, &_tmp43_);
-+ }
-+ _tmp44_ = operator;
-+ _tmp45_ = rygel_lms_sql_operator_to_string (_tmp44_);
-+ result = _tmp45_;
-+ _g_object_unref0 (operator);
-+ _g_free0 (column);
-+ _g_free0 (collate);
-+ __vala_GValue_free0 (v);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_category_container_logical_expression_to_sql (RygelLogicalExpression* expression, GValueArray* args, GError** error) {
-+ gchar* result = NULL;
-+ gchar* left_sql_string = NULL;
-+ RygelLogicalExpression* _tmp0_ = NULL;
-+ gconstpointer _tmp1_ = NULL;
-+ GValueArray* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ gchar* right_sql_string = NULL;
-+ RygelLogicalExpression* _tmp4_ = NULL;
-+ gconstpointer _tmp5_ = NULL;
-+ GValueArray* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ const gchar* operator_sql_string = NULL;
-+ RygelLogicalExpression* _tmp8_ = NULL;
-+ gconstpointer _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ const gchar* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (expression != NULL, NULL);
-+ g_return_val_if_fail (args != NULL, NULL);
-+ _tmp0_ = expression;
-+ _tmp1_ = ((RygelSearchExpression*) _tmp0_)->operand1;
-+ _tmp2_ = args;
-+ _tmp3_ = rygel_lms_category_container_search_expression_to_sql ((RygelSearchExpression*) _tmp1_, _tmp2_, &_inner_error_);
-+ left_sql_string = _tmp3_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_propagate_error (error, _inner_error_);
-+ return NULL;
-+ }
-+ _tmp4_ = expression;
-+ _tmp5_ = ((RygelSearchExpression*) _tmp4_)->operand2;
-+ _tmp6_ = args;
-+ _tmp7_ = rygel_lms_category_container_search_expression_to_sql ((RygelSearchExpression*) _tmp5_, _tmp6_, &_inner_error_);
-+ right_sql_string = _tmp7_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_propagate_error (error, _inner_error_);
-+ _g_free0 (left_sql_string);
-+ return NULL;
-+ }
-+ operator_sql_string = "OR";
-+ _tmp8_ = expression;
-+ _tmp9_ = ((RygelSearchExpression*) _tmp8_)->op;
-+ if (((RygelLogicalOperator) ((gintptr) _tmp9_)) == RYGEL_LOGICAL_OPERATOR_AND) {
-+ operator_sql_string = "AND";
-+ }
-+ _tmp10_ = left_sql_string;
-+ _tmp11_ = operator_sql_string;
-+ _tmp12_ = right_sql_string;
-+ _tmp13_ = g_strdup_printf ("(%s %s %s)", _tmp10_, _tmp11_, _tmp12_);
-+ result = _tmp13_;
-+ _g_free0 (right_sql_string);
-+ _g_free0 (left_sql_string);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_category_container_search_expression_to_sql (RygelSearchExpression* expression, GValueArray* args, GError** error) {
-+ gchar* result = NULL;
-+ RygelSearchExpression* _tmp0_ = NULL;
-+ RygelSearchExpression* _tmp2_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (args != NULL, NULL);
-+ _tmp0_ = expression;
-+ if (_tmp0_ == NULL) {
-+ gchar* _tmp1_ = NULL;
-+ _tmp1_ = g_strdup ("");
-+ result = _tmp1_;
-+ return result;
-+ }
-+ _tmp2_ = expression;
-+ if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, RYGEL_TYPE_LOGICAL_EXPRESSION)) {
-+ gchar* _tmp3_ = NULL;
-+ RygelSearchExpression* _tmp4_ = NULL;
-+ GValueArray* _tmp5_ = NULL;
-+ gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ _tmp4_ = expression;
-+ _tmp5_ = args;
-+ _tmp6_ = rygel_lms_category_container_logical_expression_to_sql (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, RYGEL_TYPE_LOGICAL_EXPRESSION) ? ((RygelLogicalExpression*) _tmp4_) : NULL, _tmp5_, &_inner_error_);
-+ _tmp3_ = _tmp6_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_propagate_error (error, _inner_error_);
-+ return NULL;
-+ }
-+ _tmp7_ = _tmp3_;
-+ _tmp3_ = NULL;
-+ result = _tmp7_;
-+ _g_free0 (_tmp3_);
-+ return result;
-+ } else {
-+ gchar* _tmp8_ = NULL;
-+ RygelSearchExpression* _tmp9_ = NULL;
-+ GValueArray* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ _tmp9_ = expression;
-+ _tmp10_ = args;
-+ _tmp11_ = rygel_lms_category_container_relational_expression_to_sql (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, RYGEL_TYPE_RELATIONAL_EXPRESSION) ? ((RygelRelationalExpression*) _tmp9_) : NULL, _tmp10_, &_inner_error_);
-+ _tmp8_ = _tmp11_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_propagate_error (error, _inner_error_);
-+ return NULL;
-+ }
-+ _tmp12_ = _tmp8_;
-+ _tmp8_ = NULL;
-+ result = _tmp12_;
-+ _g_free0 (_tmp8_);
-+ return result;
-+ }
-+}
-+
-+
-+static guint rygel_lms_category_container_real_get_child_count_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args) {
-+ guint result = 0U;
-+ gchar* query = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (where_filter != NULL, 0U);
-+ g_return_val_if_fail (args != NULL, 0U);
-+ _tmp0_ = where_filter;
-+ _tmp1_ = rygel_lms_category_container_get_sql_count_with_filter (self, _tmp0_);
-+ query = _tmp1_;
-+ {
-+ sqlite3_stmt* stmt = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ GValueArray* _tmp4_ = NULL;
-+ GValue* _tmp5_ = NULL;
-+ gint _tmp5__length1 = 0;
-+ sqlite3_stmt* _tmp6_ = NULL;
-+ sqlite3_stmt* _tmp7_ = NULL;
-+ gint _tmp8_ = 0;
-+ sqlite3_stmt* _tmp9_ = NULL;
-+ gint _tmp10_ = 0;
-+ _tmp2_ = self->priv->_lms_db;
-+ _tmp3_ = query;
-+ _tmp4_ = args;
-+ _tmp5_ = _tmp4_->values;
-+ _tmp5__length1 = (gint) _tmp4_->n_values;
-+ _tmp6_ = rygel_lms_database_prepare_and_init (_tmp2_, _tmp3_, _tmp5_, _tmp5__length1, &_inner_error_);
-+ stmt = _tmp6_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch2_rygel_lms_database_error;
-+ }
-+ _g_free0 (query);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return 0U;
-+ }
-+ _tmp7_ = stmt;
-+ _tmp8_ = sqlite3_step (_tmp7_);
-+ if (_tmp8_ != SQLITE_ROW) {
-+ result = (guint) 0;
-+ _sqlite3_finalize0 (stmt);
-+ _g_free0 (query);
-+ return result;
-+ }
-+ _tmp9_ = stmt;
-+ _tmp10_ = sqlite3_column_int (_tmp9_, 0);
-+ result = (guint) _tmp10_;
-+ _sqlite3_finalize0 (stmt);
-+ _g_free0 (query);
-+ return result;
-+ }
-+ goto __finally2;
-+ __catch2_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp11_ = e;
-+ _tmp12_ = _tmp11_->message;
-+ g_warning ("rygel-lms-category-container.vala:209: Query failed: %s", _tmp12_);
-+ result = (guint) 0;
-+ _g_error_free0 (e);
-+ _g_free0 (query);
-+ return result;
-+ }
-+ __finally2:
-+ _g_free0 (query);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return 0U;
-+}
-+
-+
-+guint rygel_lms_category_container_get_child_count_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args) {
-+ g_return_val_if_fail (self != NULL, 0U);
-+ return RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS (self)->get_child_count_with_filter (self, where_filter, args);
-+}
-+
-+
-+static RygelMediaObjects* rygel_lms_category_container_real_get_children_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count) {
-+ RygelMediaObjects* result = NULL;
-+ RygelMediaObjects* children = NULL;
-+ RygelMediaObjects* _tmp0_ = NULL;
-+ GValue v = {0};
-+ guint _tmp1_ = 0U;
-+ GValue _tmp2_ = {0};
-+ GValueArray* _tmp3_ = NULL;
-+ GValue _tmp4_ = {0};
-+ guint _tmp5_ = 0U;
-+ GValue _tmp6_ = {0};
-+ GValueArray* _tmp7_ = NULL;
-+ GValue _tmp8_ = {0};
-+ gchar* query = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* _tmp10_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (where_filter != NULL, NULL);
-+ g_return_val_if_fail (args != NULL, NULL);
-+ g_return_val_if_fail (sort_criteria != NULL, NULL);
-+ _tmp0_ = rygel_media_objects_new ();
-+ children = _tmp0_;
-+ _tmp1_ = max_count;
-+ g_value_init (&_tmp2_, G_TYPE_UINT);
-+ g_value_set_uint (&_tmp2_, _tmp1_);
-+ v = _tmp2_;
-+ _tmp3_ = args;
-+ _tmp4_ = v;
-+ g_value_array_append (_tmp3_, &_tmp4_);
-+ _tmp5_ = offset;
-+ g_value_init (&_tmp6_, G_TYPE_UINT);
-+ g_value_set_uint (&_tmp6_, _tmp5_);
-+ G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
-+ v = _tmp6_;
-+ _tmp7_ = args;
-+ _tmp8_ = v;
-+ g_value_array_append (_tmp7_, &_tmp8_);
-+ _tmp9_ = where_filter;
-+ _tmp10_ = rygel_lms_category_container_get_sql_all_with_filter (self, _tmp9_);
-+ query = _tmp10_;
-+ {
-+ sqlite3_stmt* stmt = NULL;
-+ RygelLMSDatabase* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ GValueArray* _tmp13_ = NULL;
-+ GValue* _tmp14_ = NULL;
-+ gint _tmp14__length1 = 0;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ _tmp11_ = self->priv->_lms_db;
-+ _tmp12_ = query;
-+ _tmp13_ = args;
-+ _tmp14_ = _tmp13_->values;
-+ _tmp14__length1 = (gint) _tmp13_->n_values;
-+ _tmp15_ = rygel_lms_database_prepare_and_init (_tmp11_, _tmp12_, _tmp14_, _tmp14__length1, &_inner_error_);
-+ stmt = _tmp15_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch3_rygel_lms_database_error;
-+ }
-+ _g_free0 (query);
-+ G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ while (TRUE) {
-+ gboolean _tmp16_ = FALSE;
-+ sqlite3_stmt* _tmp17_ = NULL;
-+ gboolean _tmp18_ = FALSE;
-+ RygelMediaObjects* _tmp19_ = NULL;
-+ sqlite3_stmt* _tmp20_ = NULL;
-+ RygelMediaObject* _tmp21_ = NULL;
-+ RygelMediaObject* _tmp22_ = NULL;
-+ _tmp17_ = stmt;
-+ _tmp18_ = rygel_lms_database_get_children_step (_tmp17_, &_inner_error_);
-+ _tmp16_ = _tmp18_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch3_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ _g_free0 (query);
-+ G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ if (!_tmp16_) {
-+ break;
-+ }
-+ _tmp19_ = children;
-+ _tmp20_ = stmt;
-+ _tmp21_ = rygel_lms_category_container_object_from_statement (self, _tmp20_);
-+ _tmp22_ = _tmp21_;
-+ gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp22_);
-+ _g_object_unref0 (_tmp22_);
-+ }
-+ _sqlite3_finalize0 (stmt);
-+ }
-+ goto __finally3;
-+ __catch3_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp23_ = NULL;
-+ const gchar* _tmp24_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp23_ = e;
-+ _tmp24_ = _tmp23_->message;
-+ g_warning ("rygel-lms-category-container.vala:232: Query failed: %s", _tmp24_);
-+ _g_error_free0 (e);
-+ }
-+ __finally3:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (query);
-+ G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
-+ _g_object_unref0 (children);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ result = children;
-+ _g_free0 (query);
-+ G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
-+ return result;
-+}
-+
-+
-+RygelMediaObjects* rygel_lms_category_container_get_children_with_filter (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS (self)->get_children_with_filter (self, where_filter, args, sort_criteria, offset, max_count);
-+}
-+
-+
-+static void rygel_lms_category_container_real_search_data_free (gpointer _data) {
-+ RygelLmsCategoryContainerSearchData* _data_;
-+ _data_ = _data;
-+ _rygel_search_expression_unref0 (_data_->expression);
-+ _g_free0 (_data_->sort_criteria);
-+ _g_object_unref0 (_data_->cancellable);
-+ _g_object_unref0 (_data_->result);
-+ _g_object_unref0 (_data_->self);
-+ g_slice_free (RygelLmsCategoryContainerSearchData, _data_);
-+}
-+
-+
-+static gpointer _g_object_ref0 (gpointer self) {
-+ return self ? g_object_ref (self) : NULL;
-+}
-+
-+
-+static gpointer _rygel_search_expression_ref0 (gpointer self) {
-+ return self ? rygel_search_expression_ref (self) : NULL;
-+}
-+
-+
-+static void rygel_lms_category_container_real_search (RygelSearchableContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-+ RygelLMSCategoryContainer * self;
-+ RygelLmsCategoryContainerSearchData* _data_;
-+ RygelLMSCategoryContainer* _tmp0_ = NULL;
-+ RygelSearchExpression* _tmp1_ = NULL;
-+ RygelSearchExpression* _tmp2_ = NULL;
-+ guint _tmp3_ = 0U;
-+ guint _tmp4_ = 0U;
-+ const gchar* _tmp5_ = NULL;
-+ gchar* _tmp6_ = NULL;
-+ GCancellable* _tmp7_ = NULL;
-+ GCancellable* _tmp8_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _data_ = g_slice_new0 (RygelLmsCategoryContainerSearchData);
-+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_lms_category_container_real_search);
-+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_lms_category_container_real_search_data_free);
-+ _tmp0_ = _g_object_ref0 (self);
-+ _data_->self = _tmp0_;
-+ _tmp1_ = expression;
-+ _tmp2_ = _rygel_search_expression_ref0 (_tmp1_);
-+ _rygel_search_expression_unref0 (_data_->expression);
-+ _data_->expression = _tmp2_;
-+ _tmp3_ = offset;
-+ _data_->offset = _tmp3_;
-+ _tmp4_ = max_count;
-+ _data_->max_count = _tmp4_;
-+ _tmp5_ = sort_criteria;
-+ _tmp6_ = g_strdup (_tmp5_);
-+ _g_free0 (_data_->sort_criteria);
-+ _data_->sort_criteria = _tmp6_;
-+ _tmp7_ = cancellable;
-+ _tmp8_ = _g_object_ref0 (_tmp7_);
-+ _g_object_unref0 (_data_->cancellable);
-+ _data_->cancellable = _tmp8_;
-+ rygel_lms_category_container_real_search_co (_data_);
-+}
-+
-+
-+static RygelMediaObjects* rygel_lms_category_container_real_search_finish (RygelSearchableContainer* base, GAsyncResult* _res_, guint* total_matches, GError** error) {
-+ RygelMediaObjects* result;
-+ RygelLmsCategoryContainerSearchData* _data_;
-+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-+ return NULL;
-+ }
-+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-+ if (total_matches) {
-+ *total_matches = _data_->total_matches;
-+ }
-+ result = _data_->result;
-+ _data_->result = NULL;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
-+ RygelLmsCategoryContainerSearchData* _data_;
-+ _data_ = _user_data_;
-+ _data_->_source_object_ = source_object;
-+ _data_->_res_ = _res_;
-+ rygel_lms_category_container_real_search_co (_data_);
-+}
-+
-+
-+static gboolean rygel_lms_category_container_real_search_co (RygelLmsCategoryContainerSearchData* _data_) {
-+ switch (_data_->_state_) {
-+ case 0:
-+ goto _state_0;
-+ case 1:
-+ goto _state_1;
-+ default:
-+ g_assert_not_reached ();
-+ }
-+ _state_0:
-+ g_debug ("rygel-lms-category-container.vala:245: search()");
-+ {
-+ _data_->_tmp0_ = NULL;
-+ _data_->_tmp0_ = g_value_array_new ((guint) 0);
-+ _data_->args = _data_->_tmp0_;
-+ _data_->_tmp1_ = NULL;
-+ _data_->_tmp1_ = _data_->expression;
-+ _data_->_tmp2_ = NULL;
-+ _data_->_tmp2_ = _data_->args;
-+ _data_->_tmp3_ = NULL;
-+ _data_->_tmp3_ = rygel_lms_category_container_search_expression_to_sql (_data_->_tmp1_, _data_->_tmp2_, &_data_->_inner_error_);
-+ _data_->filter = _data_->_tmp3_;
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ _g_value_array_free0 (_data_->args);
-+ goto __catch4_g_error;
-+ }
-+ _data_->_tmp4_ = NULL;
-+ _data_->_tmp4_ = _data_->filter;
-+ _data_->_tmp5_ = NULL;
-+ _data_->_tmp5_ = _data_->args;
-+ _data_->_tmp6_ = 0U;
-+ _data_->_tmp6_ = rygel_lms_category_container_get_child_count_with_filter (_data_->self, _data_->_tmp4_, _data_->_tmp5_);
-+ _data_->total_matches = _data_->_tmp6_;
-+ _data_->_tmp7_ = NULL;
-+ _data_->_tmp7_ = _data_->expression;
-+ if (_data_->_tmp7_ != NULL) {
-+ _data_->_tmp8_ = NULL;
-+ _data_->_tmp8_ = _data_->expression;
-+ _data_->_tmp9_ = NULL;
-+ _data_->_tmp9_ = rygel_search_expression_to_string (_data_->_tmp8_);
-+ _data_->_tmp10_ = NULL;
-+ _data_->_tmp10_ = _data_->_tmp9_;
-+ g_debug ("rygel-lms-category-container.vala:253: Original search: %s", _data_->_tmp10_);
-+ _g_free0 (_data_->_tmp10_);
-+ _data_->_tmp11_ = NULL;
-+ _data_->_tmp11_ = _data_->filter;
-+ g_debug ("rygel-lms-category-container.vala:254: Parsed search expression: %s", _data_->_tmp11_);
-+ _data_->_tmp12_ = 0U;
-+ _data_->_tmp12_ = _data_->total_matches;
-+ g_debug ("rygel-lms-category-container.vala:255: Filtered cild count is %u", _data_->_tmp12_);
-+ }
-+ _data_->_tmp13_ = 0U;
-+ _data_->_tmp13_ = _data_->max_count;
-+ if (_data_->_tmp13_ == ((guint) 0)) {
-+ _data_->max_count = G_MAXUINT;
-+ }
-+ _data_->_tmp14_ = NULL;
-+ _data_->_tmp14_ = _data_->filter;
-+ _data_->_tmp15_ = NULL;
-+ _data_->_tmp15_ = _data_->args;
-+ _data_->_tmp16_ = NULL;
-+ _data_->_tmp16_ = _data_->sort_criteria;
-+ _data_->_tmp17_ = 0U;
-+ _data_->_tmp17_ = _data_->offset;
-+ _data_->_tmp18_ = 0U;
-+ _data_->_tmp18_ = _data_->max_count;
-+ _data_->_tmp19_ = NULL;
-+ _data_->_tmp19_ = rygel_lms_category_container_get_children_with_filter (_data_->self, _data_->_tmp14_, _data_->_tmp15_, _data_->_tmp16_, _data_->_tmp17_, _data_->_tmp18_);
-+ _data_->result = _data_->_tmp19_;
-+ _g_free0 (_data_->filter);
-+ _g_value_array_free0 (_data_->args);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ goto __finally4;
-+ __catch4_g_error:
-+ {
-+ _data_->e = _data_->_inner_error_;
-+ _data_->_inner_error_ = NULL;
-+ _data_->_tmp20_ = NULL;
-+ _data_->_tmp20_ = _data_->e;
-+ _data_->_tmp21_ = NULL;
-+ _data_->_tmp21_ = _data_->_tmp20_->message;
-+ g_debug ("rygel-lms-category-container.vala:267: Falling back to simple_search" \
-+"(): %s", _data_->_tmp21_);
-+ _data_->_tmp23_ = NULL;
-+ _data_->_tmp23_ = _data_->expression;
-+ _data_->_tmp24_ = 0U;
-+ _data_->_tmp24_ = _data_->offset;
-+ _data_->_tmp25_ = 0U;
-+ _data_->_tmp25_ = _data_->max_count;
-+ _data_->_tmp26_ = NULL;
-+ _data_->_tmp26_ = _data_->sort_criteria;
-+ _data_->_tmp27_ = NULL;
-+ _data_->_tmp27_ = _data_->cancellable;
-+ _data_->_tmp28_ = 0U;
-+ _data_->_state_ = 1;
-+ rygel_searchable_container_simple_search ((RygelSearchableContainer*) _data_->self, _data_->_tmp23_, _data_->_tmp24_, _data_->_tmp25_, _data_->_tmp26_, _data_->_tmp27_, rygel_lms_category_container_search_ready, _data_);
-+ return FALSE;
-+ _state_1:
-+ _data_->_tmp29_ = NULL;
-+ _data_->_tmp29_ = rygel_searchable_container_simple_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp28_, &_data_->_inner_error_);
-+ _data_->total_matches = _data_->_tmp28_;
-+ _data_->_tmp22_ = _data_->_tmp29_;
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ _g_error_free0 (_data_->e);
-+ goto __finally4;
-+ }
-+ _data_->_tmp30_ = NULL;
-+ _data_->_tmp30_ = _data_->_tmp22_;
-+ _data_->_tmp22_ = NULL;
-+ _data_->result = _data_->_tmp30_;
-+ _g_object_unref0 (_data_->_tmp22_);
-+ _g_error_free0 (_data_->e);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ __finally4:
-+ g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-+ g_error_free (_data_->_inner_error_);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+}
-+
-+
-+static void rygel_lms_category_container_real_get_children_data_free (gpointer _data) {
-+ RygelLmsCategoryContainerGetChildrenData* _data_;
-+ _data_ = _data;
-+ _g_free0 (_data_->sort_criteria);
-+ _g_object_unref0 (_data_->cancellable);
-+ _g_object_unref0 (_data_->result);
-+ _g_object_unref0 (_data_->self);
-+ g_slice_free (RygelLmsCategoryContainerGetChildrenData, _data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-+ RygelLMSCategoryContainer * self;
-+ RygelLmsCategoryContainerGetChildrenData* _data_;
-+ RygelLMSCategoryContainer* _tmp0_ = NULL;
-+ guint _tmp1_ = 0U;
-+ guint _tmp2_ = 0U;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ GCancellable* _tmp5_ = NULL;
-+ GCancellable* _tmp6_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _data_ = g_slice_new0 (RygelLmsCategoryContainerGetChildrenData);
-+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_lms_category_container_real_get_children);
-+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_lms_category_container_real_get_children_data_free);
-+ _tmp0_ = _g_object_ref0 (self);
-+ _data_->self = _tmp0_;
-+ _tmp1_ = offset;
-+ _data_->offset = _tmp1_;
-+ _tmp2_ = max_count;
-+ _data_->max_count = _tmp2_;
-+ _tmp3_ = sort_criteria;
-+ _tmp4_ = g_strdup (_tmp3_);
-+ _g_free0 (_data_->sort_criteria);
-+ _data_->sort_criteria = _tmp4_;
-+ _tmp5_ = cancellable;
-+ _tmp6_ = _g_object_ref0 (_tmp5_);
-+ _g_object_unref0 (_data_->cancellable);
-+ _data_->cancellable = _tmp6_;
-+ rygel_lms_category_container_real_get_children_co (_data_);
-+}
-+
-+
-+static RygelMediaObjects* rygel_lms_category_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
-+ RygelMediaObjects* result;
-+ RygelLmsCategoryContainerGetChildrenData* _data_;
-+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-+ return NULL;
-+ }
-+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-+ result = _data_->result;
-+ _data_->result = NULL;
-+ return result;
-+}
-+
-+
-+static gboolean rygel_lms_category_container_real_get_children_co (RygelLmsCategoryContainerGetChildrenData* _data_) {
-+ switch (_data_->_state_) {
-+ case 0:
-+ goto _state_0;
-+ default:
-+ g_assert_not_reached ();
-+ }
-+ _state_0:
-+ _data_->_tmp0_ = NULL;
-+ _data_->_tmp0_ = rygel_media_objects_new ();
-+ _data_->retval = _data_->_tmp0_;
-+ _data_->_tmp1_ = NULL;
-+ _data_->_tmp1_ = _data_->self->stmt_all;
-+ _data_->_tmp2_ = 0U;
-+ _data_->_tmp2_ = _data_->offset;
-+ _data_->_tmp3_ = 0U;
-+ _data_->_tmp3_ = _data_->max_count;
-+ _data_->_tmp4_ = NULL;
-+ _data_->_tmp4_ = _data_->sort_criteria;
-+ rygel_lms_database_get_children_init (_data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, &_data_->_inner_error_);
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-+ g_error_free (_data_->_inner_error_);
-+ _g_object_unref0 (_data_->retval);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ while (TRUE) {
-+ _data_->_tmp6_ = NULL;
-+ _data_->_tmp6_ = _data_->self->stmt_all;
-+ _data_->_tmp7_ = FALSE;
-+ _data_->_tmp7_ = rygel_lms_database_get_children_step (_data_->_tmp6_, &_data_->_inner_error_);
-+ _data_->_tmp5_ = _data_->_tmp7_;
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-+ g_error_free (_data_->_inner_error_);
-+ _g_object_unref0 (_data_->retval);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ if (!_data_->_tmp5_) {
-+ break;
-+ }
-+ _data_->_tmp8_ = NULL;
-+ _data_->_tmp8_ = _data_->retval;
-+ _data_->_tmp9_ = NULL;
-+ _data_->_tmp9_ = _data_->self->stmt_all;
-+ _data_->_tmp10_ = NULL;
-+ _data_->_tmp10_ = rygel_lms_category_container_object_from_statement (_data_->self, _data_->_tmp9_);
-+ _data_->_tmp11_ = NULL;
-+ _data_->_tmp11_ = _data_->_tmp10_;
-+ gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp8_, _data_->_tmp11_);
-+ _g_object_unref0 (_data_->_tmp11_);
-+ }
-+ _data_->result = _data_->retval;
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ _g_object_unref0 (_data_->retval);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+}
-+
-+
-+static void rygel_lms_category_container_real_find_object_data_free (gpointer _data) {
-+ RygelLmsCategoryContainerFindObjectData* _data_;
-+ _data_ = _data;
-+ _g_free0 (_data_->id);
-+ _g_object_unref0 (_data_->cancellable);
-+ _g_object_unref0 (_data_->result);
-+ _g_object_unref0 (_data_->self);
-+ g_slice_free (RygelLmsCategoryContainerFindObjectData, _data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-+ RygelLMSCategoryContainer * self;
-+ RygelLmsCategoryContainerFindObjectData* _data_;
-+ RygelLMSCategoryContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ gchar* _tmp2_ = NULL;
-+ GCancellable* _tmp3_ = NULL;
-+ GCancellable* _tmp4_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _data_ = g_slice_new0 (RygelLmsCategoryContainerFindObjectData);
-+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_lms_category_container_real_find_object);
-+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_lms_category_container_real_find_object_data_free);
-+ _tmp0_ = _g_object_ref0 (self);
-+ _data_->self = _tmp0_;
-+ _tmp1_ = id;
-+ _tmp2_ = g_strdup (_tmp1_);
-+ _g_free0 (_data_->id);
-+ _data_->id = _tmp2_;
-+ _tmp3_ = cancellable;
-+ _tmp4_ = _g_object_ref0 (_tmp3_);
-+ _g_object_unref0 (_data_->cancellable);
-+ _data_->cancellable = _tmp4_;
-+ rygel_lms_category_container_real_find_object_co (_data_);
-+}
-+
-+
-+static RygelMediaObject* rygel_lms_category_container_real_find_object_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
-+ RygelMediaObject* result;
-+ RygelLmsCategoryContainerFindObjectData* _data_;
-+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-+ return NULL;
-+ }
-+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-+ result = _data_->result;
-+ _data_->result = NULL;
-+ return result;
-+}
-+
-+
-+static glong string_strnlen (gchar* str, glong maxlen) {
-+ glong result = 0L;
-+ gchar* end = NULL;
-+ gchar* _tmp0_ = NULL;
-+ glong _tmp1_ = 0L;
-+ gchar* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ _tmp0_ = str;
-+ _tmp1_ = maxlen;
-+ _tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
-+ end = _tmp2_;
-+ _tmp3_ = end;
-+ if (_tmp3_ == NULL) {
-+ glong _tmp4_ = 0L;
-+ _tmp4_ = maxlen;
-+ result = _tmp4_;
-+ return result;
-+ } else {
-+ gchar* _tmp5_ = NULL;
-+ gchar* _tmp6_ = NULL;
-+ _tmp5_ = end;
-+ _tmp6_ = str;
-+ result = (glong) (_tmp5_ - _tmp6_);
-+ return result;
-+ }
-+}
-+
-+
-+static gchar* string_substring (const gchar* self, glong offset, glong len) {
-+ gchar* result = NULL;
-+ glong string_length = 0L;
-+ gboolean _tmp0_ = FALSE;
-+ glong _tmp1_ = 0L;
-+ glong _tmp8_ = 0L;
-+ glong _tmp14_ = 0L;
-+ glong _tmp17_ = 0L;
-+ glong _tmp18_ = 0L;
-+ glong _tmp19_ = 0L;
-+ glong _tmp20_ = 0L;
-+ glong _tmp21_ = 0L;
-+ gchar* _tmp22_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp1_ = offset;
-+ if (_tmp1_ >= ((glong) 0)) {
-+ glong _tmp2_ = 0L;
-+ _tmp2_ = len;
-+ _tmp0_ = _tmp2_ >= ((glong) 0);
-+ } else {
-+ _tmp0_ = FALSE;
-+ }
-+ if (_tmp0_) {
-+ glong _tmp3_ = 0L;
-+ glong _tmp4_ = 0L;
-+ glong _tmp5_ = 0L;
-+ _tmp3_ = offset;
-+ _tmp4_ = len;
-+ _tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
-+ string_length = _tmp5_;
-+ } else {
-+ gint _tmp6_ = 0;
-+ gint _tmp7_ = 0;
-+ _tmp6_ = strlen (self);
-+ _tmp7_ = _tmp6_;
-+ string_length = (glong) _tmp7_;
-+ }
-+ _tmp8_ = offset;
-+ if (_tmp8_ < ((glong) 0)) {
-+ glong _tmp9_ = 0L;
-+ glong _tmp10_ = 0L;
-+ glong _tmp11_ = 0L;
-+ _tmp9_ = string_length;
-+ _tmp10_ = offset;
-+ offset = _tmp9_ + _tmp10_;
-+ _tmp11_ = offset;
-+ g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
-+ } else {
-+ glong _tmp12_ = 0L;
-+ glong _tmp13_ = 0L;
-+ _tmp12_ = offset;
-+ _tmp13_ = string_length;
-+ g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
-+ }
-+ _tmp14_ = len;
-+ if (_tmp14_ < ((glong) 0)) {
-+ glong _tmp15_ = 0L;
-+ glong _tmp16_ = 0L;
-+ _tmp15_ = string_length;
-+ _tmp16_ = offset;
-+ len = _tmp15_ - _tmp16_;
-+ }
-+ _tmp17_ = offset;
-+ _tmp18_ = len;
-+ _tmp19_ = string_length;
-+ g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
-+ _tmp20_ = offset;
-+ _tmp21_ = len;
-+ _tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
-+ result = _tmp22_;
-+ return result;
-+}
-+
-+
-+static gint string_index_of_char (const gchar* self, gunichar c, gint start_index) {
-+ gint result = 0;
-+ gchar* _result_ = NULL;
-+ gint _tmp0_ = 0;
-+ gunichar _tmp1_ = 0U;
-+ gchar* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ g_return_val_if_fail (self != NULL, 0);
-+ _tmp0_ = start_index;
-+ _tmp1_ = c;
-+ _tmp2_ = g_utf8_strchr (((gchar*) self) + _tmp0_, (gssize) (-1), _tmp1_);
-+ _result_ = _tmp2_;
-+ _tmp3_ = _result_;
-+ if (_tmp3_ != NULL) {
-+ gchar* _tmp4_ = NULL;
-+ _tmp4_ = _result_;
-+ result = (gint) (_tmp4_ - ((gchar*) self));
-+ return result;
-+ } else {
-+ result = -1;
-+ return result;
-+ }
-+}
-+
-+
-+static gchar* string_slice (const gchar* self, glong start, glong end) {
-+ gchar* result = NULL;
-+ glong string_length = 0L;
-+ gint _tmp0_ = 0;
-+ gint _tmp1_ = 0;
-+ glong _tmp2_ = 0L;
-+ glong _tmp5_ = 0L;
-+ gboolean _tmp8_ = FALSE;
-+ glong _tmp9_ = 0L;
-+ gboolean _tmp12_ = FALSE;
-+ glong _tmp13_ = 0L;
-+ glong _tmp16_ = 0L;
-+ glong _tmp17_ = 0L;
-+ glong _tmp18_ = 0L;
-+ glong _tmp19_ = 0L;
-+ glong _tmp20_ = 0L;
-+ gchar* _tmp21_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = strlen (self);
-+ _tmp1_ = _tmp0_;
-+ string_length = (glong) _tmp1_;
-+ _tmp2_ = start;
-+ if (_tmp2_ < ((glong) 0)) {
-+ glong _tmp3_ = 0L;
-+ glong _tmp4_ = 0L;
-+ _tmp3_ = string_length;
-+ _tmp4_ = start;
-+ start = _tmp3_ + _tmp4_;
-+ }
-+ _tmp5_ = end;
-+ if (_tmp5_ < ((glong) 0)) {
-+ glong _tmp6_ = 0L;
-+ glong _tmp7_ = 0L;
-+ _tmp6_ = string_length;
-+ _tmp7_ = end;
-+ end = _tmp6_ + _tmp7_;
-+ }
-+ _tmp9_ = start;
-+ if (_tmp9_ >= ((glong) 0)) {
-+ glong _tmp10_ = 0L;
-+ glong _tmp11_ = 0L;
-+ _tmp10_ = start;
-+ _tmp11_ = string_length;
-+ _tmp8_ = _tmp10_ <= _tmp11_;
-+ } else {
-+ _tmp8_ = FALSE;
-+ }
-+ g_return_val_if_fail (_tmp8_, NULL);
-+ _tmp13_ = end;
-+ if (_tmp13_ >= ((glong) 0)) {
-+ glong _tmp14_ = 0L;
-+ glong _tmp15_ = 0L;
-+ _tmp14_ = end;
-+ _tmp15_ = string_length;
-+ _tmp12_ = _tmp14_ <= _tmp15_;
-+ } else {
-+ _tmp12_ = FALSE;
-+ }
-+ g_return_val_if_fail (_tmp12_, NULL);
-+ _tmp16_ = start;
-+ _tmp17_ = end;
-+ g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
-+ _tmp18_ = start;
-+ _tmp19_ = end;
-+ _tmp20_ = start;
-+ _tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
-+ result = _tmp21_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_find_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
-+ RygelLmsCategoryContainerFindObjectData* _data_;
-+ _data_ = _user_data_;
-+ _data_->_source_object_ = source_object;
-+ _data_->_res_ = _res_;
-+ rygel_lms_category_container_real_find_object_co (_data_);
-+}
-+
-+
-+static gboolean rygel_lms_category_container_real_find_object_co (RygelLmsCategoryContainerFindObjectData* _data_) {
-+ switch (_data_->_state_) {
-+ case 0:
-+ goto _state_0;
-+ case 1:
-+ goto _state_1;
-+ default:
-+ g_assert_not_reached ();
-+ }
-+ _state_0:
-+ _data_->_tmp0_ = NULL;
-+ _data_->_tmp0_ = _data_->id;
-+ _data_->_tmp1_ = NULL;
-+ _data_->_tmp1_ = _data_->self->child_prefix;
-+ _data_->_tmp2_ = FALSE;
-+ _data_->_tmp2_ = g_str_has_prefix (_data_->_tmp0_, _data_->_tmp1_);
-+ if (!_data_->_tmp2_) {
-+ _data_->result = NULL;
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ _data_->object = NULL;
-+ _data_->_tmp3_ = NULL;
-+ _data_->_tmp3_ = _data_->id;
-+ _data_->_tmp4_ = NULL;
-+ _data_->_tmp4_ = _data_->self->child_prefix;
-+ _data_->_tmp5_ = 0;
-+ _data_->_tmp5_ = strlen (_data_->_tmp4_);
-+ _data_->_tmp6_ = 0;
-+ _data_->_tmp6_ = _data_->_tmp5_;
-+ _data_->_tmp7_ = NULL;
-+ _data_->_tmp7_ = string_substring (_data_->_tmp3_, (glong) _data_->_tmp6_, (glong) (-1));
-+ _data_->real_id = _data_->_tmp7_;
-+ _data_->_tmp8_ = NULL;
-+ _data_->_tmp8_ = _data_->real_id;
-+ _data_->_tmp9_ = 0;
-+ _data_->_tmp9_ = string_index_of_char (_data_->_tmp8_, (gunichar) ':', 0);
-+ _data_->index = _data_->_tmp9_;
-+ _data_->_tmp10_ = 0;
-+ _data_->_tmp10_ = _data_->index;
-+ if (_data_->_tmp10_ > 0) {
-+ _data_->_tmp11_ = NULL;
-+ _data_->_tmp11_ = _data_->real_id;
-+ _data_->_tmp12_ = 0;
-+ _data_->_tmp12_ = _data_->index;
-+ _data_->_tmp13_ = NULL;
-+ _data_->_tmp13_ = string_slice (_data_->_tmp11_, (glong) 0, (glong) _data_->_tmp12_);
-+ _g_free0 (_data_->real_id);
-+ _data_->real_id = _data_->_tmp13_;
-+ }
-+ {
-+ _data_->_tmp14_ = NULL;
-+ _data_->_tmp14_ = _data_->real_id;
-+ _data_->_tmp15_ = NULL;
-+ _data_->_tmp15_ = _data_->self->stmt_find_object;
-+ rygel_lms_database_find_object (_data_->_tmp14_, _data_->_tmp15_, &_data_->_inner_error_);
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ if (_data_->_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch5_rygel_lms_database_error;
-+ }
-+ _g_free0 (_data_->real_id);
-+ _g_object_unref0 (_data_->object);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
-+ g_clear_error (&_data_->_inner_error_);
-+ return FALSE;
-+ }
-+ _data_->_tmp16_ = NULL;
-+ _data_->_tmp16_ = _data_->self->stmt_find_object;
-+ _data_->_tmp17_ = NULL;
-+ _data_->_tmp17_ = rygel_lms_category_container_object_from_statement (_data_->self, _data_->_tmp16_);
-+ _data_->child = _data_->_tmp17_;
-+ _data_->_tmp18_ = 0;
-+ _data_->_tmp18_ = _data_->index;
-+ if (_data_->_tmp18_ < 0) {
-+ _data_->_tmp19_ = NULL;
-+ _data_->_tmp19_ = _data_->child;
-+ _data_->_tmp20_ = NULL;
-+ _data_->_tmp20_ = _g_object_ref0 (_data_->_tmp19_);
-+ _g_object_unref0 (_data_->object);
-+ _data_->object = _data_->_tmp20_;
-+ } else {
-+ _data_->_tmp21_ = NULL;
-+ _data_->_tmp21_ = _data_->child;
-+ _data_->_tmp22_ = NULL;
-+ _data_->_tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp21_, RYGEL_LMS_TYPE_CATEGORY_CONTAINER) ? ((RygelLMSCategoryContainer*) _data_->_tmp21_) : NULL);
-+ _data_->container = _data_->_tmp22_;
-+ _data_->_tmp24_ = NULL;
-+ _data_->_tmp24_ = _data_->container;
-+ _data_->_tmp25_ = NULL;
-+ _data_->_tmp25_ = _data_->id;
-+ _data_->_tmp26_ = NULL;
-+ _data_->_tmp26_ = _data_->cancellable;
-+ _data_->_state_ = 1;
-+ rygel_media_container_find_object ((RygelMediaContainer*) _data_->_tmp24_, _data_->_tmp25_, _data_->_tmp26_, rygel_lms_category_container_find_object_ready, _data_);
-+ return FALSE;
-+ _state_1:
-+ _data_->_tmp27_ = NULL;
-+ _data_->_tmp27_ = rygel_media_container_find_object_finish ((RygelMediaContainer*) _data_->_tmp24_, _data_->_res_, &_data_->_inner_error_);
-+ _data_->_tmp23_ = _data_->_tmp27_;
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ _g_object_unref0 (_data_->container);
-+ _g_object_unref0 (_data_->child);
-+ if (_data_->_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch5_rygel_lms_database_error;
-+ }
-+ goto __finally5;
-+ }
-+ _data_->_tmp28_ = NULL;
-+ _data_->_tmp28_ = _data_->_tmp23_;
-+ _data_->_tmp23_ = NULL;
-+ _g_object_unref0 (_data_->object);
-+ _data_->object = _data_->_tmp28_;
-+ _data_->_tmp29_ = NULL;
-+ _data_->_tmp29_ = _data_->object;
-+ _data_->_tmp30_ = NULL;
-+ _data_->_tmp30_ = _data_->object;
-+ _data_->_tmp31_ = NULL;
-+ _data_->_tmp31_ = rygel_media_object_get_parent (_data_->_tmp30_);
-+ _data_->_tmp32_ = NULL;
-+ _data_->_tmp32_ = _data_->_tmp31_;
-+ rygel_media_object_set_parent_ref (_data_->_tmp29_, _data_->_tmp32_);
-+ _g_object_unref0 (_data_->_tmp23_);
-+ _g_object_unref0 (_data_->container);
-+ }
-+ _g_object_unref0 (_data_->child);
-+ }
-+ goto __finally5;
-+ __catch5_rygel_lms_database_error:
-+ {
-+ _data_->e = _data_->_inner_error_;
-+ _data_->_inner_error_ = NULL;
-+ _data_->_tmp33_ = NULL;
-+ _data_->_tmp33_ = _data_->id;
-+ _data_->_tmp34_ = NULL;
-+ _data_->_tmp34_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->self);
-+ _data_->_tmp35_ = NULL;
-+ _data_->_tmp35_ = _data_->_tmp34_;
-+ _data_->_tmp36_ = NULL;
-+ _data_->_tmp36_ = _data_->e;
-+ _data_->_tmp37_ = NULL;
-+ _data_->_tmp37_ = _data_->_tmp36_->message;
-+ g_debug ("rygel-lms-category-container.vala:328: find_object %s in %s: %s", _data_->_tmp33_, _data_->_tmp35_, _data_->_tmp37_);
-+ _g_error_free0 (_data_->e);
-+ }
-+ __finally5:
-+ if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
-+ g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-+ g_error_free (_data_->_inner_error_);
-+ _g_free0 (_data_->real_id);
-+ _g_object_unref0 (_data_->object);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ }
-+ _data_->result = _data_->object;
-+ _g_free0 (_data_->real_id);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+ _g_free0 (_data_->real_id);
-+ _g_object_unref0 (_data_->object);
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+}
-+
-+
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* _tmp2_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->child_prefix;
-+ _tmp1_ = db_id;
-+ _tmp2_ = g_strdup_printf ("%s%d", _tmp0_, _tmp1_);
-+ result = _tmp2_;
-+ return result;
-+}
-+
-+
-+gchar* rygel_lms_category_container_build_reference_id (RygelLMSCategoryContainer* self, gint db_id) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* _tmp2_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->ref_prefix;
-+ _tmp1_ = db_id;
-+ _tmp2_ = g_strdup_printf ("%s%d", _tmp0_, _tmp1_);
-+ result = _tmp2_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_real_add_child_data_free (gpointer _data) {
-+ RygelLmsCategoryContainerAddChildData* _data_;
-+ _data_ = _data;
-+ _g_object_unref0 (_data_->object);
-+ _g_object_unref0 (_data_->self);
-+ g_slice_free (RygelLmsCategoryContainerAddChildData, _data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_add_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-+ RygelLMSCategoryContainer * self;
-+ RygelLmsCategoryContainerAddChildData* _data_;
-+ RygelLMSCategoryContainer* _tmp0_ = NULL;
-+ RygelMediaObject* _tmp1_ = NULL;
-+ RygelMediaObject* _tmp2_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _data_ = g_slice_new0 (RygelLmsCategoryContainerAddChildData);
-+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_lms_category_container_real_add_child);
-+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_lms_category_container_real_add_child_data_free);
-+ _tmp0_ = _g_object_ref0 (self);
-+ _data_->self = _tmp0_;
-+ _tmp1_ = object;
-+ _tmp2_ = _g_object_ref0 (_tmp1_);
-+ _g_object_unref0 (_data_->object);
-+ _data_->object = _tmp2_;
-+ rygel_lms_category_container_real_add_child_co (_data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_add_child_finish (RygelTrackableContainer* base, GAsyncResult* _res_) {
-+ RygelLmsCategoryContainerAddChildData* _data_;
-+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-+}
-+
-+
-+static gboolean rygel_lms_category_container_real_add_child_co (RygelLmsCategoryContainerAddChildData* _data_) {
-+ switch (_data_->_state_) {
-+ case 0:
-+ goto _state_0;
-+ default:
-+ g_assert_not_reached ();
-+ }
-+ _state_0:
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+}
-+
-+
-+static void rygel_lms_category_container_real_remove_child_data_free (gpointer _data) {
-+ RygelLmsCategoryContainerRemoveChildData* _data_;
-+ _data_ = _data;
-+ _g_object_unref0 (_data_->object);
-+ _g_object_unref0 (_data_->self);
-+ g_slice_free (RygelLmsCategoryContainerRemoveChildData, _data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_remove_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-+ RygelLMSCategoryContainer * self;
-+ RygelLmsCategoryContainerRemoveChildData* _data_;
-+ RygelLMSCategoryContainer* _tmp0_ = NULL;
-+ RygelMediaObject* _tmp1_ = NULL;
-+ RygelMediaObject* _tmp2_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _data_ = g_slice_new0 (RygelLmsCategoryContainerRemoveChildData);
-+ _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_lms_category_container_real_remove_child);
-+ g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_lms_category_container_real_remove_child_data_free);
-+ _tmp0_ = _g_object_ref0 (self);
-+ _data_->self = _tmp0_;
-+ _tmp1_ = object;
-+ _tmp2_ = _g_object_ref0 (_tmp1_);
-+ _g_object_unref0 (_data_->object);
-+ _data_->object = _tmp2_;
-+ rygel_lms_category_container_real_remove_child_co (_data_);
-+}
-+
-+
-+static void rygel_lms_category_container_real_remove_child_finish (RygelTrackableContainer* base, GAsyncResult* _res_) {
-+ RygelLmsCategoryContainerRemoveChildData* _data_;
-+ _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-+}
-+
-+
-+static gboolean rygel_lms_category_container_real_remove_child_co (RygelLmsCategoryContainerRemoveChildData* _data_) {
-+ switch (_data_->_state_) {
-+ case 0:
-+ goto _state_0;
-+ default:
-+ g_assert_not_reached ();
-+ }
-+ _state_0:
-+ if (_data_->_state_ == 0) {
-+ g_simple_async_result_complete_in_idle (_data_->_async_result);
-+ } else {
-+ g_simple_async_result_complete (_data_->_async_result);
-+ }
-+ g_object_unref (_data_->_async_result);
-+ return FALSE;
-+}
-+
-+
-+static void rygel_lms_category_container_on_db_updated (RygelLMSCategoryContainer* self, guint64 old_id, guint64 new_id) {
-+ GError * _inner_error_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ {
-+ sqlite3_stmt* stmt_count = NULL;
-+ RygelLMSDatabase* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ sqlite3_stmt* _tmp3_ = NULL;
-+ gint _tmp4_ = 0;
-+ sqlite3_stmt* _tmp7_ = NULL;
-+ guint64 _tmp8_ = 0ULL;
-+ guint64 _tmp9_ = 0ULL;
-+ sqlite3_stmt* _tmp16_ = NULL;
-+ guint64 _tmp17_ = 0ULL;
-+ guint64 _tmp18_ = 0ULL;
-+ _tmp0_ = self->priv->_lms_db;
-+ _tmp1_ = self->priv->_sql_count;
-+ _tmp2_ = rygel_lms_database_prepare (_tmp0_, _tmp1_, &_inner_error_);
-+ stmt_count = _tmp2_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch6_rygel_lms_database_error;
-+ }
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ _tmp3_ = stmt_count;
-+ _tmp4_ = sqlite3_step (_tmp3_);
-+ if (_tmp4_ == SQLITE_ROW) {
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ gint _tmp6_ = 0;
-+ _tmp5_ = stmt_count;
-+ _tmp6_ = sqlite3_column_int (_tmp5_, 0);
-+ rygel_media_container_set_child_count ((RygelMediaContainer*) self, _tmp6_);
-+ }
-+ _tmp7_ = self->stmt_added;
-+ _tmp8_ = old_id;
-+ _tmp9_ = new_id;
-+ rygel_lms_database_get_children_with_update_id_init (_tmp7_, _tmp8_, _tmp9_, &_inner_error_);
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt_count);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch6_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ while (TRUE) {
-+ gboolean _tmp10_ = FALSE;
-+ sqlite3_stmt* _tmp11_ = NULL;
-+ gboolean _tmp12_ = FALSE;
-+ sqlite3_stmt* _tmp13_ = NULL;
-+ RygelMediaObject* _tmp14_ = NULL;
-+ RygelMediaObject* _tmp15_ = NULL;
-+ _tmp11_ = self->stmt_added;
-+ _tmp12_ = rygel_lms_database_get_children_step (_tmp11_, &_inner_error_);
-+ _tmp10_ = _tmp12_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt_count);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch6_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ if (!_tmp10_) {
-+ break;
-+ }
-+ _tmp13_ = self->stmt_added;
-+ _tmp14_ = rygel_lms_category_container_object_from_statement (self, _tmp13_);
-+ _tmp15_ = _tmp14_;
-+ rygel_trackable_container_add_child_tracked ((RygelTrackableContainer*) self, _tmp15_, NULL, NULL);
-+ _g_object_unref0 (_tmp15_);
-+ }
-+ _tmp16_ = self->stmt_removed;
-+ _tmp17_ = old_id;
-+ _tmp18_ = new_id;
-+ rygel_lms_database_get_children_with_update_id_init (_tmp16_, _tmp17_, _tmp18_, &_inner_error_);
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt_count);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch6_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ while (TRUE) {
-+ gboolean _tmp19_ = FALSE;
-+ sqlite3_stmt* _tmp20_ = NULL;
-+ gboolean _tmp21_ = FALSE;
-+ sqlite3_stmt* _tmp22_ = NULL;
-+ RygelMediaObject* _tmp23_ = NULL;
-+ RygelMediaObject* _tmp24_ = NULL;
-+ _tmp20_ = self->stmt_removed;
-+ _tmp21_ = rygel_lms_database_get_children_step (_tmp20_, &_inner_error_);
-+ _tmp19_ = _tmp21_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt_count);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch6_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ if (!_tmp19_) {
-+ break;
-+ }
-+ _tmp22_ = self->stmt_removed;
-+ _tmp23_ = rygel_lms_category_container_object_from_statement (self, _tmp22_);
-+ _tmp24_ = _tmp23_;
-+ rygel_trackable_container_remove_child_tracked ((RygelTrackableContainer*) self, _tmp24_, NULL, NULL);
-+ _g_object_unref0 (_tmp24_);
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ }
-+ goto __finally6;
-+ __catch6_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp25_ = NULL;
-+ const gchar* _tmp26_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp25_ = e;
-+ _tmp26_ = _tmp25_->message;
-+ g_warning ("rygel-lms-category-container.vala:372: Can't perform container update:" \
-+" %s", _tmp26_);
-+ _g_error_free0 (e);
-+ }
-+ __finally6:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+}
-+
-+
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed) {
-+ RygelLMSCategoryContainer * self = NULL;
-+ RygelMediaContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ RygelMediaContainer* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ RygelLMSDatabase* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ const gchar* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ const gchar* _tmp13_ = NULL;
-+ const gchar* _tmp14_ = NULL;
-+ g_return_val_if_fail (db_id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ g_return_val_if_fail (sql_all != NULL, NULL);
-+ g_return_val_if_fail (sql_find_object != NULL, NULL);
-+ g_return_val_if_fail (sql_count != NULL, NULL);
-+ _tmp0_ = parent;
-+ _tmp1_ = rygel_media_object_get_id ((RygelMediaObject*) _tmp0_);
-+ _tmp2_ = _tmp1_;
-+ _tmp3_ = db_id;
-+ _tmp4_ = g_strdup_printf ("%s:%s", _tmp2_, _tmp3_);
-+ _tmp5_ = _tmp4_;
-+ _tmp6_ = db_id;
-+ _tmp7_ = parent;
-+ _tmp8_ = title;
-+ _tmp9_ = lms_db;
-+ _tmp10_ = sql_all;
-+ _tmp11_ = sql_find_object;
-+ _tmp12_ = sql_count;
-+ _tmp13_ = sql_added;
-+ _tmp14_ = sql_removed;
-+ self = (RygelLMSCategoryContainer*) g_object_new (object_type, "id", _tmp5_, "db-id", _tmp6_, "parent", _tmp7_, "title", _tmp8_, "lms-db", _tmp9_, "sql-all", _tmp10_, "sql-find-object", _tmp11_, "sql-count", _tmp12_, "sql-added", _tmp13_, "sql-removed", _tmp14_, NULL);
-+ _g_free0 (_tmp5_);
-+ return self;
-+}
-+
-+
-+static GeeArrayList* rygel_lms_category_container_real_get_search_classes (RygelSearchableContainer* base) {
-+ GeeArrayList* result;
-+ RygelLMSCategoryContainer* self;
-+ GeeArrayList* _tmp0_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _tmp0_ = self->priv->_search_classes;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_real_set_search_classes (RygelSearchableContainer* base, GeeArrayList* value) {
-+ RygelLMSCategoryContainer* self;
-+ GeeArrayList* _tmp0_ = NULL;
-+ GeeArrayList* _tmp1_ = NULL;
-+ self = (RygelLMSCategoryContainer*) base;
-+ _tmp0_ = value;
-+ _tmp1_ = _g_object_ref0 (_tmp0_);
-+ _g_object_unref0 (self->priv->_search_classes);
-+ self->priv->_search_classes = _tmp1_;
-+ g_object_notify ((GObject *) self, "search-classes");
-+}
-+
-+
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self) {
-+ RygelLMSDatabase* result;
-+ RygelLMSDatabase* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_lms_db;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_lms_db (RygelLMSCategoryContainer* self, RygelLMSDatabase* value) {
-+ RygelLMSDatabase* _tmp0_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ self->priv->_lms_db = _tmp0_;
-+ g_object_notify ((GObject *) self, "lms-db");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_db_id (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_db_id;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_db_id (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_db_id);
-+ self->priv->_db_id = _tmp1_;
-+ g_object_notify ((GObject *) self, "db-id");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_sql_all (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_all;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_sql_all (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_sql_all);
-+ self->priv->_sql_all = _tmp1_;
-+ g_object_notify ((GObject *) self, "sql-all");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_sql_find_object (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_find_object;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_sql_find_object (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_sql_find_object);
-+ self->priv->_sql_find_object = _tmp1_;
-+ g_object_notify ((GObject *) self, "sql-find-object");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_sql_count (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_count;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_sql_count (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_sql_count);
-+ self->priv->_sql_count = _tmp1_;
-+ g_object_notify ((GObject *) self, "sql-count");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_sql_added (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_added;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_sql_added (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_sql_added);
-+ self->priv->_sql_added = _tmp1_;
-+ g_object_notify ((GObject *) self, "sql-added");
-+}
-+
-+
-+const gchar* rygel_lms_category_container_get_sql_removed (RygelLMSCategoryContainer* self) {
-+ const gchar* result;
-+ const gchar* _tmp0_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ _tmp0_ = self->priv->_sql_removed;
-+ result = _tmp0_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_category_container_set_sql_removed (RygelLMSCategoryContainer* self, const gchar* value) {
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_if_fail (self != NULL);
-+ _tmp0_ = value;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->priv->_sql_removed);
-+ self->priv->_sql_removed = _tmp1_;
-+ g_object_notify ((GObject *) self, "sql-removed");
-+}
-+
-+
-+static void _rygel_lms_category_container_on_db_updated_rygel_lms_database_db_updated (RygelLMSDatabase* _sender, guint64 old_update_id, guint64 new_update_id, gpointer self) {
-+ rygel_lms_category_container_on_db_updated ((RygelLMSCategoryContainer*) self, old_update_id, new_update_id);
-+}
-+
-+
-+static GObject * rygel_lms_category_container_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
-+ GObject * obj;
-+ GObjectClass * parent_class;
-+ RygelLMSCategoryContainer * self;
-+ GeeArrayList* _tmp0_ = NULL;
-+ GeeArrayList* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gint index = 0;
-+ const gchar* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gint _tmp7_ = 0;
-+ const gchar* _tmp8_ = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ gint _tmp10_ = 0;
-+ gchar* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ parent_class = G_OBJECT_CLASS (rygel_lms_category_container_parent_class);
-+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer);
-+ _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
-+ _tmp1_ = _tmp0_;
-+ rygel_searchable_container_set_search_classes ((RygelSearchableContainer*) self, _tmp1_);
-+ _g_object_unref0 (_tmp1_);
-+ _tmp2_ = rygel_media_object_get_id ((RygelMediaObject*) self);
-+ _tmp3_ = _tmp2_;
-+ _tmp4_ = g_strdup_printf ("%s:", _tmp3_);
-+ _g_free0 (self->child_prefix);
-+ self->child_prefix = _tmp4_;
-+ _tmp5_ = rygel_media_object_get_id ((RygelMediaObject*) self);
-+ _tmp6_ = _tmp5_;
-+ _tmp7_ = string_index_of_char (_tmp6_, (gunichar) ':', 0);
-+ index = _tmp7_;
-+ _tmp8_ = rygel_media_object_get_id ((RygelMediaObject*) self);
-+ _tmp9_ = _tmp8_;
-+ _tmp10_ = index;
-+ _tmp11_ = string_slice (_tmp9_, (glong) 0, (glong) _tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp13_ = g_strconcat (_tmp12_, ":all:", NULL);
-+ _g_free0 (self->ref_prefix);
-+ self->ref_prefix = _tmp13_;
-+ _g_free0 (_tmp12_);
-+ {
-+ sqlite3_stmt* _tmp14_ = NULL;
-+ RygelLMSDatabase* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ sqlite3_stmt* _tmp17_ = NULL;
-+ sqlite3_stmt* _tmp18_ = NULL;
-+ sqlite3_stmt* _tmp19_ = NULL;
-+ RygelLMSDatabase* _tmp20_ = NULL;
-+ const gchar* _tmp21_ = NULL;
-+ sqlite3_stmt* _tmp22_ = NULL;
-+ sqlite3_stmt* _tmp23_ = NULL;
-+ sqlite3_stmt* stmt_count = NULL;
-+ RygelLMSDatabase* _tmp24_ = NULL;
-+ const gchar* _tmp25_ = NULL;
-+ sqlite3_stmt* _tmp26_ = NULL;
-+ sqlite3_stmt* _tmp27_ = NULL;
-+ gint _tmp28_ = 0;
-+ gboolean _tmp31_ = FALSE;
-+ const gchar* _tmp32_ = NULL;
-+ _tmp15_ = self->priv->_lms_db;
-+ _tmp16_ = self->priv->_sql_all;
-+ _tmp17_ = rygel_lms_database_prepare (_tmp15_, _tmp16_, &_inner_error_);
-+ _tmp14_ = _tmp17_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch7_rygel_lms_database_error;
-+ }
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ _tmp18_ = _tmp14_;
-+ _tmp14_ = NULL;
-+ _sqlite3_finalize0 (self->stmt_all);
-+ self->stmt_all = _tmp18_;
-+ _tmp20_ = self->priv->_lms_db;
-+ _tmp21_ = self->priv->_sql_find_object;
-+ _tmp22_ = rygel_lms_database_prepare (_tmp20_, _tmp21_, &_inner_error_);
-+ _tmp19_ = _tmp22_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (_tmp14_);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch7_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (_tmp14_);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ _tmp23_ = _tmp19_;
-+ _tmp19_ = NULL;
-+ _sqlite3_finalize0 (self->stmt_find_object);
-+ self->stmt_find_object = _tmp23_;
-+ _tmp24_ = self->priv->_lms_db;
-+ _tmp25_ = self->priv->_sql_count;
-+ _tmp26_ = rygel_lms_database_prepare (_tmp24_, _tmp25_, &_inner_error_);
-+ stmt_count = _tmp26_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch7_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ _tmp27_ = stmt_count;
-+ _tmp28_ = sqlite3_step (_tmp27_);
-+ if (_tmp28_ == SQLITE_ROW) {
-+ sqlite3_stmt* _tmp29_ = NULL;
-+ gint _tmp30_ = 0;
-+ _tmp29_ = stmt_count;
-+ _tmp30_ = sqlite3_column_int (_tmp29_, 0);
-+ rygel_media_container_set_child_count ((RygelMediaContainer*) self, _tmp30_);
-+ }
-+ _tmp32_ = self->priv->_sql_added;
-+ if (_tmp32_ != NULL) {
-+ const gchar* _tmp33_ = NULL;
-+ _tmp33_ = self->priv->_sql_removed;
-+ _tmp31_ = _tmp33_ != NULL;
-+ } else {
-+ _tmp31_ = FALSE;
-+ }
-+ if (_tmp31_) {
-+ sqlite3_stmt* _tmp34_ = NULL;
-+ RygelLMSDatabase* _tmp35_ = NULL;
-+ const gchar* _tmp36_ = NULL;
-+ sqlite3_stmt* _tmp37_ = NULL;
-+ sqlite3_stmt* _tmp38_ = NULL;
-+ sqlite3_stmt* _tmp39_ = NULL;
-+ RygelLMSDatabase* _tmp40_ = NULL;
-+ const gchar* _tmp41_ = NULL;
-+ sqlite3_stmt* _tmp42_ = NULL;
-+ sqlite3_stmt* _tmp43_ = NULL;
-+ RygelLMSDatabase* _tmp44_ = NULL;
-+ _tmp35_ = self->priv->_lms_db;
-+ _tmp36_ = self->priv->_sql_added;
-+ _tmp37_ = rygel_lms_database_prepare (_tmp35_, _tmp36_, &_inner_error_);
-+ _tmp34_ = _tmp37_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (stmt_count);
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch7_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ _tmp38_ = _tmp34_;
-+ _tmp34_ = NULL;
-+ _sqlite3_finalize0 (self->stmt_added);
-+ self->stmt_added = _tmp38_;
-+ _tmp40_ = self->priv->_lms_db;
-+ _tmp41_ = self->priv->_sql_removed;
-+ _tmp42_ = rygel_lms_database_prepare (_tmp40_, _tmp41_, &_inner_error_);
-+ _tmp39_ = _tmp42_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _sqlite3_finalize0 (_tmp34_);
-+ _sqlite3_finalize0 (stmt_count);
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch7_rygel_lms_database_error;
-+ }
-+ _sqlite3_finalize0 (_tmp34_);
-+ _sqlite3_finalize0 (stmt_count);
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ _tmp43_ = _tmp39_;
-+ _tmp39_ = NULL;
-+ _sqlite3_finalize0 (self->stmt_removed);
-+ self->stmt_removed = _tmp43_;
-+ _tmp44_ = self->priv->_lms_db;
-+ g_signal_connect_object (_tmp44_, "db-updated", (GCallback) _rygel_lms_category_container_on_db_updated_rygel_lms_database_db_updated, self, 0);
-+ _sqlite3_finalize0 (_tmp39_);
-+ _sqlite3_finalize0 (_tmp34_);
-+ }
-+ _sqlite3_finalize0 (stmt_count);
-+ _sqlite3_finalize0 (_tmp19_);
-+ _sqlite3_finalize0 (_tmp14_);
-+ }
-+ goto __finally7;
-+ __catch7_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ const gchar* _tmp45_ = NULL;
-+ const gchar* _tmp46_ = NULL;
-+ GError* _tmp47_ = NULL;
-+ const gchar* _tmp48_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp45_ = rygel_media_object_get_title ((RygelMediaObject*) self);
-+ _tmp46_ = _tmp45_;
-+ _tmp47_ = e;
-+ _tmp48_ = _tmp47_->message;
-+ g_warning ("rygel-lms-category-container.vala:424: Container %s: %s", _tmp46_, _tmp48_);
-+ _g_error_free0 (e);
-+ }
-+ __finally7:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ }
-+ return obj;
-+}
-+
-+
-+static void rygel_lms_category_container_class_init (RygelLMSCategoryContainerClass * klass) {
-+ rygel_lms_category_container_parent_class = g_type_class_peek_parent (klass);
-+ g_type_class_add_private (klass, sizeof (RygelLMSCategoryContainerPrivate));
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_category_container_real_object_from_statement;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_all_with_filter = rygel_lms_category_container_real_get_sql_all_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_sql_count_with_filter = rygel_lms_category_container_real_get_sql_count_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_child_count_with_filter = rygel_lms_category_container_real_get_child_count_with_filter;
-+ ((RygelLMSCategoryContainerClass *) klass)->get_children_with_filter = rygel_lms_category_container_real_get_children_with_filter;
-+ ((RygelMediaContainerClass *) klass)->get_children = rygel_lms_category_container_real_get_children;
-+ ((RygelMediaContainerClass *) klass)->get_children_finish = rygel_lms_category_container_real_get_children_finish;
-+ ((RygelMediaContainerClass *) klass)->find_object = rygel_lms_category_container_real_find_object;
-+ ((RygelMediaContainerClass *) klass)->find_object_finish = rygel_lms_category_container_real_find_object_finish;
-+ G_OBJECT_CLASS (klass)->get_property = _vala_rygel_lms_category_container_get_property;
-+ G_OBJECT_CLASS (klass)->set_property = _vala_rygel_lms_category_container_set_property;
-+ G_OBJECT_CLASS (klass)->constructor = rygel_lms_category_container_constructor;
-+ G_OBJECT_CLASS (klass)->finalize = rygel_lms_category_container_finalize;
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SEARCH_CLASSES, g_param_spec_object ("search-classes", "search-classes", "search-classes", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_LMS_DB, rygel_lms_param_spec_database ("lms-db", "lms-db", "lms-db", RYGEL_LMS_TYPE_DATABASE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_DB_ID, g_param_spec_string ("db-id", "db-id", "db-id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SQL_ALL, g_param_spec_string ("sql-all", "sql-all", "sql-all", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SQL_FIND_OBJECT, g_param_spec_string ("sql-find-object", "sql-find-object", "sql-find-object", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SQL_COUNT, g_param_spec_string ("sql-count", "sql-count", "sql-count", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SQL_ADDED, g_param_spec_string ("sql-added", "sql-added", "sql-added", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+ g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_LMS_CATEGORY_CONTAINER_SQL_REMOVED, g_param_spec_string ("sql-removed", "sql-removed", "sql-removed", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-+}
-+
-+
-+static void rygel_lms_category_container_rygel_trackable_container_interface_init (RygelTrackableContainerIface * iface) {
-+ rygel_lms_category_container_rygel_trackable_container_parent_iface = g_type_interface_peek_parent (iface);
-+ iface->add_child = (void (*)(RygelTrackableContainer*, RygelMediaObject*)) rygel_lms_category_container_real_add_child;
-+ iface->add_child_finish = rygel_lms_category_container_real_add_child_finish;
-+ iface->remove_child = (void (*)(RygelTrackableContainer*, RygelMediaObject*)) rygel_lms_category_container_real_remove_child;
-+ iface->remove_child_finish = rygel_lms_category_container_real_remove_child_finish;
-+}
-+
-+
-+static void rygel_lms_category_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface * iface) {
-+ rygel_lms_category_container_rygel_searchable_container_parent_iface = g_type_interface_peek_parent (iface);
-+ iface->search = (RygelMediaObjects* (*)(RygelSearchableContainer*, RygelSearchExpression*, guint, guint, guint*, const gchar*, GCancellable*, GError**)) rygel_lms_category_container_real_search;
-+ iface->search_finish = rygel_lms_category_container_real_search_finish;
-+ iface->get_search_classes = rygel_lms_category_container_real_get_search_classes;
-+ iface->set_search_classes = rygel_lms_category_container_real_set_search_classes;
-+}
-+
-+
-+static void rygel_lms_category_container_instance_init (RygelLMSCategoryContainer * self) {
-+ self->priv = RYGEL_LMS_CATEGORY_CONTAINER_GET_PRIVATE (self);
-+}
-+
-+
-+static void rygel_lms_category_container_finalize (GObject* obj) {
-+ RygelLMSCategoryContainer * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer);
-+ _g_object_unref0 (self->priv->_search_classes);
-+ _g_free0 (self->priv->_db_id);
-+ _g_free0 (self->priv->_sql_all);
-+ _g_free0 (self->priv->_sql_find_object);
-+ _g_free0 (self->priv->_sql_count);
-+ _g_free0 (self->priv->_sql_added);
-+ _g_free0 (self->priv->_sql_removed);
-+ _sqlite3_finalize0 (self->stmt_all);
-+ _sqlite3_finalize0 (self->stmt_find_object);
-+ _sqlite3_finalize0 (self->stmt_added);
-+ _sqlite3_finalize0 (self->stmt_removed);
-+ _g_free0 (self->child_prefix);
-+ _g_free0 (self->ref_prefix);
-+ G_OBJECT_CLASS (rygel_lms_category_container_parent_class)->finalize (obj);
-+}
-+
-+
-+GType rygel_lms_category_container_get_type (void) {
-+ static volatile gsize rygel_lms_category_container_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_category_container_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSCategoryContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_category_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSCategoryContainer), 0, (GInstanceInitFunc) rygel_lms_category_container_instance_init, NULL };
-+ static const GInterfaceInfo rygel_trackable_container_info = { (GInterfaceInitFunc) rygel_lms_category_container_rygel_trackable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
-+ static const GInterfaceInfo rygel_searchable_container_info = { (GInterfaceInitFunc) rygel_lms_category_container_rygel_searchable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
-+ GType rygel_lms_category_container_type_id;
-+ rygel_lms_category_container_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_CONTAINER, "RygelLMSCategoryContainer", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
-+ g_type_add_interface_static (rygel_lms_category_container_type_id, RYGEL_TYPE_TRACKABLE_CONTAINER, &rygel_trackable_container_info);
-+ g_type_add_interface_static (rygel_lms_category_container_type_id, RYGEL_TYPE_SEARCHABLE_CONTAINER, &rygel_searchable_container_info);
-+ g_once_init_leave (&rygel_lms_category_container_type_id__volatile, rygel_lms_category_container_type_id);
-+ }
-+ return rygel_lms_category_container_type_id__volatile;
-+}
-+
-+
-+static void _vala_rygel_lms_category_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
-+ RygelLMSCategoryContainer * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer);
-+ switch (property_id) {
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SEARCH_CLASSES:
-+ g_value_set_object (value, rygel_searchable_container_get_search_classes ((RygelSearchableContainer*) self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_LMS_DB:
-+ rygel_lms_value_set_database (value, rygel_lms_category_container_get_lms_db (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_DB_ID:
-+ g_value_set_string (value, rygel_lms_category_container_get_db_id (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_ALL:
-+ g_value_set_string (value, rygel_lms_category_container_get_sql_all (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_FIND_OBJECT:
-+ g_value_set_string (value, rygel_lms_category_container_get_sql_find_object (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_COUNT:
-+ g_value_set_string (value, rygel_lms_category_container_get_sql_count (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_ADDED:
-+ g_value_set_string (value, rygel_lms_category_container_get_sql_added (self));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_REMOVED:
-+ g_value_set_string (value, rygel_lms_category_container_get_sql_removed (self));
-+ break;
-+ default:
-+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-+ break;
-+ }
-+}
-+
-+
-+static void _vala_rygel_lms_category_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
-+ RygelLMSCategoryContainer * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer);
-+ switch (property_id) {
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SEARCH_CLASSES:
-+ rygel_searchable_container_set_search_classes ((RygelSearchableContainer*) self, g_value_get_object (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_LMS_DB:
-+ rygel_lms_category_container_set_lms_db (self, rygel_lms_value_get_database (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_DB_ID:
-+ rygel_lms_category_container_set_db_id (self, g_value_get_string (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_ALL:
-+ rygel_lms_category_container_set_sql_all (self, g_value_get_string (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_FIND_OBJECT:
-+ rygel_lms_category_container_set_sql_find_object (self, g_value_get_string (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_COUNT:
-+ rygel_lms_category_container_set_sql_count (self, g_value_get_string (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_ADDED:
-+ rygel_lms_category_container_set_sql_added (self, g_value_get_string (value));
-+ break;
-+ case RYGEL_LMS_CATEGORY_CONTAINER_SQL_REMOVED:
-+ rygel_lms_category_container_set_sql_removed (self, g_value_get_string (value));
-+ break;
-+ default:
-+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-+ break;
-+ }
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-database.c b/src/plugins/lms/rygel-lms-database.c
-new file mode 100644
-index 0000000..687ef64
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-database.c
-@@ -0,0 +1,1349 @@
-+/* rygel-lms-database.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-database.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2009,2011 Jens Georg <mail@jensge.org>,
-+ * (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <sqlite3.h>
-+#include <gio/gio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <glib/gi18n-lib.h>
-+#include <gobject/gvaluecollector.h>
-+
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+typedef struct _RygelLMSDatabasePrivate RygelLMSDatabasePrivate;
-+
-+#define RYGEL_LMS_TYPE_DBUS (rygel_lms_dbus_get_type ())
-+#define RYGEL_LMS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBus))
-+#define RYGEL_LMS_IS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DBUS))
-+#define RYGEL_LMS_DBUS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBusIface))
-+
-+typedef struct _RygelLMSDBus RygelLMSDBus;
-+typedef struct _RygelLMSDBusIface RygelLMSDBusIface;
-+
-+#define RYGEL_LMS_TYPE_DBUS_PROXY (rygel_lms_dbus_proxy_get_type ())
-+#define _sqlite3_close0(var) ((var == NULL) ? NULL : (var = (sqlite3_close (var), NULL)))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-+#define _rygel_lms_database_unref0(var) ((var == NULL) ? NULL : (var = (rygel_lms_database_unref (var), NULL)))
-+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
-+#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
-+#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (var), NULL)))
-+typedef struct _RygelLMSParamSpecDatabase RygelLMSParamSpecDatabase;
-+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
-+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
-+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
-+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
-+
-+typedef enum {
-+ RYGEL_LMS_DATABASE_ERROR_OPEN,
-+ RYGEL_LMS_DATABASE_ERROR_PREPARE,
-+ RYGEL_LMS_DATABASE_ERROR_BIND,
-+ RYGEL_LMS_DATABASE_ERROR_STEP,
-+ RYGEL_LMS_DATABASE_ERROR_NOT_FOUND
-+} RygelLMSDatabaseError;
-+#define RYGEL_LMS_DATABASE_ERROR rygel_lms_database_error_quark ()
-+struct _RygelLMSDatabase {
-+ GTypeInstance parent_instance;
-+ volatile int ref_count;
-+ RygelLMSDatabasePrivate * priv;
-+};
-+
-+struct _RygelLMSDatabaseClass {
-+ GTypeClass parent_class;
-+ void (*finalize) (RygelLMSDatabase *self);
-+};
-+
-+struct _RygelLMSDBusIface {
-+ GTypeInterface parent_iface;
-+ gchar* (*get_data_base_path) (RygelLMSDBus* self);
-+ guint64 (*get_update_id) (RygelLMSDBus* self);
-+};
-+
-+struct _RygelLMSDatabasePrivate {
-+ sqlite3* db;
-+ RygelLMSDBus* lms_proxy;
-+ guint64 update_id;
-+};
-+
-+struct _RygelLMSParamSpecDatabase {
-+ GParamSpec parent_instance;
-+};
-+
-+
-+static gpointer rygel_lms_database_parent_class = NULL;
-+
-+GQuark rygel_lms_database_error_quark (void);
-+gint rygel_lms_utf8_collate_str (guint8* a, int a_length1, guint8* b, int b_length1);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_dbus_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_dbus_proxy_get_type (void) G_GNUC_CONST;
-+guint rygel_lms_dbus_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
-+#define RYGEL_LMS_DATABASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabasePrivate))
-+enum {
-+ RYGEL_LMS_DATABASE_DUMMY_PROPERTY
-+};
-+static void rygel_lms_database_utf8_contains (sqlite3_context* context, sqlite3_value** args, int args_length1);
-+static gint rygel_lms_database_utf8_collate (gint alen, void* a, gint blen, void* b);
-+RygelLMSDatabase* rygel_lms_database_new (GError** error);
-+RygelLMSDatabase* rygel_lms_database_construct (GType object_type, GError** error);
-+gchar* rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self);
-+guint64 rygel_lms_dbus_get_update_id (RygelLMSDBus* self);
-+static void rygel_lms_database_on_lms_properties_changed (RygelLMSDatabase* self, GDBusProxy* lms_proxy, GVariant* changed, gchar** invalidated, int invalidated_length1);
-+static void _rygel_lms_database_on_lms_properties_changed_g_dbus_proxy_g_properties_changed (GDBusProxy* _sender, GVariant* changed_properties, gchar** invalidated_properties, gpointer self);
-+static void _rygel_lms_database_utf8_contains_sqlite_user_func_callback (sqlite3_context* context, int values_length1, sqlite3_value** values);
-+static gint _rygel_lms_database_utf8_collate_sqlite_compare_callback (gpointer self, gint alen, void* a, gint blen, void* b);
-+static gchar* _variant_get1 (GVariant* value);
-+static guint64 _variant_get2 (GVariant* value);
-+static guint64 _variant_get3 (GVariant* value);
-+sqlite3_stmt* rygel_lms_database_prepare (RygelLMSDatabase* self, const gchar* query_string, GError** error);
-+sqlite3_stmt* rygel_lms_database_prepare_and_init (RygelLMSDatabase* self, const gchar* query, GValue* arguments, int arguments_length1, GError** error);
-+void rygel_lms_database_find_object (const gchar* id, sqlite3_stmt* stmt, GError** error);
-+void rygel_lms_database_get_children_init (sqlite3_stmt* stmt, guint offset, guint max_count, const gchar* sort_criteria, GError** error);
-+void rygel_lms_database_get_children_with_update_id_init (sqlite3_stmt* stmt, guint64 old_id, guint64 new_id, GError** error);
-+gboolean rygel_lms_database_get_children_step (sqlite3_stmt* stmt, GError** error);
-+static void g_cclosure_user_marshal_VOID__UINT64_UINT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
-+static void rygel_lms_database_finalize (RygelLMSDatabase* obj);
-+static gint _vala_array_length (gpointer array);
-+
-+
-+GQuark rygel_lms_database_error_quark (void) {
-+ return g_quark_from_static_string ("rygel_lms_database_error-quark");
-+}
-+
-+
-+/**
-+ * Function to implement the custom SQL function 'contains'
-+ */
-+static void rygel_lms_database_utf8_contains (sqlite3_context* context, sqlite3_value** args, int args_length1) {
-+ sqlite3_value** _tmp0_ = NULL;
-+ gint _tmp0__length1 = 0;
-+ gboolean _tmp1_ = FALSE;
-+ sqlite3_value** _tmp2_ = NULL;
-+ gint _tmp2__length1 = 0;
-+ sqlite3_value* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* pattern = NULL;
-+ sqlite3_value** _tmp9_ = NULL;
-+ gint _tmp9__length1 = 0;
-+ sqlite3_value* _tmp10_ = NULL;
-+ const gchar* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ const gchar* _tmp13_ = NULL;
-+ sqlite3_value** _tmp14_ = NULL;
-+ gint _tmp14__length1 = 0;
-+ sqlite3_value* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gboolean _tmp17_ = FALSE;
-+ g_return_if_fail (context != NULL);
-+ _tmp0_ = args;
-+ _tmp0__length1 = args_length1;
-+ _vala_return_if_fail (_tmp0__length1 == 2, "args.length == 2");
-+ _tmp2_ = args;
-+ _tmp2__length1 = args_length1;
-+ _tmp3_ = _tmp2_[0];
-+ _tmp4_ = sqlite3_value_text (_tmp3_);
-+ if (_tmp4_ == NULL) {
-+ _tmp1_ = TRUE;
-+ } else {
-+ sqlite3_value** _tmp5_ = NULL;
-+ gint _tmp5__length1 = 0;
-+ sqlite3_value* _tmp6_ = NULL;
-+ const gchar* _tmp7_ = NULL;
-+ _tmp5_ = args;
-+ _tmp5__length1 = args_length1;
-+ _tmp6_ = _tmp5_[1];
-+ _tmp7_ = sqlite3_value_text (_tmp6_);
-+ _tmp1_ = _tmp7_ == NULL;
-+ }
-+ if (_tmp1_) {
-+ sqlite3_context* _tmp8_ = NULL;
-+ _tmp8_ = context;
-+ sqlite3_result_int (_tmp8_, 0);
-+ return;
-+ }
-+ _tmp9_ = args;
-+ _tmp9__length1 = args_length1;
-+ _tmp10_ = _tmp9_[1];
-+ _tmp11_ = sqlite3_value_text (_tmp10_);
-+ _tmp12_ = g_regex_escape_string (_tmp11_, -1);
-+ pattern = _tmp12_;
-+ _tmp13_ = pattern;
-+ _tmp14_ = args;
-+ _tmp14__length1 = args_length1;
-+ _tmp15_ = _tmp14_[0];
-+ _tmp16_ = sqlite3_value_text (_tmp15_);
-+ _tmp17_ = g_regex_match_simple (_tmp13_, _tmp16_, G_REGEX_CASELESS, 0);
-+ if (_tmp17_) {
-+ sqlite3_context* _tmp18_ = NULL;
-+ _tmp18_ = context;
-+ sqlite3_result_int (_tmp18_, 1);
-+ } else {
-+ sqlite3_context* _tmp19_ = NULL;
-+ _tmp19_ = context;
-+ sqlite3_result_int (_tmp19_, 0);
-+ }
-+ _g_free0 (pattern);
-+}
-+
-+
-+/**
-+ * Function to implement the custom SQLite collation 'CASEFOLD'.
-+ *
-+ * Uses utf8 case-fold to compare the strings.
-+ */
-+static gint rygel_lms_database_utf8_collate (gint alen, void* a, gint blen, void* b) {
-+ gint result = 0;
-+ guint8* _a = NULL;
-+ void* _tmp0_ = NULL;
-+ gint _a_length1 = 0;
-+ gint __a_size_ = 0;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ guint8* _b = NULL;
-+ void* _tmp3_ = NULL;
-+ gint _b_length1 = 0;
-+ gint __b_size_ = 0;
-+ gint _tmp4_ = 0;
-+ gint _tmp5_ = 0;
-+ gint _tmp6_ = 0;
-+ _tmp0_ = a;
-+ _a = (guint8*) _tmp0_;
-+ _a_length1 = -1;
-+ __a_size_ = _a_length1;
-+ _tmp1_ = alen;
-+ _a_length1 = _tmp1_;
-+ _tmp2_ = _a_length1;
-+ _tmp3_ = b;
-+ _b = (guint8*) _tmp3_;
-+ _b_length1 = -1;
-+ __b_size_ = _b_length1;
-+ _tmp4_ = blen;
-+ _b_length1 = _tmp4_;
-+ _tmp5_ = _b_length1;
-+ _tmp6_ = rygel_lms_utf8_collate_str (_a, _a_length1, _b, _b_length1);
-+ result = _tmp6_;
-+ return result;
-+}
-+
-+
-+static void _rygel_lms_database_on_lms_properties_changed_g_dbus_proxy_g_properties_changed (GDBusProxy* _sender, GVariant* changed_properties, gchar** invalidated_properties, gpointer self) {
-+ rygel_lms_database_on_lms_properties_changed ((RygelLMSDatabase*) self, _sender, changed_properties, invalidated_properties, _vala_array_length (invalidated_properties));
-+}
-+
-+
-+static void _rygel_lms_database_utf8_contains_sqlite_user_func_callback (sqlite3_context* context, int values_length1, sqlite3_value** values) {
-+ rygel_lms_database_utf8_contains (context, values, values_length1);
-+}
-+
-+
-+static gint _rygel_lms_database_utf8_collate_sqlite_compare_callback (gpointer self, gint alen, void* a, gint blen, void* b) {
-+ gint result;
-+ result = rygel_lms_database_utf8_collate (alen, a, blen, b);
-+ return result;
-+}
-+
-+
-+RygelLMSDatabase* rygel_lms_database_construct (GType object_type, GError** error) {
-+ RygelLMSDatabase* self = NULL;
-+ gchar* db_path = NULL;
-+ const gchar* _tmp17_ = NULL;
-+ sqlite3* _tmp18_ = NULL;
-+ sqlite3* _tmp19_ = NULL;
-+ gint _tmp20_ = 0;
-+ sqlite3* _tmp25_ = NULL;
-+ sqlite3* _tmp26_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ self = (RygelLMSDatabase*) g_type_create_instance (object_type);
-+ {
-+ RygelLMSDBus* _tmp0_ = NULL;
-+ RygelLMSDBus* _tmp1_ = NULL;
-+ RygelLMSDBus* _tmp2_ = NULL;
-+ RygelLMSDBus* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ RygelLMSDBus* _tmp7_ = NULL;
-+ guint64 _tmp8_ = 0ULL;
-+ guint64 _tmp9_ = 0ULL;
-+ guint64 _tmp10_ = 0ULL;
-+ RygelLMSDBus* _tmp11_ = NULL;
-+ _tmp1_ = g_initable_new (RYGEL_LMS_TYPE_DBUS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.lightmediascanner", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/lightmediascanner/Scanner1", "g-interface-name", "org.lightmediascanner.Scanner1", "g-interface-info", g_type_get_qdata (RYGEL_LMS_TYPE_DBUS, g_quark_from_static_string ("vala-dbus-interface-info")), NULL);
-+ _tmp0_ = (RygelLMSDBus*) _tmp1_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == G_IO_ERROR) {
-+ goto __catch11_g_io_error;
-+ }
-+ _g_free0 (db_path);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _tmp2_ = _tmp0_;
-+ _tmp0_ = NULL;
-+ _g_object_unref0 (self->priv->lms_proxy);
-+ self->priv->lms_proxy = _tmp2_;
-+ _tmp3_ = self->priv->lms_proxy;
-+ _tmp4_ = rygel_lms_dbus_get_data_base_path (_tmp3_);
-+ _tmp5_ = _tmp4_;
-+ _g_free0 (db_path);
-+ db_path = _tmp5_;
-+ _tmp6_ = db_path;
-+ g_debug ("rygel-lms-database.vala:94: Got db path %s from LMS over dbus", _tmp6_);
-+ _tmp7_ = self->priv->lms_proxy;
-+ _tmp8_ = rygel_lms_dbus_get_update_id (_tmp7_);
-+ _tmp9_ = _tmp8_;
-+ self->priv->update_id = _tmp9_;
-+ _tmp10_ = self->priv->update_id;
-+ g_debug ("rygel-lms-database.vala:96: Got updated id %lld from LMS over dbus", _tmp10_);
-+ _tmp11_ = self->priv->lms_proxy;
-+ g_signal_connect ((GDBusProxy*) _tmp11_, "g-properties-changed", (GCallback) _rygel_lms_database_on_lms_properties_changed_g_dbus_proxy_g_properties_changed, self);
-+ _g_object_unref0 (_tmp0_);
-+ }
-+ goto __finally11;
-+ __catch11_g_io_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp12_ = NULL;
-+ const gchar* _tmp13_ = NULL;
-+ const gchar* _tmp14_ = NULL;
-+ gchar* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp12_ = e;
-+ _tmp13_ = _tmp12_->message;
-+ g_warning ("rygel-lms-database.vala:100: Couldn't get LMS Dbus proxy: %s", _tmp13_);
-+ _tmp14_ = g_get_user_config_dir ();
-+ _tmp15_ = g_strconcat (_tmp14_, "/lightmediascannerd/db.sqlite3", NULL);
-+ _g_free0 (db_path);
-+ db_path = _tmp15_;
-+ _tmp16_ = db_path;
-+ g_debug ("rygel-lms-database.vala:103: Using default sqlite database location %s", _tmp16_);
-+ _g_error_free0 (e);
-+ }
-+ __finally11:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _g_free0 (db_path);
-+ _rygel_lms_database_unref0 (self);
-+ return NULL;
-+ } else {
-+ _g_free0 (db_path);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ _tmp17_ = db_path;
-+ sqlite3_open (_tmp17_, &_tmp18_);
-+ _sqlite3_close0 (self->priv->db);
-+ self->priv->db = _tmp18_;
-+ _tmp19_ = self->priv->db;
-+ _tmp20_ = sqlite3_errcode (_tmp19_);
-+ if (_tmp20_ != SQLITE_OK) {
-+ const gchar* _tmp21_ = NULL;
-+ sqlite3* _tmp22_ = NULL;
-+ gint _tmp23_ = 0;
-+ GError* _tmp24_ = NULL;
-+ _tmp21_ = db_path;
-+ _tmp22_ = self->priv->db;
-+ _tmp23_ = sqlite3_errcode (_tmp22_);
-+ _tmp24_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_OPEN, "Failed to open '%s': %d", _tmp21_, _tmp23_);
-+ _inner_error_ = _tmp24_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _g_free0 (db_path);
-+ _rygel_lms_database_unref0 (self);
-+ return NULL;
-+ } else {
-+ _g_free0 (db_path);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ _tmp25_ = self->priv->db;
-+ sqlite3_create_function (_tmp25_, "contains", 2, SQLITE_UTF8, NULL, _rygel_lms_database_utf8_contains_sqlite_user_func_callback, NULL, NULL);
-+ _tmp26_ = self->priv->db;
-+ sqlite3_create_collation (_tmp26_, "CASEFOLD", SQLITE_UTF8, NULL, (int (*)(void *, int, const void *, int, const void *)) _rygel_lms_database_utf8_collate_sqlite_compare_callback);
-+ _g_free0 (db_path);
-+ return self;
-+}
-+
-+
-+RygelLMSDatabase* rygel_lms_database_new (GError** error) {
-+ return rygel_lms_database_construct (RYGEL_LMS_TYPE_DATABASE, error);
-+}
-+
-+
-+static gchar* _variant_get1 (GVariant* value) {
-+ return g_variant_dup_string (value, NULL);
-+}
-+
-+
-+static guint64 _variant_get2 (GVariant* value) {
-+ return g_variant_get_uint64 (value);
-+}
-+
-+
-+static guint64 _variant_get3 (GVariant* value) {
-+ return g_variant_get_uint64 (value);
-+}
-+
-+
-+static void rygel_lms_database_on_lms_properties_changed (RygelLMSDatabase* self, GDBusProxy* lms_proxy, GVariant* changed, gchar** invalidated, int invalidated_length1) {
-+ GVariant* _tmp0_ = NULL;
-+ const GVariantType* _tmp1_ = NULL;
-+ const GVariantType* _tmp2_ = NULL;
-+ gboolean _tmp3_ = FALSE;
-+ g_return_if_fail (self != NULL);
-+ g_return_if_fail (lms_proxy != NULL);
-+ g_return_if_fail (changed != NULL);
-+ _tmp0_ = changed;
-+ _tmp1_ = g_variant_get_type (_tmp0_);
-+ _tmp2_ = G_VARIANT_TYPE_VARDICT;
-+ _tmp3_ = g_variant_type_equal (_tmp1_, _tmp2_);
-+ if (!_tmp3_) {
-+ return;
-+ }
-+ {
-+ GVariantIter* _changed_prop_it = NULL;
-+ GVariant* _tmp4_ = NULL;
-+ GVariantIter* _tmp5_ = NULL;
-+ GVariant* changed_prop = NULL;
-+ _tmp4_ = changed;
-+ _tmp5_ = g_variant_iter_new (_tmp4_);
-+ _changed_prop_it = _tmp5_;
-+ while (TRUE) {
-+ GVariantIter* _tmp6_ = NULL;
-+ GVariant* _tmp7_ = NULL;
-+ GVariant* _tmp8_ = NULL;
-+ gchar* key = NULL;
-+ GVariant* _tmp9_ = NULL;
-+ GVariant* _tmp10_ = NULL;
-+ GVariant* _tmp11_ = NULL;
-+ gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ GVariant* value = NULL;
-+ GVariant* _tmp14_ = NULL;
-+ GVariant* _tmp15_ = NULL;
-+ GVariant* _tmp16_ = NULL;
-+ GVariant* _tmp17_ = NULL;
-+ GVariant* _tmp18_ = NULL;
-+ const gchar* _tmp19_ = NULL;
-+ GVariant* _tmp20_ = NULL;
-+ gchar* _tmp21_ = NULL;
-+ gchar* _tmp22_ = NULL;
-+ const gchar* _tmp23_ = NULL;
-+ const gchar* _tmp24_ = NULL;
-+ GQuark _tmp26_ = 0U;
-+ static GQuark _tmp25_label0 = 0;
-+ _tmp6_ = _changed_prop_it;
-+ _tmp7_ = g_variant_iter_next_value (_tmp6_);
-+ _g_variant_unref0 (changed_prop);
-+ changed_prop = _tmp7_;
-+ _tmp8_ = changed_prop;
-+ if (!(_tmp8_ != NULL)) {
-+ break;
-+ }
-+ _tmp9_ = changed_prop;
-+ _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
-+ _tmp11_ = _tmp10_;
-+ _tmp12_ = _variant_get1 (_tmp11_);
-+ _tmp13_ = _tmp12_;
-+ _g_variant_unref0 (_tmp11_);
-+ key = _tmp13_;
-+ _tmp14_ = changed_prop;
-+ _tmp15_ = g_variant_get_child_value (_tmp14_, (gsize) 1);
-+ _tmp16_ = _tmp15_;
-+ _tmp17_ = g_variant_get_child_value (_tmp16_, (gsize) 0);
-+ _tmp18_ = _tmp17_;
-+ _g_variant_unref0 (_tmp16_);
-+ value = _tmp18_;
-+ _tmp19_ = key;
-+ _tmp20_ = value;
-+ _tmp21_ = g_variant_print (_tmp20_, TRUE);
-+ _tmp22_ = _tmp21_;
-+ g_debug ("rygel-lms-database.vala:138: LMS property %s changed value to %s", _tmp19_, _tmp22_);
-+ _g_free0 (_tmp22_);
-+ _tmp23_ = key;
-+ _tmp24_ = _tmp23_;
-+ _tmp26_ = (NULL == _tmp24_) ? 0 : g_quark_from_string (_tmp24_);
-+ if (_tmp26_ == ((0 != _tmp25_label0) ? _tmp25_label0 : (_tmp25_label0 = g_quark_from_static_string ("UpdateID")))) {
-+ switch (0) {
-+ default:
-+ {
-+ guint64 _tmp27_ = 0ULL;
-+ GVariant* _tmp28_ = NULL;
-+ guint64 _tmp29_ = 0ULL;
-+ GVariant* _tmp30_ = NULL;
-+ guint64 _tmp31_ = 0ULL;
-+ _tmp27_ = self->priv->update_id;
-+ _tmp28_ = value;
-+ _tmp29_ = _variant_get2 (_tmp28_);
-+ g_signal_emit_by_name (self, "db-updated", _tmp27_, _tmp29_);
-+ _tmp30_ = value;
-+ _tmp31_ = _variant_get3 (_tmp30_);
-+ self->priv->update_id = _tmp31_;
-+ break;
-+ }
-+ }
-+ }
-+ _g_variant_unref0 (value);
-+ _g_free0 (key);
-+ }
-+ _g_variant_unref0 (changed_prop);
-+ _g_variant_iter_free0 (_changed_prop_it);
-+ }
-+}
-+
-+
-+sqlite3_stmt* rygel_lms_database_prepare (RygelLMSDatabase* self, const gchar* query_string, GError** error) {
-+ sqlite3_stmt* result = NULL;
-+ sqlite3_stmt* statement = NULL;
-+ gint err = 0;
-+ sqlite3* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ gint _tmp3_ = 0;
-+ gint _tmp4_ = 0;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ g_return_val_if_fail (query_string != NULL, NULL);
-+ _tmp0_ = self->priv->db;
-+ _tmp1_ = query_string;
-+ _tmp3_ = sqlite3_prepare_v2 (_tmp0_, _tmp1_, -1, &_tmp2_, NULL);
-+ _sqlite3_finalize0 (statement);
-+ statement = _tmp2_;
-+ err = _tmp3_;
-+ _tmp4_ = err;
-+ if (_tmp4_ != SQLITE_OK) {
-+ const gchar* _tmp5_ = NULL;
-+ gint _tmp6_ = 0;
-+ GError* _tmp7_ = NULL;
-+ _tmp5_ = query_string;
-+ _tmp6_ = err;
-+ _tmp7_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_PREPARE, "Unable to create statement '%s': %d", _tmp5_, _tmp6_);
-+ _inner_error_ = _tmp7_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ result = statement;
-+ return result;
-+}
-+
-+
-+sqlite3_stmt* rygel_lms_database_prepare_and_init (RygelLMSDatabase* self, const gchar* query, GValue* arguments, int arguments_length1, GError** error) {
-+ sqlite3_stmt* result = NULL;
-+ sqlite3_stmt* statement = NULL;
-+ gint err = 0;
-+ sqlite3* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ gint _tmp3_ = 0;
-+ gint _tmp4_ = 0;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (self != NULL, NULL);
-+ g_return_val_if_fail (query != NULL, NULL);
-+ _tmp0_ = self->priv->db;
-+ _tmp1_ = query;
-+ _tmp3_ = sqlite3_prepare_v2 (_tmp0_, _tmp1_, -1, &_tmp2_, NULL);
-+ _sqlite3_finalize0 (statement);
-+ statement = _tmp2_;
-+ err = _tmp3_;
-+ _tmp4_ = err;
-+ if (_tmp4_ != SQLITE_OK) {
-+ const gchar* _tmp5_ = NULL;
-+ gint _tmp6_ = 0;
-+ GError* _tmp7_ = NULL;
-+ _tmp5_ = query;
-+ _tmp6_ = err;
-+ _tmp7_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_PREPARE, "Unable to create statement '%s': %d", _tmp5_, _tmp6_);
-+ _inner_error_ = _tmp7_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ {
-+ gint i = 0;
-+ i = 1;
-+ {
-+ gboolean _tmp8_ = FALSE;
-+ _tmp8_ = TRUE;
-+ while (TRUE) {
-+ gint _tmp10_ = 0;
-+ GValue* _tmp11_ = NULL;
-+ gint _tmp11__length1 = 0;
-+ gint sqlite_err = 0;
-+ GValue current_value = {0};
-+ GValue* _tmp12_ = NULL;
-+ gint _tmp12__length1 = 0;
-+ gint _tmp13_ = 0;
-+ GValue _tmp14_ = {0};
-+ gboolean _tmp15_ = FALSE;
-+ if (!_tmp8_) {
-+ gint _tmp9_ = 0;
-+ _tmp9_ = i;
-+ i = _tmp9_ + 1;
-+ }
-+ _tmp8_ = FALSE;
-+ _tmp10_ = i;
-+ _tmp11_ = arguments;
-+ _tmp11__length1 = arguments_length1;
-+ if (!(_tmp10_ <= _tmp11__length1)) {
-+ break;
-+ }
-+ _tmp12_ = arguments;
-+ _tmp12__length1 = arguments_length1;
-+ _tmp13_ = i;
-+ _tmp14_ = _tmp12_[_tmp13_ - 1];
-+ current_value = _tmp14_;
-+ _tmp15_ = G_VALUE_HOLDS (&current_value, G_TYPE_INT);
-+ if (_tmp15_) {
-+ sqlite3_stmt* _tmp16_ = NULL;
-+ gint _tmp17_ = 0;
-+ gint _tmp18_ = 0;
-+ gint _tmp19_ = 0;
-+ gint _tmp20_ = 0;
-+ _tmp16_ = statement;
-+ _tmp17_ = i;
-+ _tmp18_ = g_value_get_int (&current_value);
-+ _tmp19_ = sqlite3_bind_int (_tmp16_, _tmp17_, _tmp18_);
-+ sqlite_err = _tmp19_;
-+ _tmp20_ = sqlite_err;
-+ if (_tmp20_ != SQLITE_OK) {
-+ gint _tmp21_ = 0;
-+ GError* _tmp22_ = NULL;
-+ _tmp21_ = sqlite_err;
-+ _tmp22_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp21_);
-+ _inner_error_ = _tmp22_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp23_ = FALSE;
-+ _tmp23_ = G_VALUE_HOLDS (&current_value, G_TYPE_INT64);
-+ if (_tmp23_) {
-+ sqlite3_stmt* _tmp24_ = NULL;
-+ gint _tmp25_ = 0;
-+ gint64 _tmp26_ = 0LL;
-+ gint _tmp27_ = 0;
-+ gint _tmp28_ = 0;
-+ _tmp24_ = statement;
-+ _tmp25_ = i;
-+ _tmp26_ = g_value_get_int64 (&current_value);
-+ _tmp27_ = sqlite3_bind_int64 (_tmp24_, _tmp25_, _tmp26_);
-+ sqlite_err = _tmp27_;
-+ _tmp28_ = sqlite_err;
-+ if (_tmp28_ != SQLITE_OK) {
-+ gint _tmp29_ = 0;
-+ GError* _tmp30_ = NULL;
-+ _tmp29_ = sqlite_err;
-+ _tmp30_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp29_);
-+ _inner_error_ = _tmp30_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp31_ = FALSE;
-+ _tmp31_ = G_VALUE_HOLDS (&current_value, G_TYPE_UINT64);
-+ if (_tmp31_) {
-+ sqlite3_stmt* _tmp32_ = NULL;
-+ gint _tmp33_ = 0;
-+ guint64 _tmp34_ = 0ULL;
-+ gint _tmp35_ = 0;
-+ gint _tmp36_ = 0;
-+ _tmp32_ = statement;
-+ _tmp33_ = i;
-+ _tmp34_ = g_value_get_uint64 (&current_value);
-+ _tmp35_ = sqlite3_bind_int64 (_tmp32_, _tmp33_, (gint64) _tmp34_);
-+ sqlite_err = _tmp35_;
-+ _tmp36_ = sqlite_err;
-+ if (_tmp36_ != SQLITE_OK) {
-+ gint _tmp37_ = 0;
-+ GError* _tmp38_ = NULL;
-+ _tmp37_ = sqlite_err;
-+ _tmp38_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp37_);
-+ _inner_error_ = _tmp38_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp39_ = FALSE;
-+ _tmp39_ = G_VALUE_HOLDS (&current_value, G_TYPE_LONG);
-+ if (_tmp39_) {
-+ sqlite3_stmt* _tmp40_ = NULL;
-+ gint _tmp41_ = 0;
-+ glong _tmp42_ = 0L;
-+ gint _tmp43_ = 0;
-+ gint _tmp44_ = 0;
-+ _tmp40_ = statement;
-+ _tmp41_ = i;
-+ _tmp42_ = g_value_get_long (&current_value);
-+ _tmp43_ = sqlite3_bind_int64 (_tmp40_, _tmp41_, (gint64) _tmp42_);
-+ sqlite_err = _tmp43_;
-+ _tmp44_ = sqlite_err;
-+ if (_tmp44_ != SQLITE_OK) {
-+ gint _tmp45_ = 0;
-+ GError* _tmp46_ = NULL;
-+ _tmp45_ = sqlite_err;
-+ _tmp46_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp45_);
-+ _inner_error_ = _tmp46_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp47_ = FALSE;
-+ _tmp47_ = G_VALUE_HOLDS (&current_value, G_TYPE_UINT);
-+ if (_tmp47_) {
-+ sqlite3_stmt* _tmp48_ = NULL;
-+ gint _tmp49_ = 0;
-+ guint _tmp50_ = 0U;
-+ gint _tmp51_ = 0;
-+ gint _tmp52_ = 0;
-+ _tmp48_ = statement;
-+ _tmp49_ = i;
-+ _tmp50_ = g_value_get_uint (&current_value);
-+ _tmp51_ = sqlite3_bind_int64 (_tmp48_, _tmp49_, (gint64) _tmp50_);
-+ sqlite_err = _tmp51_;
-+ _tmp52_ = sqlite_err;
-+ if (_tmp52_ != SQLITE_OK) {
-+ gint _tmp53_ = 0;
-+ GError* _tmp54_ = NULL;
-+ _tmp53_ = sqlite_err;
-+ _tmp54_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp53_);
-+ _inner_error_ = _tmp54_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp55_ = FALSE;
-+ _tmp55_ = G_VALUE_HOLDS (&current_value, G_TYPE_STRING);
-+ if (_tmp55_) {
-+ sqlite3_stmt* _tmp56_ = NULL;
-+ gint _tmp57_ = 0;
-+ const gchar* _tmp58_ = NULL;
-+ gchar* _tmp59_ = NULL;
-+ GDestroyNotify _tmp60_ = NULL;
-+ gint _tmp61_ = 0;
-+ gint _tmp62_ = 0;
-+ _tmp56_ = statement;
-+ _tmp57_ = i;
-+ _tmp58_ = g_value_get_string (&current_value);
-+ _tmp59_ = g_strdup (_tmp58_);
-+ _tmp60_ = g_free;
-+ _tmp61_ = sqlite3_bind_text (_tmp56_, _tmp57_, _tmp59_, -1, _tmp60_);
-+ sqlite_err = _tmp61_;
-+ _tmp62_ = sqlite_err;
-+ if (_tmp62_ != SQLITE_OK) {
-+ gint _tmp63_ = 0;
-+ GError* _tmp64_ = NULL;
-+ _tmp63_ = sqlite_err;
-+ _tmp64_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp63_);
-+ _inner_error_ = _tmp64_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ gboolean _tmp65_ = FALSE;
-+ _tmp65_ = G_VALUE_HOLDS (&current_value, G_TYPE_POINTER);
-+ if (_tmp65_) {
-+ void* _tmp66_ = NULL;
-+ _tmp66_ = g_value_peek_pointer (&current_value);
-+ if (_tmp66_ == NULL) {
-+ sqlite3_stmt* _tmp67_ = NULL;
-+ gint _tmp68_ = 0;
-+ gint _tmp69_ = 0;
-+ gint _tmp70_ = 0;
-+ _tmp67_ = statement;
-+ _tmp68_ = i;
-+ _tmp69_ = sqlite3_bind_null (_tmp67_, _tmp68_);
-+ sqlite_err = _tmp69_;
-+ _tmp70_ = sqlite_err;
-+ if (_tmp70_ != SQLITE_OK) {
-+ gint _tmp71_ = 0;
-+ GError* _tmp72_ = NULL;
-+ _tmp71_ = sqlite_err;
-+ _tmp72_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind value %d", _tmp71_);
-+ _inner_error_ = _tmp72_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ _sqlite3_finalize0 (statement);
-+ return NULL;
-+ } else {
-+ _sqlite3_finalize0 (statement);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ }
-+ } else {
-+ g_assert_not_reached ();
-+ }
-+ } else {
-+ GType type = 0UL;
-+ GType _tmp73_ = 0UL;
-+ const gchar* _tmp74_ = NULL;
-+ const gchar* _tmp75_ = NULL;
-+ _tmp73_ = G_VALUE_TYPE (&current_value);
-+ type = _tmp73_;
-+ _tmp74_ = _ ("Unsupported type %s");
-+ _tmp75_ = g_type_name (type);
-+ g_warning (_tmp74_, _tmp75_);
-+ g_assert_not_reached ();
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ result = statement;
-+ return result;
-+}
-+
-+
-+void rygel_lms_database_find_object (const gchar* id, sqlite3_stmt* stmt, GError** error) {
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint integer_id = 0;
-+ const gchar* _tmp2_ = NULL;
-+ gint _tmp3_ = 0;
-+ gint sqlite_err = 0;
-+ sqlite3_stmt* _tmp4_ = NULL;
-+ gint _tmp5_ = 0;
-+ gint _tmp6_ = 0;
-+ gint _tmp7_ = 0;
-+ sqlite3_stmt* _tmp10_ = NULL;
-+ gint _tmp11_ = 0;
-+ gint _tmp12_ = 0;
-+ GError * _inner_error_ = NULL;
-+ g_return_if_fail (id != NULL);
-+ g_return_if_fail (stmt != NULL);
-+ _tmp0_ = stmt;
-+ _tmp1_ = sqlite3_reset (_tmp0_);
-+ _tmp2_ = id;
-+ _tmp3_ = atoi (_tmp2_);
-+ integer_id = _tmp3_;
-+ _tmp4_ = stmt;
-+ _tmp5_ = integer_id;
-+ _tmp6_ = sqlite3_bind_int (_tmp4_, 1, _tmp5_);
-+ sqlite_err = _tmp6_;
-+ _tmp7_ = sqlite_err;
-+ if (_tmp7_ != SQLITE_OK) {
-+ gint _tmp8_ = 0;
-+ GError* _tmp9_ = NULL;
-+ _tmp8_ = sqlite_err;
-+ _tmp9_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind id %d", _tmp8_);
-+ _inner_error_ = _tmp9_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+ _tmp10_ = stmt;
-+ _tmp11_ = sqlite3_step (_tmp10_);
-+ sqlite_err = _tmp11_;
-+ _tmp12_ = sqlite_err;
-+ if (_tmp12_ != SQLITE_ROW) {
-+ const gchar* _tmp13_ = NULL;
-+ GError* _tmp14_ = NULL;
-+ _tmp13_ = id;
-+ _tmp14_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_STEP, "Unable to find id %s", _tmp13_);
-+ _inner_error_ = _tmp14_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+}
-+
-+
-+void rygel_lms_database_get_children_init (sqlite3_stmt* stmt, guint offset, guint max_count, const gchar* sort_criteria, GError** error) {
-+ gint sqlite_err = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ guint _tmp3_ = 0U;
-+ gint _tmp4_ = 0;
-+ gint _tmp5_ = 0;
-+ sqlite3_stmt* _tmp8_ = NULL;
-+ guint _tmp9_ = 0U;
-+ gint _tmp10_ = 0;
-+ gint _tmp11_ = 0;
-+ GError * _inner_error_ = NULL;
-+ g_return_if_fail (stmt != NULL);
-+ g_return_if_fail (sort_criteria != NULL);
-+ _tmp0_ = stmt;
-+ _tmp1_ = sqlite3_reset (_tmp0_);
-+ _tmp2_ = stmt;
-+ _tmp3_ = max_count;
-+ _tmp4_ = sqlite3_bind_int (_tmp2_, 1, (gint) _tmp3_);
-+ sqlite_err = _tmp4_;
-+ _tmp5_ = sqlite_err;
-+ if (_tmp5_ != SQLITE_OK) {
-+ gint _tmp6_ = 0;
-+ GError* _tmp7_ = NULL;
-+ _tmp6_ = sqlite_err;
-+ _tmp7_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind max_count %d", _tmp6_);
-+ _inner_error_ = _tmp7_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+ _tmp8_ = stmt;
-+ _tmp9_ = offset;
-+ _tmp10_ = sqlite3_bind_int (_tmp8_, 2, (gint) _tmp9_);
-+ sqlite_err = _tmp10_;
-+ _tmp11_ = sqlite_err;
-+ if (_tmp11_ != SQLITE_OK) {
-+ gint _tmp12_ = 0;
-+ GError* _tmp13_ = NULL;
-+ _tmp12_ = sqlite_err;
-+ _tmp13_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind offset %d", _tmp12_);
-+ _inner_error_ = _tmp13_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+}
-+
-+
-+void rygel_lms_database_get_children_with_update_id_init (sqlite3_stmt* stmt, guint64 old_id, guint64 new_id, GError** error) {
-+ gint sqlite_err = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ guint64 _tmp2_ = 0ULL;
-+ guint64 _tmp3_ = 0ULL;
-+ gint _tmp9_ = 0;
-+ sqlite3_stmt* _tmp12_ = NULL;
-+ guint64 _tmp13_ = 0ULL;
-+ gint _tmp14_ = 0;
-+ gint _tmp15_ = 0;
-+ GError * _inner_error_ = NULL;
-+ g_return_if_fail (stmt != NULL);
-+ _tmp0_ = stmt;
-+ _tmp1_ = sqlite3_reset (_tmp0_);
-+ _tmp2_ = new_id;
-+ _tmp3_ = old_id;
-+ if (_tmp2_ < _tmp3_) {
-+ sqlite3_stmt* _tmp4_ = NULL;
-+ gint _tmp5_ = 0;
-+ _tmp4_ = stmt;
-+ _tmp5_ = sqlite3_bind_int64 (_tmp4_, 1, (gint64) 0);
-+ sqlite_err = _tmp5_;
-+ } else {
-+ sqlite3_stmt* _tmp6_ = NULL;
-+ guint64 _tmp7_ = 0ULL;
-+ gint _tmp8_ = 0;
-+ _tmp6_ = stmt;
-+ _tmp7_ = old_id;
-+ _tmp8_ = sqlite3_bind_int64 (_tmp6_, 1, (gint64) _tmp7_);
-+ sqlite_err = _tmp8_;
-+ }
-+ _tmp9_ = sqlite_err;
-+ if (_tmp9_ != SQLITE_OK) {
-+ gint _tmp10_ = 0;
-+ GError* _tmp11_ = NULL;
-+ _tmp10_ = sqlite_err;
-+ _tmp11_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind old_id %d", _tmp10_);
-+ _inner_error_ = _tmp11_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+ _tmp12_ = stmt;
-+ _tmp13_ = new_id;
-+ _tmp14_ = sqlite3_bind_int64 (_tmp12_, 2, (gint64) _tmp13_);
-+ sqlite_err = _tmp14_;
-+ _tmp15_ = sqlite_err;
-+ if (_tmp15_ != SQLITE_OK) {
-+ gint _tmp16_ = 0;
-+ GError* _tmp17_ = NULL;
-+ _tmp16_ = sqlite_err;
-+ _tmp17_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_BIND, "Unable to bind new_id %d", _tmp16_);
-+ _inner_error_ = _tmp17_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return;
-+ }
-+ }
-+}
-+
-+
-+gboolean rygel_lms_database_get_children_step (sqlite3_stmt* stmt, GError** error) {
-+ gboolean result = FALSE;
-+ gboolean retval = FALSE;
-+ gint sqlite_err = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gint _tmp2_ = 0;
-+ gboolean _tmp3_ = FALSE;
-+ gboolean _tmp4_ = FALSE;
-+ GError * _inner_error_ = NULL;
-+ g_return_val_if_fail (stmt != NULL, FALSE);
-+ _tmp0_ = stmt;
-+ _tmp1_ = sqlite3_step (_tmp0_);
-+ sqlite_err = _tmp1_;
-+ _tmp2_ = sqlite_err;
-+ retval = _tmp2_ == SQLITE_ROW;
-+ _tmp4_ = retval;
-+ if (!_tmp4_) {
-+ gint _tmp5_ = 0;
-+ _tmp5_ = sqlite_err;
-+ _tmp3_ = _tmp5_ != SQLITE_DONE;
-+ } else {
-+ _tmp3_ = FALSE;
-+ }
-+ if (_tmp3_) {
-+ gint _tmp6_ = 0;
-+ GError* _tmp7_ = NULL;
-+ _tmp6_ = sqlite_err;
-+ _tmp7_ = g_error_new (RYGEL_LMS_DATABASE_ERROR, RYGEL_LMS_DATABASE_ERROR_STEP, "Error iterating through rows %d", _tmp6_);
-+ _inner_error_ = _tmp7_;
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ g_propagate_error (error, _inner_error_);
-+ return FALSE;
-+ } else {
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return FALSE;
-+ }
-+ }
-+ result = retval;
-+ return result;
-+}
-+
-+
-+static void g_cclosure_user_marshal_VOID__UINT64_UINT64 (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
-+ typedef void (*GMarshalFunc_VOID__UINT64_UINT64) (gpointer data1, guint64 arg_1, guint64 arg_2, gpointer data2);
-+ register GMarshalFunc_VOID__UINT64_UINT64 callback;
-+ register GCClosure * cc;
-+ register gpointer data1;
-+ register gpointer data2;
-+ cc = (GCClosure *) closure;
-+ g_return_if_fail (n_param_values == 3);
-+ if (G_CCLOSURE_SWAP_DATA (closure)) {
-+ data1 = closure->data;
-+ data2 = param_values->data[0].v_pointer;
-+ } else {
-+ data1 = param_values->data[0].v_pointer;
-+ data2 = closure->data;
-+ }
-+ callback = (GMarshalFunc_VOID__UINT64_UINT64) (marshal_data ? marshal_data : cc->callback);
-+ callback (data1, g_value_get_uint64 (param_values + 1), g_value_get_uint64 (param_values + 2), data2);
-+}
-+
-+
-+static void rygel_lms_value_database_init (GValue* value) {
-+ value->data[0].v_pointer = NULL;
-+}
-+
-+
-+static void rygel_lms_value_database_free_value (GValue* value) {
-+ if (value->data[0].v_pointer) {
-+ rygel_lms_database_unref (value->data[0].v_pointer);
-+ }
-+}
-+
-+
-+static void rygel_lms_value_database_copy_value (const GValue* src_value, GValue* dest_value) {
-+ if (src_value->data[0].v_pointer) {
-+ dest_value->data[0].v_pointer = rygel_lms_database_ref (src_value->data[0].v_pointer);
-+ } else {
-+ dest_value->data[0].v_pointer = NULL;
-+ }
-+}
-+
-+
-+static gpointer rygel_lms_value_database_peek_pointer (const GValue* value) {
-+ return value->data[0].v_pointer;
-+}
-+
-+
-+static gchar* rygel_lms_value_database_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-+ if (collect_values[0].v_pointer) {
-+ RygelLMSDatabase* object;
-+ object = collect_values[0].v_pointer;
-+ if (object->parent_instance.g_class == NULL) {
-+ return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-+ } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
-+ return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-+ }
-+ value->data[0].v_pointer = rygel_lms_database_ref (object);
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ return NULL;
-+}
-+
-+
-+static gchar* rygel_lms_value_database_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-+ RygelLMSDatabase** object_p;
-+ object_p = collect_values[0].v_pointer;
-+ if (!object_p) {
-+ return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
-+ }
-+ if (!value->data[0].v_pointer) {
-+ *object_p = NULL;
-+ } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-+ *object_p = value->data[0].v_pointer;
-+ } else {
-+ *object_p = rygel_lms_database_ref (value->data[0].v_pointer);
-+ }
-+ return NULL;
-+}
-+
-+
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
-+ RygelLMSParamSpecDatabase* spec;
-+ g_return_val_if_fail (g_type_is_a (object_type, RYGEL_LMS_TYPE_DATABASE), NULL);
-+ spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
-+ G_PARAM_SPEC (spec)->value_type = object_type;
-+ return G_PARAM_SPEC (spec);
-+}
-+
-+
-+gpointer rygel_lms_value_get_database (const GValue* value) {
-+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_DATABASE), NULL);
-+ return value->data[0].v_pointer;
-+}
-+
-+
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object) {
-+ RygelLMSDatabase* old;
-+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_DATABASE));
-+ old = value->data[0].v_pointer;
-+ if (v_object) {
-+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_LMS_TYPE_DATABASE));
-+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-+ value->data[0].v_pointer = v_object;
-+ rygel_lms_database_ref (value->data[0].v_pointer);
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ if (old) {
-+ rygel_lms_database_unref (old);
-+ }
-+}
-+
-+
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object) {
-+ RygelLMSDatabase* old;
-+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_DATABASE));
-+ old = value->data[0].v_pointer;
-+ if (v_object) {
-+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_LMS_TYPE_DATABASE));
-+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-+ value->data[0].v_pointer = v_object;
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ if (old) {
-+ rygel_lms_database_unref (old);
-+ }
-+}
-+
-+
-+static void rygel_lms_database_class_init (RygelLMSDatabaseClass * klass) {
-+ rygel_lms_database_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSDatabaseClass *) klass)->finalize = rygel_lms_database_finalize;
-+ g_type_class_add_private (klass, sizeof (RygelLMSDatabasePrivate));
-+ g_signal_new ("db_updated", RYGEL_LMS_TYPE_DATABASE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__UINT64_UINT64, G_TYPE_NONE, 2, G_TYPE_UINT64, G_TYPE_UINT64);
-+}
-+
-+
-+static void rygel_lms_database_instance_init (RygelLMSDatabase * self) {
-+ self->priv = RYGEL_LMS_DATABASE_GET_PRIVATE (self);
-+ self->ref_count = 1;
-+}
-+
-+
-+static void rygel_lms_database_finalize (RygelLMSDatabase* obj) {
-+ RygelLMSDatabase * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase);
-+ g_signal_handlers_destroy (self);
-+ _sqlite3_close0 (self->priv->db);
-+ _g_object_unref0 (self->priv->lms_proxy);
-+}
-+
-+
-+GType rygel_lms_database_get_type (void) {
-+ static volatile gsize rygel_lms_database_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_database_type_id__volatile)) {
-+ static const GTypeValueTable g_define_type_value_table = { rygel_lms_value_database_init, rygel_lms_value_database_free_value, rygel_lms_value_database_copy_value, rygel_lms_value_database_peek_pointer, "p", rygel_lms_value_database_collect_value, "p", rygel_lms_value_database_lcopy_value };
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSDatabaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_database_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSDatabase), 0, (GInstanceInitFunc) rygel_lms_database_instance_init, &g_define_type_value_table };
-+ static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
-+ GType rygel_lms_database_type_id;
-+ rygel_lms_database_type_id = g_type_register_fundamental (g_type_fundamental_next (), "RygelLMSDatabase", &g_define_type_info, &g_define_type_fundamental_info, 0);
-+ g_once_init_leave (&rygel_lms_database_type_id__volatile, rygel_lms_database_type_id);
-+ }
-+ return rygel_lms_database_type_id__volatile;
-+}
-+
-+
-+gpointer rygel_lms_database_ref (gpointer instance) {
-+ RygelLMSDatabase* self;
-+ self = instance;
-+ g_atomic_int_inc (&self->ref_count);
-+ return instance;
-+}
-+
-+
-+void rygel_lms_database_unref (gpointer instance) {
-+ RygelLMSDatabase* self;
-+ self = instance;
-+ if (g_atomic_int_dec_and_test (&self->ref_count)) {
-+ RYGEL_LMS_DATABASE_GET_CLASS (self)->finalize (self);
-+ g_type_free_instance ((GTypeInstance *) self);
-+ }
-+}
-+
-+
-+static gint _vala_array_length (gpointer array) {
-+ int length;
-+ length = 0;
-+ if (array) {
-+ while (((gpointer*) array)[length]) {
-+ length++;
-+ }
-+ }
-+ return length;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-dbus-interfaces.c b/src/plugins/lms/rygel-lms-dbus-interfaces.c
-new file mode 100644
-index 0000000..b511b17
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-dbus-interfaces.c
-@@ -0,0 +1,261 @@
-+/* rygel-lms-dbus-interfaces.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-dbus-interfaces.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2014 Intel Corporation.
-+ *
-+ * Author: Alexander Kanavin <alex.kanavin@gmail.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <gio/gio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+
-+#define RYGEL_LMS_TYPE_DBUS (rygel_lms_dbus_get_type ())
-+#define RYGEL_LMS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBus))
-+#define RYGEL_LMS_IS_DBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DBUS))
-+#define RYGEL_LMS_DBUS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_LMS_TYPE_DBUS, RygelLMSDBusIface))
-+
-+typedef struct _RygelLMSDBus RygelLMSDBus;
-+typedef struct _RygelLMSDBusIface RygelLMSDBusIface;
-+
-+#define RYGEL_LMS_TYPE_DBUS_PROXY (rygel_lms_dbus_proxy_get_type ())
-+typedef GDBusProxy RygelLMSDBusProxy;
-+typedef GDBusProxyClass RygelLMSDBusProxyClass;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+struct _RygelLMSDBusIface {
-+ GTypeInterface parent_iface;
-+ gchar* (*get_data_base_path) (RygelLMSDBus* self);
-+ guint64 (*get_update_id) (RygelLMSDBus* self);
-+};
-+
-+
-+
-+GType rygel_lms_dbus_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_dbus_proxy_get_type (void) G_GNUC_CONST;
-+guint rygel_lms_dbus_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
-+gchar* rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self);
-+guint64 rygel_lms_dbus_get_update_id (RygelLMSDBus* self);
-+static void rygel_lms_dbus_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
-+static gchar* rygel_lms_dbus_dbus_proxy_get_data_base_path (RygelLMSDBus* self);
-+static guint64 rygel_lms_dbus_dbus_proxy_get_update_id (RygelLMSDBus* self);
-+static void rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init (RygelLMSDBusIface* iface);
-+static void rygel_lms_dbus_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
-+static GVariant* rygel_lms_dbus_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
-+static GVariant* _dbus_rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self);
-+static GVariant* _dbus_rygel_lms_dbus_get_update_id (RygelLMSDBus* self);
-+static gboolean rygel_lms_dbus_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
-+static void _rygel_lms_dbus_unregister_object (gpointer user_data);
-+
-+static const GDBusMethodInfo * const _rygel_lms_dbus_dbus_method_info[] = {NULL};
-+static const GDBusSignalInfo * const _rygel_lms_dbus_dbus_signal_info[] = {NULL};
-+static const GDBusPropertyInfo _rygel_lms_dbus_dbus_property_info_data_base_path = {-1, "DataBasePath", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
-+static const GDBusPropertyInfo _rygel_lms_dbus_dbus_property_info_update_id = {-1, "UpdateID", "t", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
-+static const GDBusPropertyInfo * const _rygel_lms_dbus_dbus_property_info[] = {&_rygel_lms_dbus_dbus_property_info_data_base_path, &_rygel_lms_dbus_dbus_property_info_update_id, NULL};
-+static const GDBusInterfaceInfo _rygel_lms_dbus_dbus_interface_info = {-1, "org.lightmediascanner.Scanner1", (GDBusMethodInfo **) (&_rygel_lms_dbus_dbus_method_info), (GDBusSignalInfo **) (&_rygel_lms_dbus_dbus_signal_info), (GDBusPropertyInfo **) (&_rygel_lms_dbus_dbus_property_info)};
-+static const GDBusInterfaceVTable _rygel_lms_dbus_dbus_interface_vtable = {rygel_lms_dbus_dbus_interface_method_call, rygel_lms_dbus_dbus_interface_get_property, rygel_lms_dbus_dbus_interface_set_property};
-+
-+gchar* rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_DBUS_GET_INTERFACE (self)->get_data_base_path (self);
-+}
-+
-+
-+guint64 rygel_lms_dbus_get_update_id (RygelLMSDBus* self) {
-+ g_return_val_if_fail (self != NULL, 0ULL);
-+ return RYGEL_LMS_DBUS_GET_INTERFACE (self)->get_update_id (self);
-+}
-+
-+
-+static void rygel_lms_dbus_base_init (RygelLMSDBusIface * iface) {
-+ static gboolean initialized = FALSE;
-+ if (!initialized) {
-+ initialized = TRUE;
-+ }
-+}
-+
-+
-+GType rygel_lms_dbus_get_type (void) {
-+ static volatile gsize rygel_lms_dbus_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_dbus_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSDBusIface), (GBaseInitFunc) rygel_lms_dbus_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
-+ GType rygel_lms_dbus_type_id;
-+ rygel_lms_dbus_type_id = g_type_register_static (G_TYPE_INTERFACE, "RygelLMSDBus", &g_define_type_info, 0);
-+ g_type_interface_add_prerequisite (rygel_lms_dbus_type_id, G_TYPE_DBUS_PROXY);
-+ g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) rygel_lms_dbus_proxy_get_type);
-+ g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.lightmediascanner.Scanner1");
-+ g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_rygel_lms_dbus_dbus_interface_info));
-+ g_type_set_qdata (rygel_lms_dbus_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) rygel_lms_dbus_register_object);
-+ g_once_init_leave (&rygel_lms_dbus_type_id__volatile, rygel_lms_dbus_type_id);
-+ }
-+ return rygel_lms_dbus_type_id__volatile;
-+}
-+
-+
-+G_DEFINE_TYPE_EXTENDED (RygelLMSDBusProxy, rygel_lms_dbus_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (RYGEL_LMS_TYPE_DBUS, rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init) )
-+static void rygel_lms_dbus_proxy_class_init (RygelLMSDBusProxyClass* klass) {
-+ G_DBUS_PROXY_CLASS (klass)->g_signal = rygel_lms_dbus_proxy_g_signal;
-+}
-+
-+
-+static void rygel_lms_dbus_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
-+}
-+
-+
-+static void rygel_lms_dbus_proxy_init (RygelLMSDBusProxy* self) {
-+}
-+
-+
-+static gchar* rygel_lms_dbus_dbus_proxy_get_data_base_path (RygelLMSDBus* self) {
-+ GVariant *_inner_reply;
-+ gchar* _result;
-+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DataBasePath");
-+ if (!_inner_reply) {
-+ GVariant *_arguments;
-+ GVariant *_reply;
-+ GVariantBuilder _arguments_builder;
-+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
-+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.lightmediascanner.Scanner1"));
-+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DataBasePath"));
-+ _arguments = g_variant_builder_end (&_arguments_builder);
-+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
-+ if (!_reply) {
-+ return NULL;
-+ }
-+ g_variant_get (_reply, "(v)", &_inner_reply);
-+ g_variant_unref (_reply);
-+ }
-+ _result = g_variant_dup_string (_inner_reply, NULL);
-+ g_variant_unref (_inner_reply);
-+ return _result;
-+}
-+
-+
-+static guint64 rygel_lms_dbus_dbus_proxy_get_update_id (RygelLMSDBus* self) {
-+ GVariant *_inner_reply;
-+ guint64 _result;
-+ _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "UpdateID");
-+ if (!_inner_reply) {
-+ GVariant *_arguments;
-+ GVariant *_reply;
-+ GVariantBuilder _arguments_builder;
-+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
-+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.lightmediascanner.Scanner1"));
-+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("UpdateID"));
-+ _arguments = g_variant_builder_end (&_arguments_builder);
-+ _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
-+ if (!_reply) {
-+ return 0ULL;
-+ }
-+ g_variant_get (_reply, "(v)", &_inner_reply);
-+ g_variant_unref (_reply);
-+ }
-+ _result = g_variant_get_uint64 (_inner_reply);
-+ g_variant_unref (_inner_reply);
-+ return _result;
-+}
-+
-+
-+static void rygel_lms_dbus_proxy_rygel_lms_dbus_interface_init (RygelLMSDBusIface* iface) {
-+ iface->get_data_base_path = rygel_lms_dbus_dbus_proxy_get_data_base_path;
-+ iface->get_update_id = rygel_lms_dbus_dbus_proxy_get_update_id;
-+}
-+
-+
-+static void rygel_lms_dbus_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
-+ gpointer* data;
-+ gpointer object;
-+ data = user_data;
-+ object = data[0];
-+ g_object_unref (invocation);
-+}
-+
-+
-+static GVariant* _dbus_rygel_lms_dbus_get_data_base_path (RygelLMSDBus* self) {
-+ gchar* result;
-+ GVariant* _reply;
-+ result = rygel_lms_dbus_get_data_base_path (self);
-+ _reply = g_variant_new_string (result);
-+ _g_free0 (result);
-+ return _reply;
-+}
-+
-+
-+static GVariant* _dbus_rygel_lms_dbus_get_update_id (RygelLMSDBus* self) {
-+ guint64 result;
-+ GVariant* _reply;
-+ result = rygel_lms_dbus_get_update_id (self);
-+ _reply = g_variant_new_uint64 (result);
-+ return _reply;
-+}
-+
-+
-+static GVariant* rygel_lms_dbus_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
-+ gpointer* data;
-+ gpointer object;
-+ data = user_data;
-+ object = data[0];
-+ if (strcmp (property_name, "DataBasePath") == 0) {
-+ return _dbus_rygel_lms_dbus_get_data_base_path (object);
-+ } else if (strcmp (property_name, "UpdateID") == 0) {
-+ return _dbus_rygel_lms_dbus_get_update_id (object);
-+ }
-+ return NULL;
-+}
-+
-+
-+static gboolean rygel_lms_dbus_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
-+ gpointer* data;
-+ gpointer object;
-+ data = user_data;
-+ object = data[0];
-+ return FALSE;
-+}
-+
-+
-+guint rygel_lms_dbus_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
-+ guint result;
-+ gpointer *data;
-+ data = g_new (gpointer, 3);
-+ data[0] = g_object_ref (object);
-+ data[1] = g_object_ref (connection);
-+ data[2] = g_strdup (path);
-+ result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_rygel_lms_dbus_dbus_interface_info), &_rygel_lms_dbus_dbus_interface_vtable, data, _rygel_lms_dbus_unregister_object, error);
-+ if (!result) {
-+ return 0;
-+ }
-+ return result;
-+}
-+
-+
-+static void _rygel_lms_dbus_unregister_object (gpointer user_data) {
-+ gpointer* data;
-+ data = user_data;
-+ g_object_unref (data[0]);
-+ g_object_unref (data[1]);
-+ g_free (data[2]);
-+ g_free (data);
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-image-root.c b/src/plugins/lms/rygel-lms-image-root.c
-new file mode 100644
-index 0000000..5ef358a
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-root.c
-@@ -0,0 +1,178 @@
-+/* rygel-lms-image-root.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-image-root.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+
-+#define RYGEL_LMS_TYPE_IMAGE_ROOT (rygel_lms_image_root_get_type ())
-+#define RYGEL_LMS_IMAGE_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRoot))
-+#define RYGEL_LMS_IMAGE_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRootClass))
-+#define RYGEL_LMS_IS_IMAGE_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT))
-+#define RYGEL_LMS_IS_IMAGE_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_ROOT))
-+#define RYGEL_LMS_IMAGE_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRootClass))
-+
-+typedef struct _RygelLMSImageRoot RygelLMSImageRoot;
-+typedef struct _RygelLMSImageRootClass RygelLMSImageRootClass;
-+typedef struct _RygelLMSImageRootPrivate RygelLMSImageRootPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+
-+#define RYGEL_LMS_TYPE_ALL_IMAGES (rygel_lms_all_images_get_type ())
-+#define RYGEL_LMS_ALL_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImages))
-+#define RYGEL_LMS_ALL_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImagesClass))
-+#define RYGEL_LMS_IS_ALL_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_IMAGES))
-+#define RYGEL_LMS_IS_ALL_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_IMAGES))
-+#define RYGEL_LMS_ALL_IMAGES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_IMAGES, RygelLMSAllImagesClass))
-+
-+typedef struct _RygelLMSAllImages RygelLMSAllImages;
-+typedef struct _RygelLMSAllImagesClass RygelLMSAllImagesClass;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_IMAGE_YEARS (rygel_lms_image_years_get_type ())
-+#define RYGEL_LMS_IMAGE_YEARS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYears))
-+#define RYGEL_LMS_IMAGE_YEARS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYearsClass))
-+#define RYGEL_LMS_IS_IMAGE_YEARS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS))
-+#define RYGEL_LMS_IS_IMAGE_YEARS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_YEARS))
-+#define RYGEL_LMS_IMAGE_YEARS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYearsClass))
-+
-+typedef struct _RygelLMSImageYears RygelLMSImageYears;
-+typedef struct _RygelLMSImageYearsClass RygelLMSImageYearsClass;
-+
-+struct _RygelLMSImageRoot {
-+ RygelSimpleContainer parent_instance;
-+ RygelLMSImageRootPrivate * priv;
-+};
-+
-+struct _RygelLMSImageRootClass {
-+ RygelSimpleContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_image_root_parent_class = NULL;
-+
-+GType rygel_lms_image_root_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_IMAGE_ROOT_DUMMY_PROPERTY
-+};
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSImageRoot* rygel_lms_image_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSImageRoot* rygel_lms_image_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAllImages* rygel_lms_all_images_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAllImages* rygel_lms_all_images_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_images_get_type (void) G_GNUC_CONST;
-+RygelLMSImageYears* rygel_lms_image_years_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSImageYears* rygel_lms_image_years_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+GType rygel_lms_image_years_get_type (void) G_GNUC_CONST;
-+
-+
-+RygelLMSImageRoot* rygel_lms_image_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSImageRoot * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ RygelLMSAllImages* _tmp4_ = NULL;
-+ RygelLMSAllImages* _tmp5_ = NULL;
-+ RygelLMSDatabase* _tmp6_ = NULL;
-+ RygelLMSImageYears* _tmp7_ = NULL;
-+ RygelLMSImageYears* _tmp8_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ self = (RygelLMSImageRoot*) rygel_simple_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
-+ _tmp3_ = lms_db;
-+ _tmp4_ = rygel_lms_all_images_new ((RygelMediaContainer*) self, _tmp3_);
-+ _tmp5_ = _tmp4_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp5_);
-+ _g_object_unref0 (_tmp5_);
-+ _tmp6_ = lms_db;
-+ _tmp7_ = rygel_lms_image_years_new ((RygelMediaContainer*) self, _tmp6_);
-+ _tmp8_ = _tmp7_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp8_);
-+ _g_object_unref0 (_tmp8_);
-+ return self;
-+}
-+
-+
-+RygelLMSImageRoot* rygel_lms_image_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_image_root_construct (RYGEL_LMS_TYPE_IMAGE_ROOT, id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_image_root_class_init (RygelLMSImageRootClass * klass) {
-+ rygel_lms_image_root_parent_class = g_type_class_peek_parent (klass);
-+}
-+
-+
-+static void rygel_lms_image_root_instance_init (RygelLMSImageRoot * self) {
-+}
-+
-+
-+GType rygel_lms_image_root_get_type (void) {
-+ static volatile gsize rygel_lms_image_root_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_image_root_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSImageRootClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_image_root_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSImageRoot), 0, (GInstanceInitFunc) rygel_lms_image_root_instance_init, NULL };
-+ GType rygel_lms_image_root_type_id;
-+ rygel_lms_image_root_type_id = g_type_register_static (RYGEL_TYPE_SIMPLE_CONTAINER, "RygelLMSImageRoot", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_image_root_type_id__volatile, rygel_lms_image_root_type_id);
-+ }
-+ return rygel_lms_image_root_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-image-year.c b/src/plugins/lms/rygel-lms-image-year.c
-new file mode 100644
-index 0000000..5eb2721
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-year.c
-@@ -0,0 +1,422 @@
-+/* rygel-lms-image-year.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-image-year.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <gio/gio.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_IMAGE_YEAR (rygel_lms_image_year_get_type ())
-+#define RYGEL_LMS_IMAGE_YEAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYear))
-+#define RYGEL_LMS_IMAGE_YEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYearClass))
-+#define RYGEL_LMS_IS_IMAGE_YEAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR))
-+#define RYGEL_LMS_IS_IMAGE_YEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_YEAR))
-+#define RYGEL_LMS_IMAGE_YEAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYearClass))
-+
-+typedef struct _RygelLMSImageYear RygelLMSImageYear;
-+typedef struct _RygelLMSImageYearClass RygelLMSImageYearClass;
-+typedef struct _RygelLMSImageYearPrivate RygelLMSImageYearPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSImageYear {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSImageYearPrivate * priv;
-+};
-+
-+struct _RygelLMSImageYearClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_image_year_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_image_year_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_IMAGE_YEAR_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_IMAGE_YEAR_SQL_ALL_TEMPLATE "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_IMAGE_YEAR_SQL_COUNT_TEMPLATE "SELECT count(images.id), strftime('%Y', date, 'unixepoch') as year " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id AND year = '%s';"
-+#define RYGEL_LMS_IMAGE_YEAR_SQL_FIND_OBJECT_TEMPLATE "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " "FROM images, files " "WHERE dtime = 0 AND files.id = ? AND images.id = files.id AND year = '" \
-+"%s';"
-+#define RYGEL_LMS_IMAGE_YEAR_SQL_ADDED_TEMPLATE "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " "FROM images, files " "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " "AND update_id > ? AND update_id <= ?;"
-+#define RYGEL_LMS_IMAGE_YEAR_SQL_REMOVED_TEMPLATE "SELECT images.id, title, artist, date, width, height, path, size, dlna" \
-+"_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " "FROM images, files " "WHERE dtime <> 0 AND images.id = files.id AND year = '%s' " "AND update_id > ? AND update_id <= ?;"
-+static RygelMediaObject* rygel_lms_image_year_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gchar* rygel_lms_category_container_build_child_id (RygelLMSCategoryContainer* self, gint db_id);
-+gchar* rygel_lms_category_container_build_reference_id (RygelLMSCategoryContainer* self, gint db_id);
-+static gchar* rygel_lms_image_year_get_sql_all (const gchar* year);
-+static gchar* rygel_lms_image_year_get_sql_find_object (const gchar* year);
-+static gchar* rygel_lms_image_year_get_sql_count (const gchar* year);
-+static gchar* rygel_lms_image_year_get_sql_added (const gchar* year);
-+static gchar* rygel_lms_image_year_get_sql_removed (const gchar* year);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSImageYear* rygel_lms_image_year_new (RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db);
-+RygelLMSImageYear* rygel_lms_image_year_construct (GType object_type, RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_image_year_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSImageYear * self;
-+ RygelMediaObject* result = NULL;
-+ gint id = 0;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ gint _tmp1_ = 0;
-+ gchar* path = NULL;
-+ sqlite3_stmt* _tmp2_ = NULL;
-+ const gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* mime_type = NULL;
-+ sqlite3_stmt* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ gboolean _tmp8_ = FALSE;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* title = NULL;
-+ sqlite3_stmt* _tmp15_ = NULL;
-+ const gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ RygelImageItem* image = NULL;
-+ gint _tmp18_ = 0;
-+ gchar* _tmp19_ = NULL;
-+ gchar* _tmp20_ = NULL;
-+ RygelImageItem* _tmp21_ = NULL;
-+ RygelImageItem* _tmp22_ = NULL;
-+ gint _tmp23_ = 0;
-+ gchar* _tmp24_ = NULL;
-+ gchar* _tmp25_ = NULL;
-+ sqlite3_stmt* _tmp26_ = NULL;
-+ const gchar* _tmp27_ = NULL;
-+ GTimeVal tv = {0};
-+ sqlite3_stmt* _tmp28_ = NULL;
-+ gint _tmp29_ = 0;
-+ GTimeVal _tmp30_ = {0};
-+ gchar* _tmp31_ = NULL;
-+ gchar* _tmp32_ = NULL;
-+ sqlite3_stmt* _tmp33_ = NULL;
-+ gint _tmp34_ = 0;
-+ sqlite3_stmt* _tmp35_ = NULL;
-+ gint _tmp36_ = 0;
-+ sqlite3_stmt* _tmp37_ = NULL;
-+ gint _tmp38_ = 0;
-+ const gchar* _tmp39_ = NULL;
-+ sqlite3_stmt* _tmp40_ = NULL;
-+ const gchar* _tmp41_ = NULL;
-+ GFile* file = NULL;
-+ const gchar* _tmp42_ = NULL;
-+ GFile* _tmp43_ = NULL;
-+ gchar* _tmp44_ = NULL;
-+ gchar* _tmp45_ = NULL;
-+ self = (RygelLMSImageYear*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_int (_tmp0_, 0);
-+ id = _tmp1_;
-+ _tmp2_ = statement;
-+ _tmp3_ = sqlite3_column_text (_tmp2_, 6);
-+ _tmp4_ = g_strdup (_tmp3_);
-+ path = _tmp4_;
-+ _tmp5_ = statement;
-+ _tmp6_ = sqlite3_column_text (_tmp5_, 9);
-+ _tmp7_ = g_strdup (_tmp6_);
-+ mime_type = _tmp7_;
-+ _tmp9_ = mime_type;
-+ if (_tmp9_ == NULL) {
-+ _tmp8_ = TRUE;
-+ } else {
-+ const gchar* _tmp10_ = NULL;
-+ gint _tmp11_ = 0;
-+ gint _tmp12_ = 0;
-+ _tmp10_ = mime_type;
-+ _tmp11_ = strlen (_tmp10_);
-+ _tmp12_ = _tmp11_;
-+ _tmp8_ = _tmp12_ == 0;
-+ }
-+ if (_tmp8_) {
-+ gint _tmp13_ = 0;
-+ const gchar* _tmp14_ = NULL;
-+ _tmp13_ = id;
-+ _tmp14_ = path;
-+ g_debug ("rygel-lms-image-year.vala:62: Image item %d (%s) has no MIME type", _tmp13_, _tmp14_);
-+ }
-+ _tmp15_ = statement;
-+ _tmp16_ = sqlite3_column_text (_tmp15_, 1);
-+ _tmp17_ = g_strdup (_tmp16_);
-+ title = _tmp17_;
-+ _tmp18_ = id;
-+ _tmp19_ = rygel_lms_category_container_build_child_id ((RygelLMSCategoryContainer*) self, _tmp18_);
-+ _tmp20_ = _tmp19_;
-+ _tmp21_ = rygel_image_item_new (_tmp20_, (RygelMediaContainer*) self, title, RYGEL_IMAGE_ITEM_UPNP_CLASS);
-+ _tmp22_ = _tmp21_;
-+ _g_free0 (_tmp20_);
-+ image = _tmp22_;
-+ _tmp23_ = id;
-+ _tmp24_ = rygel_lms_category_container_build_reference_id ((RygelLMSCategoryContainer*) self, _tmp23_);
-+ _tmp25_ = _tmp24_;
-+ rygel_media_object_set_ref_id ((RygelMediaObject*) image, _tmp25_);
-+ _g_free0 (_tmp25_);
-+ _tmp26_ = statement;
-+ _tmp27_ = sqlite3_column_text (_tmp26_, 2);
-+ rygel_media_object_set_creator ((RygelMediaObject*) image, _tmp27_);
-+ _tmp28_ = statement;
-+ _tmp29_ = sqlite3_column_int (_tmp28_, 3);
-+ _tmp30_.tv_sec = (glong) _tmp29_;
-+ _tmp30_.tv_usec = (glong) 0;
-+ tv = _tmp30_;
-+ _tmp31_ = g_time_val_to_iso8601 (&tv);
-+ _tmp32_ = _tmp31_;
-+ rygel_media_object_set_date ((RygelMediaObject*) image, _tmp32_);
-+ _g_free0 (_tmp32_);
-+ _tmp33_ = statement;
-+ _tmp34_ = sqlite3_column_int (_tmp33_, 4);
-+ rygel_visual_item_set_width ((RygelVisualItem*) image, _tmp34_);
-+ _tmp35_ = statement;
-+ _tmp36_ = sqlite3_column_int (_tmp35_, 5);
-+ rygel_visual_item_set_height ((RygelVisualItem*) image, _tmp36_);
-+ _tmp37_ = statement;
-+ _tmp38_ = sqlite3_column_int (_tmp37_, 7);
-+ rygel_media_file_item_set_size ((RygelMediaFileItem*) image, (gint64) _tmp38_);
-+ _tmp39_ = mime_type;
-+ rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) image, _tmp39_);
-+ _tmp40_ = statement;
-+ _tmp41_ = sqlite3_column_text (_tmp40_, 8);
-+ rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) image, _tmp41_);
-+ _tmp42_ = path;
-+ _tmp43_ = g_file_new_for_path (_tmp42_);
-+ file = _tmp43_;
-+ _tmp44_ = g_file_get_uri (file);
-+ _tmp45_ = _tmp44_;
-+ rygel_media_object_add_uri ((RygelMediaObject*) image, _tmp45_);
-+ _g_free0 (_tmp45_);
-+ result = (RygelMediaObject*) image;
-+ _g_object_unref0 (file);
-+ _g_free0 (title);
-+ _g_free0 (mime_type);
-+ _g_free0 (path);
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_image_year_get_sql_all (const gchar* year) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (year != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_IMAGE_YEAR_SQL_ALL_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_image_year_get_sql_find_object (const gchar* year) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (year != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_IMAGE_YEAR_SQL_FIND_OBJECT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_image_year_get_sql_count (const gchar* year) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (year != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_IMAGE_YEAR_SQL_COUNT_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_image_year_get_sql_added (const gchar* year) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (year != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_IMAGE_YEAR_SQL_ADDED_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+static gchar* rygel_lms_image_year_get_sql_removed (const gchar* year) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (year != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf (RYGEL_LMS_IMAGE_YEAR_SQL_REMOVED_TEMPLATE, _tmp0_);
-+ result = _tmp1_;
-+ return result;
-+}
-+
-+
-+RygelLMSImageYear* rygel_lms_image_year_construct (GType object_type, RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db) {
-+ RygelLMSImageYear * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ gchar* _tmp2_ = NULL;
-+ RygelMediaContainer* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ RygelLMSDatabase* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ gchar* _tmp7_ = NULL;
-+ gchar* _tmp8_ = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ gchar* _tmp10_ = NULL;
-+ gchar* _tmp11_ = NULL;
-+ const gchar* _tmp12_ = NULL;
-+ gchar* _tmp13_ = NULL;
-+ gchar* _tmp14_ = NULL;
-+ const gchar* _tmp15_ = NULL;
-+ gchar* _tmp16_ = NULL;
-+ gchar* _tmp17_ = NULL;
-+ const gchar* _tmp18_ = NULL;
-+ gchar* _tmp19_ = NULL;
-+ gchar* _tmp20_ = NULL;
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (year != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = year;
-+ _tmp1_ = g_strdup_printf ("%s", _tmp0_);
-+ _tmp2_ = _tmp1_;
-+ _tmp3_ = parent;
-+ _tmp4_ = year;
-+ _tmp5_ = lms_db;
-+ _tmp6_ = year;
-+ _tmp7_ = rygel_lms_image_year_get_sql_all (_tmp6_);
-+ _tmp8_ = _tmp7_;
-+ _tmp9_ = year;
-+ _tmp10_ = rygel_lms_image_year_get_sql_find_object (_tmp9_);
-+ _tmp11_ = _tmp10_;
-+ _tmp12_ = year;
-+ _tmp13_ = rygel_lms_image_year_get_sql_count (_tmp12_);
-+ _tmp14_ = _tmp13_;
-+ _tmp15_ = year;
-+ _tmp16_ = rygel_lms_image_year_get_sql_added (_tmp15_);
-+ _tmp17_ = _tmp16_;
-+ _tmp18_ = year;
-+ _tmp19_ = rygel_lms_image_year_get_sql_removed (_tmp18_);
-+ _tmp20_ = _tmp19_;
-+ self = (RygelLMSImageYear*) rygel_lms_category_container_construct (object_type, _tmp2_, _tmp3_, _tmp4_, _tmp5_, _tmp8_, _tmp11_, _tmp14_, _tmp17_, _tmp20_);
-+ _g_free0 (_tmp20_);
-+ _g_free0 (_tmp17_);
-+ _g_free0 (_tmp14_);
-+ _g_free0 (_tmp11_);
-+ _g_free0 (_tmp8_);
-+ _g_free0 (_tmp2_);
-+ return self;
-+}
-+
-+
-+RygelLMSImageYear* rygel_lms_image_year_new (RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_image_year_construct (RYGEL_LMS_TYPE_IMAGE_YEAR, parent, year, lms_db);
-+}
-+
-+
-+static void rygel_lms_image_year_class_init (RygelLMSImageYearClass * klass) {
-+ rygel_lms_image_year_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_image_year_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_image_year_instance_init (RygelLMSImageYear * self) {
-+}
-+
-+
-+GType rygel_lms_image_year_get_type (void) {
-+ static volatile gsize rygel_lms_image_year_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_image_year_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSImageYearClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_image_year_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSImageYear), 0, (GInstanceInitFunc) rygel_lms_image_year_instance_init, NULL };
-+ GType rygel_lms_image_year_type_id;
-+ rygel_lms_image_year_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSImageYear", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_image_year_type_id__volatile, rygel_lms_image_year_type_id);
-+ }
-+ return rygel_lms_image_year_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-image-years.c b/src/plugins/lms/rygel-lms-image-years.c
-new file mode 100644
-index 0000000..35033a0
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-image-years.c
-@@ -0,0 +1,196 @@
-+/* rygel-lms-image-years.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-image-years.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <sqlite3.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+typedef struct _RygelLMSCategoryContainerPrivate RygelLMSCategoryContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_IMAGE_YEARS (rygel_lms_image_years_get_type ())
-+#define RYGEL_LMS_IMAGE_YEARS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYears))
-+#define RYGEL_LMS_IMAGE_YEARS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYearsClass))
-+#define RYGEL_LMS_IS_IMAGE_YEARS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS))
-+#define RYGEL_LMS_IS_IMAGE_YEARS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_YEARS))
-+#define RYGEL_LMS_IMAGE_YEARS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_YEARS, RygelLMSImageYearsClass))
-+
-+typedef struct _RygelLMSImageYears RygelLMSImageYears;
-+typedef struct _RygelLMSImageYearsClass RygelLMSImageYearsClass;
-+typedef struct _RygelLMSImageYearsPrivate RygelLMSImageYearsPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+#define RYGEL_LMS_TYPE_IMAGE_YEAR (rygel_lms_image_year_get_type ())
-+#define RYGEL_LMS_IMAGE_YEAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYear))
-+#define RYGEL_LMS_IMAGE_YEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYearClass))
-+#define RYGEL_LMS_IS_IMAGE_YEAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR))
-+#define RYGEL_LMS_IS_IMAGE_YEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_YEAR))
-+#define RYGEL_LMS_IMAGE_YEAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_YEAR, RygelLMSImageYearClass))
-+
-+typedef struct _RygelLMSImageYear RygelLMSImageYear;
-+typedef struct _RygelLMSImageYearClass RygelLMSImageYearClass;
-+
-+struct _RygelLMSCategoryContainer {
-+ RygelMediaContainer parent_instance;
-+ RygelLMSCategoryContainerPrivate * priv;
-+ sqlite3_stmt* stmt_all;
-+ sqlite3_stmt* stmt_find_object;
-+ sqlite3_stmt* stmt_added;
-+ sqlite3_stmt* stmt_removed;
-+ gchar* child_prefix;
-+ gchar* ref_prefix;
-+};
-+
-+struct _RygelLMSCategoryContainerClass {
-+ RygelMediaContainerClass parent_class;
-+ RygelMediaObject* (*object_from_statement) (RygelLMSCategoryContainer* self, sqlite3_stmt* statement);
-+ gchar* (*get_sql_all_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ gchar* (*get_sql_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* filter);
-+ guint (*get_child_count_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args);
-+ RygelMediaObjects* (*get_children_with_filter) (RygelLMSCategoryContainer* self, const gchar* where_filter, GValueArray* args, const gchar* sort_criteria, guint offset, guint max_count);
-+};
-+
-+struct _RygelLMSImageYears {
-+ RygelLMSCategoryContainer parent_instance;
-+ RygelLMSImageYearsPrivate * priv;
-+};
-+
-+struct _RygelLMSImageYearsClass {
-+ RygelLMSCategoryContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_image_years_parent_class = NULL;
-+
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_image_years_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_IMAGE_YEARS_DUMMY_PROPERTY
-+};
-+#define RYGEL_LMS_IMAGE_YEARS_SQL_ALL "SELECT DISTINCT(strftime('%Y', images.date, 'unixepoch')) as year " "FROM images " "LIMIT ? OFFSET ?;"
-+#define RYGEL_LMS_IMAGE_YEARS_SQL_COUNT "SELECT COUNT(DISTINCT(strftime('%Y', images.date, 'unixepoch'))) " "FROM images;"
-+#define RYGEL_LMS_IMAGE_YEARS_SQL_FIND_OBJECT "SELECT strftime('%Y', images.date, 'unixepoch') as year " "FROM images " "WHERE year = CAST(? AS TEXT)"
-+static RygelMediaObject* rygel_lms_image_years_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement);
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSDatabase* rygel_lms_category_container_get_lms_db (RygelLMSCategoryContainer* self);
-+RygelLMSImageYear* rygel_lms_image_year_new (RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db);
-+RygelLMSImageYear* rygel_lms_image_year_construct (GType object_type, RygelMediaContainer* parent, const gchar* year, RygelLMSDatabase* lms_db);
-+GType rygel_lms_image_year_get_type (void) G_GNUC_CONST;
-+RygelLMSImageYears* rygel_lms_image_years_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSImageYears* rygel_lms_image_years_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSCategoryContainer* rygel_lms_category_container_construct (GType object_type, const gchar* db_id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db, const gchar* sql_all, const gchar* sql_find_object, const gchar* sql_count, const gchar* sql_added, const gchar* sql_removed);
-+
-+
-+static RygelMediaObject* rygel_lms_image_years_real_object_from_statement (RygelLMSCategoryContainer* base, sqlite3_stmt* statement) {
-+ RygelLMSImageYears * self;
-+ RygelMediaObject* result = NULL;
-+ sqlite3_stmt* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ RygelLMSImageYear* _tmp4_ = NULL;
-+ self = (RygelLMSImageYears*) base;
-+ g_return_val_if_fail (statement != NULL, NULL);
-+ _tmp0_ = statement;
-+ _tmp1_ = sqlite3_column_text (_tmp0_, 0);
-+ _tmp2_ = rygel_lms_category_container_get_lms_db ((RygelLMSCategoryContainer*) self);
-+ _tmp3_ = _tmp2_;
-+ _tmp4_ = rygel_lms_image_year_new ((RygelMediaContainer*) self, _tmp1_, _tmp3_);
-+ result = (RygelMediaObject*) _tmp4_;
-+ return result;
-+}
-+
-+
-+RygelLMSImageYears* rygel_lms_image_years_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ RygelLMSImageYears * self = NULL;
-+ RygelMediaContainer* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ RygelLMSDatabase* _tmp2_ = NULL;
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = parent;
-+ _tmp1_ = _ ("Years");
-+ _tmp2_ = lms_db;
-+ self = (RygelLMSImageYears*) rygel_lms_category_container_construct (object_type, "years", _tmp0_, _tmp1_, _tmp2_, RYGEL_LMS_IMAGE_YEARS_SQL_ALL, RYGEL_LMS_IMAGE_YEARS_SQL_FIND_OBJECT, RYGEL_LMS_IMAGE_YEARS_SQL_COUNT, NULL, NULL);
-+ return self;
-+}
-+
-+
-+RygelLMSImageYears* rygel_lms_image_years_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_image_years_construct (RYGEL_LMS_TYPE_IMAGE_YEARS, parent, lms_db);
-+}
-+
-+
-+static void rygel_lms_image_years_class_init (RygelLMSImageYearsClass * klass) {
-+ rygel_lms_image_years_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSCategoryContainerClass *) klass)->object_from_statement = rygel_lms_image_years_real_object_from_statement;
-+}
-+
-+
-+static void rygel_lms_image_years_instance_init (RygelLMSImageYears * self) {
-+}
-+
-+
-+GType rygel_lms_image_years_get_type (void) {
-+ static volatile gsize rygel_lms_image_years_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_image_years_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSImageYearsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_image_years_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSImageYears), 0, (GInstanceInitFunc) rygel_lms_image_years_instance_init, NULL };
-+ GType rygel_lms_image_years_type_id;
-+ rygel_lms_image_years_type_id = g_type_register_static (RYGEL_LMS_TYPE_CATEGORY_CONTAINER, "RygelLMSImageYears", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_image_years_type_id__volatile, rygel_lms_image_years_type_id);
-+ }
-+ return rygel_lms_image_years_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-music-root.c b/src/plugins/lms/rygel-lms-music-root.c
-new file mode 100644
-index 0000000..753906d
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-music-root.c
-@@ -0,0 +1,202 @@
-+/* rygel-lms-music-root.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-music-root.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_MUSIC_ROOT (rygel_lms_music_root_get_type ())
-+#define RYGEL_LMS_MUSIC_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRoot))
-+#define RYGEL_LMS_MUSIC_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRootClass))
-+#define RYGEL_LMS_IS_MUSIC_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT))
-+#define RYGEL_LMS_IS_MUSIC_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_MUSIC_ROOT))
-+#define RYGEL_LMS_MUSIC_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRootClass))
-+
-+typedef struct _RygelLMSMusicRoot RygelLMSMusicRoot;
-+typedef struct _RygelLMSMusicRootClass RygelLMSMusicRootClass;
-+typedef struct _RygelLMSMusicRootPrivate RygelLMSMusicRootPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+
-+#define RYGEL_LMS_TYPE_ALL_MUSIC (rygel_lms_all_music_get_type ())
-+#define RYGEL_LMS_ALL_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusic))
-+#define RYGEL_LMS_ALL_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusicClass))
-+#define RYGEL_LMS_IS_ALL_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_MUSIC))
-+#define RYGEL_LMS_IS_ALL_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_MUSIC))
-+#define RYGEL_LMS_ALL_MUSIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_MUSIC, RygelLMSAllMusicClass))
-+
-+typedef struct _RygelLMSAllMusic RygelLMSAllMusic;
-+typedef struct _RygelLMSAllMusicClass RygelLMSAllMusicClass;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_ARTISTS (rygel_lms_artists_get_type ())
-+#define RYGEL_LMS_ARTISTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtists))
-+#define RYGEL_LMS_ARTISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtistsClass))
-+#define RYGEL_LMS_IS_ARTISTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ARTISTS))
-+#define RYGEL_LMS_IS_ARTISTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ARTISTS))
-+#define RYGEL_LMS_ARTISTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ARTISTS, RygelLMSArtistsClass))
-+
-+typedef struct _RygelLMSArtists RygelLMSArtists;
-+typedef struct _RygelLMSArtistsClass RygelLMSArtistsClass;
-+
-+#define RYGEL_LMS_TYPE_ALBUMS (rygel_lms_albums_get_type ())
-+#define RYGEL_LMS_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbums))
-+#define RYGEL_LMS_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbumsClass))
-+#define RYGEL_LMS_IS_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALBUMS))
-+#define RYGEL_LMS_IS_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALBUMS))
-+#define RYGEL_LMS_ALBUMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALBUMS, RygelLMSAlbumsClass))
-+
-+typedef struct _RygelLMSAlbums RygelLMSAlbums;
-+typedef struct _RygelLMSAlbumsClass RygelLMSAlbumsClass;
-+
-+struct _RygelLMSMusicRoot {
-+ RygelSimpleContainer parent_instance;
-+ RygelLMSMusicRootPrivate * priv;
-+};
-+
-+struct _RygelLMSMusicRootClass {
-+ RygelSimpleContainerClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_music_root_parent_class = NULL;
-+
-+GType rygel_lms_music_root_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_MUSIC_ROOT_DUMMY_PROPERTY
-+};
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+RygelLMSMusicRoot* rygel_lms_music_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSMusicRoot* rygel_lms_music_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAllMusic* rygel_lms_all_music_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAllMusic* rygel_lms_all_music_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_music_get_type (void) G_GNUC_CONST;
-+RygelLMSArtists* rygel_lms_artists_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSArtists* rygel_lms_artists_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_artists_get_type (void) G_GNUC_CONST;
-+RygelLMSAlbums* rygel_lms_albums_new (RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+RygelLMSAlbums* rygel_lms_albums_construct (GType object_type, RygelMediaContainer* parent, RygelLMSDatabase* lms_db);
-+GType rygel_lms_albums_get_type (void) G_GNUC_CONST;
-+
-+
-+RygelLMSMusicRoot* rygel_lms_music_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ RygelLMSMusicRoot * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ RygelMediaContainer* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ RygelLMSDatabase* _tmp3_ = NULL;
-+ RygelLMSAllMusic* _tmp4_ = NULL;
-+ RygelLMSAllMusic* _tmp5_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ RygelLMSDatabase* _tmp7_ = NULL;
-+ RygelLMSArtists* _tmp8_ = NULL;
-+ RygelLMSArtists* _tmp9_ = NULL;
-+ RygelLMSDatabase* _tmp10_ = NULL;
-+ RygelLMSAlbums* _tmp11_ = NULL;
-+ RygelLMSAlbums* _tmp12_ = NULL;
-+ g_return_val_if_fail (id != NULL, NULL);
-+ g_return_val_if_fail (parent != NULL, NULL);
-+ g_return_val_if_fail (title != NULL, NULL);
-+ g_return_val_if_fail (lms_db != NULL, NULL);
-+ _tmp0_ = id;
-+ _tmp1_ = parent;
-+ _tmp2_ = title;
-+ self = (RygelLMSMusicRoot*) rygel_simple_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
-+ _tmp3_ = lms_db;
-+ _tmp4_ = rygel_lms_all_music_new ((RygelMediaContainer*) self, _tmp3_);
-+ _tmp5_ = _tmp4_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp5_);
-+ _g_object_unref0 (_tmp5_);
-+ _tmp6_ = _ ("Artists");
-+ _tmp7_ = lms_db;
-+ _tmp8_ = rygel_lms_artists_new ("artists", (RygelMediaContainer*) self, _tmp6_, _tmp7_);
-+ _tmp9_ = _tmp8_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp9_);
-+ _g_object_unref0 (_tmp9_);
-+ _tmp10_ = lms_db;
-+ _tmp11_ = rygel_lms_albums_new ((RygelMediaContainer*) self, _tmp10_);
-+ _tmp12_ = _tmp11_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp12_);
-+ _g_object_unref0 (_tmp12_);
-+ return self;
-+}
-+
-+
-+RygelLMSMusicRoot* rygel_lms_music_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db) {
-+ return rygel_lms_music_root_construct (RYGEL_LMS_TYPE_MUSIC_ROOT, id, parent, title, lms_db);
-+}
-+
-+
-+static void rygel_lms_music_root_class_init (RygelLMSMusicRootClass * klass) {
-+ rygel_lms_music_root_parent_class = g_type_class_peek_parent (klass);
-+}
-+
-+
-+static void rygel_lms_music_root_instance_init (RygelLMSMusicRoot * self) {
-+}
-+
-+
-+GType rygel_lms_music_root_get_type (void) {
-+ static volatile gsize rygel_lms_music_root_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_music_root_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSMusicRootClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_music_root_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSMusicRoot), 0, (GInstanceInitFunc) rygel_lms_music_root_instance_init, NULL };
-+ GType rygel_lms_music_root_type_id;
-+ rygel_lms_music_root_type_id = g_type_register_static (RYGEL_TYPE_SIMPLE_CONTAINER, "RygelLMSMusicRoot", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_music_root_type_id__volatile, rygel_lms_music_root_type_id);
-+ }
-+ return rygel_lms_music_root_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-plugin-factory.c b/src/plugins/lms/rygel-lms-plugin-factory.c
-new file mode 100644
-index 0000000..de4a5ab
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-plugin-factory.c
-@@ -0,0 +1,307 @@
-+/* rygel-lms-plugin-factory.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-plugin-factory.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-core.h>
-+#include <rygel-server.h>
-+#include <gobject/gvaluecollector.h>
-+
-+
-+#define RYGEL_LMS_TYPE_PLUGIN_FACTORY (rygel_lms_plugin_factory_get_type ())
-+#define RYGEL_LMS_PLUGIN_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_PLUGIN_FACTORY, RygelLMSPluginFactory))
-+#define RYGEL_LMS_PLUGIN_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_PLUGIN_FACTORY, RygelLMSPluginFactoryClass))
-+#define RYGEL_LMS_IS_PLUGIN_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_PLUGIN_FACTORY))
-+#define RYGEL_LMS_IS_PLUGIN_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_PLUGIN_FACTORY))
-+#define RYGEL_LMS_PLUGIN_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_PLUGIN_FACTORY, RygelLMSPluginFactoryClass))
-+
-+typedef struct _RygelLMSPluginFactory RygelLMSPluginFactory;
-+typedef struct _RygelLMSPluginFactoryClass RygelLMSPluginFactoryClass;
-+#define _rygel_lms_plugin_factory_unref0(var) ((var == NULL) ? NULL : (var = (rygel_lms_plugin_factory_unref (var), NULL)))
-+typedef struct _RygelLMSPluginFactoryPrivate RygelLMSPluginFactoryPrivate;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_PLUGIN (rygel_lms_plugin_get_type ())
-+#define RYGEL_LMS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPlugin))
-+#define RYGEL_LMS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPluginClass))
-+#define RYGEL_LMS_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_PLUGIN))
-+#define RYGEL_LMS_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_PLUGIN))
-+#define RYGEL_LMS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPluginClass))
-+
-+typedef struct _RygelLMSPlugin RygelLMSPlugin;
-+typedef struct _RygelLMSPluginClass RygelLMSPluginClass;
-+typedef struct _RygelLMSParamSpecPluginFactory RygelLMSParamSpecPluginFactory;
-+
-+struct _RygelLMSPluginFactory {
-+ GTypeInstance parent_instance;
-+ volatile int ref_count;
-+ RygelLMSPluginFactoryPrivate * priv;
-+};
-+
-+struct _RygelLMSPluginFactoryClass {
-+ GTypeClass parent_class;
-+ void (*finalize) (RygelLMSPluginFactory *self);
-+};
-+
-+struct _RygelLMSPluginFactoryPrivate {
-+ RygelPluginLoader* loader;
-+};
-+
-+struct _RygelLMSParamSpecPluginFactory {
-+ GParamSpec parent_instance;
-+};
-+
-+
-+extern RygelLMSPluginFactory* plugin_factory;
-+RygelLMSPluginFactory* plugin_factory = NULL;
-+static gpointer rygel_lms_plugin_factory_parent_class = NULL;
-+
-+gpointer rygel_lms_plugin_factory_ref (gpointer instance);
-+void rygel_lms_plugin_factory_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_plugin_factory (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_plugin_factory (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_plugin_factory (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_plugin_factory (const GValue* value);
-+GType rygel_lms_plugin_factory_get_type (void) G_GNUC_CONST;
-+void module_init (RygelPluginLoader* loader);
-+RygelLMSPluginFactory* rygel_lms_plugin_factory_new (RygelPluginLoader* loader);
-+RygelLMSPluginFactory* rygel_lms_plugin_factory_construct (GType object_type, RygelPluginLoader* loader);
-+#define RYGEL_LMS_PLUGIN_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_LMS_TYPE_PLUGIN_FACTORY, RygelLMSPluginFactoryPrivate))
-+enum {
-+ RYGEL_LMS_PLUGIN_FACTORY_DUMMY_PROPERTY
-+};
-+RygelLMSPlugin* rygel_lms_plugin_new (void);
-+RygelLMSPlugin* rygel_lms_plugin_construct (GType object_type);
-+GType rygel_lms_plugin_get_type (void) G_GNUC_CONST;
-+static void rygel_lms_plugin_factory_finalize (RygelLMSPluginFactory* obj);
-+
-+
-+void module_init (RygelPluginLoader* loader) {
-+ RygelPluginLoader* _tmp0_ = NULL;
-+ RygelLMSPluginFactory* _tmp1_ = NULL;
-+ g_return_if_fail (loader != NULL);
-+ _tmp0_ = loader;
-+ _tmp1_ = rygel_lms_plugin_factory_new (_tmp0_);
-+ _rygel_lms_plugin_factory_unref0 (plugin_factory);
-+ plugin_factory = _tmp1_;
-+}
-+
-+
-+static gpointer _g_object_ref0 (gpointer self) {
-+ return self ? g_object_ref (self) : NULL;
-+}
-+
-+
-+RygelLMSPluginFactory* rygel_lms_plugin_factory_construct (GType object_type, RygelPluginLoader* loader) {
-+ RygelLMSPluginFactory* self = NULL;
-+ RygelPluginLoader* _tmp0_ = NULL;
-+ RygelPluginLoader* _tmp1_ = NULL;
-+ RygelPluginLoader* _tmp2_ = NULL;
-+ RygelLMSPlugin* _tmp3_ = NULL;
-+ RygelLMSPlugin* _tmp4_ = NULL;
-+ g_return_val_if_fail (loader != NULL, NULL);
-+ self = (RygelLMSPluginFactory*) g_type_create_instance (object_type);
-+ _tmp0_ = loader;
-+ _tmp1_ = _g_object_ref0 (_tmp0_);
-+ _g_object_unref0 (self->priv->loader);
-+ self->priv->loader = _tmp1_;
-+ _tmp2_ = self->priv->loader;
-+ _tmp3_ = rygel_lms_plugin_new ();
-+ _tmp4_ = _tmp3_;
-+ rygel_plugin_loader_add_plugin (_tmp2_, (RygelPlugin*) _tmp4_);
-+ _g_object_unref0 (_tmp4_);
-+ return self;
-+}
-+
-+
-+RygelLMSPluginFactory* rygel_lms_plugin_factory_new (RygelPluginLoader* loader) {
-+ return rygel_lms_plugin_factory_construct (RYGEL_LMS_TYPE_PLUGIN_FACTORY, loader);
-+}
-+
-+
-+static void rygel_lms_value_plugin_factory_init (GValue* value) {
-+ value->data[0].v_pointer = NULL;
-+}
-+
-+
-+static void rygel_lms_value_plugin_factory_free_value (GValue* value) {
-+ if (value->data[0].v_pointer) {
-+ rygel_lms_plugin_factory_unref (value->data[0].v_pointer);
-+ }
-+}
-+
-+
-+static void rygel_lms_value_plugin_factory_copy_value (const GValue* src_value, GValue* dest_value) {
-+ if (src_value->data[0].v_pointer) {
-+ dest_value->data[0].v_pointer = rygel_lms_plugin_factory_ref (src_value->data[0].v_pointer);
-+ } else {
-+ dest_value->data[0].v_pointer = NULL;
-+ }
-+}
-+
-+
-+static gpointer rygel_lms_value_plugin_factory_peek_pointer (const GValue* value) {
-+ return value->data[0].v_pointer;
-+}
-+
-+
-+static gchar* rygel_lms_value_plugin_factory_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-+ if (collect_values[0].v_pointer) {
-+ RygelLMSPluginFactory* object;
-+ object = collect_values[0].v_pointer;
-+ if (object->parent_instance.g_class == NULL) {
-+ return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-+ } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
-+ return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-+ }
-+ value->data[0].v_pointer = rygel_lms_plugin_factory_ref (object);
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ return NULL;
-+}
-+
-+
-+static gchar* rygel_lms_value_plugin_factory_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-+ RygelLMSPluginFactory** object_p;
-+ object_p = collect_values[0].v_pointer;
-+ if (!object_p) {
-+ return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
-+ }
-+ if (!value->data[0].v_pointer) {
-+ *object_p = NULL;
-+ } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-+ *object_p = value->data[0].v_pointer;
-+ } else {
-+ *object_p = rygel_lms_plugin_factory_ref (value->data[0].v_pointer);
-+ }
-+ return NULL;
-+}
-+
-+
-+GParamSpec* rygel_lms_param_spec_plugin_factory (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
-+ RygelLMSParamSpecPluginFactory* spec;
-+ g_return_val_if_fail (g_type_is_a (object_type, RYGEL_LMS_TYPE_PLUGIN_FACTORY), NULL);
-+ spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
-+ G_PARAM_SPEC (spec)->value_type = object_type;
-+ return G_PARAM_SPEC (spec);
-+}
-+
-+
-+gpointer rygel_lms_value_get_plugin_factory (const GValue* value) {
-+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_PLUGIN_FACTORY), NULL);
-+ return value->data[0].v_pointer;
-+}
-+
-+
-+void rygel_lms_value_set_plugin_factory (GValue* value, gpointer v_object) {
-+ RygelLMSPluginFactory* old;
-+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_PLUGIN_FACTORY));
-+ old = value->data[0].v_pointer;
-+ if (v_object) {
-+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_LMS_TYPE_PLUGIN_FACTORY));
-+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-+ value->data[0].v_pointer = v_object;
-+ rygel_lms_plugin_factory_ref (value->data[0].v_pointer);
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ if (old) {
-+ rygel_lms_plugin_factory_unref (old);
-+ }
-+}
-+
-+
-+void rygel_lms_value_take_plugin_factory (GValue* value, gpointer v_object) {
-+ RygelLMSPluginFactory* old;
-+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_LMS_TYPE_PLUGIN_FACTORY));
-+ old = value->data[0].v_pointer;
-+ if (v_object) {
-+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_LMS_TYPE_PLUGIN_FACTORY));
-+ g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-+ value->data[0].v_pointer = v_object;
-+ } else {
-+ value->data[0].v_pointer = NULL;
-+ }
-+ if (old) {
-+ rygel_lms_plugin_factory_unref (old);
-+ }
-+}
-+
-+
-+static void rygel_lms_plugin_factory_class_init (RygelLMSPluginFactoryClass * klass) {
-+ rygel_lms_plugin_factory_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSPluginFactoryClass *) klass)->finalize = rygel_lms_plugin_factory_finalize;
-+ g_type_class_add_private (klass, sizeof (RygelLMSPluginFactoryPrivate));
-+}
-+
-+
-+static void rygel_lms_plugin_factory_instance_init (RygelLMSPluginFactory * self) {
-+ self->priv = RYGEL_LMS_PLUGIN_FACTORY_GET_PRIVATE (self);
-+ self->ref_count = 1;
-+}
-+
-+
-+static void rygel_lms_plugin_factory_finalize (RygelLMSPluginFactory* obj) {
-+ RygelLMSPluginFactory * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_PLUGIN_FACTORY, RygelLMSPluginFactory);
-+ g_signal_handlers_destroy (self);
-+ _g_object_unref0 (self->priv->loader);
-+}
-+
-+
-+GType rygel_lms_plugin_factory_get_type (void) {
-+ static volatile gsize rygel_lms_plugin_factory_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_plugin_factory_type_id__volatile)) {
-+ static const GTypeValueTable g_define_type_value_table = { rygel_lms_value_plugin_factory_init, rygel_lms_value_plugin_factory_free_value, rygel_lms_value_plugin_factory_copy_value, rygel_lms_value_plugin_factory_peek_pointer, "p", rygel_lms_value_plugin_factory_collect_value, "p", rygel_lms_value_plugin_factory_lcopy_value };
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSPluginFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_plugin_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSPluginFactory), 0, (GInstanceInitFunc) rygel_lms_plugin_factory_instance_init, &g_define_type_value_table };
-+ static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
-+ GType rygel_lms_plugin_factory_type_id;
-+ rygel_lms_plugin_factory_type_id = g_type_register_fundamental (g_type_fundamental_next (), "RygelLMSPluginFactory", &g_define_type_info, &g_define_type_fundamental_info, 0);
-+ g_once_init_leave (&rygel_lms_plugin_factory_type_id__volatile, rygel_lms_plugin_factory_type_id);
-+ }
-+ return rygel_lms_plugin_factory_type_id__volatile;
-+}
-+
-+
-+gpointer rygel_lms_plugin_factory_ref (gpointer instance) {
-+ RygelLMSPluginFactory* self;
-+ self = instance;
-+ g_atomic_int_inc (&self->ref_count);
-+ return instance;
-+}
-+
-+
-+void rygel_lms_plugin_factory_unref (gpointer instance) {
-+ RygelLMSPluginFactory* self;
-+ self = instance;
-+ if (g_atomic_int_dec_and_test (&self->ref_count)) {
-+ RYGEL_LMS_PLUGIN_FACTORY_GET_CLASS (self)->finalize (self);
-+ g_type_free_instance ((GTypeInstance *) self);
-+ }
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-plugin.c b/src/plugins/lms/rygel-lms-plugin.c
-new file mode 100644
-index 0000000..980de64
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-plugin.c
-@@ -0,0 +1,134 @@
-+/* rygel-lms-plugin.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-plugin.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <rygel-core.h>
-+
-+
-+#define RYGEL_LMS_TYPE_PLUGIN (rygel_lms_plugin_get_type ())
-+#define RYGEL_LMS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPlugin))
-+#define RYGEL_LMS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPluginClass))
-+#define RYGEL_LMS_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_PLUGIN))
-+#define RYGEL_LMS_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_PLUGIN))
-+#define RYGEL_LMS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_PLUGIN, RygelLMSPluginClass))
-+
-+typedef struct _RygelLMSPlugin RygelLMSPlugin;
-+typedef struct _RygelLMSPluginClass RygelLMSPluginClass;
-+typedef struct _RygelLMSPluginPrivate RygelLMSPluginPrivate;
-+
-+#define RYGEL_LMS_TYPE_ROOT_CONTAINER (rygel_lms_root_container_get_type ())
-+#define RYGEL_LMS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainer))
-+#define RYGEL_LMS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainerClass))
-+#define RYGEL_LMS_IS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER))
-+#define RYGEL_LMS_IS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ROOT_CONTAINER))
-+#define RYGEL_LMS_ROOT_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainerClass))
-+
-+typedef struct _RygelLMSRootContainer RygelLMSRootContainer;
-+typedef struct _RygelLMSRootContainerClass RygelLMSRootContainerClass;
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+struct _RygelLMSPlugin {
-+ RygelMediaServerPlugin parent_instance;
-+ RygelLMSPluginPrivate * priv;
-+};
-+
-+struct _RygelLMSPluginClass {
-+ RygelMediaServerPluginClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_plugin_parent_class = NULL;
-+static RygelLMSRootContainer* rygel_lms_plugin_root;
-+static RygelLMSRootContainer* rygel_lms_plugin_root = NULL;
-+
-+GType rygel_lms_plugin_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_PLUGIN_DUMMY_PROPERTY
-+};
-+GType rygel_lms_root_container_get_type (void) G_GNUC_CONST;
-+#define RYGEL_LMS_PLUGIN_NAME "LMS"
-+RygelLMSPlugin* rygel_lms_plugin_new (void);
-+RygelLMSPlugin* rygel_lms_plugin_construct (GType object_type);
-+RygelLMSRootContainer* rygel_lms_root_container_new (void);
-+RygelLMSRootContainer* rygel_lms_root_container_construct (GType object_type);
-+static void rygel_lms_plugin_finalize (GObject* obj);
-+
-+
-+RygelLMSPlugin* rygel_lms_plugin_construct (GType object_type) {
-+ RygelLMSPlugin * self = NULL;
-+ RygelLMSRootContainer* _tmp0_ = NULL;
-+ RygelLMSRootContainer* _tmp2_ = NULL;
-+ _tmp0_ = rygel_lms_plugin_root;
-+ if (_tmp0_ == NULL) {
-+ RygelLMSRootContainer* _tmp1_ = NULL;
-+ _tmp1_ = rygel_lms_root_container_new ();
-+ _g_object_unref0 (rygel_lms_plugin_root);
-+ rygel_lms_plugin_root = _tmp1_;
-+ }
-+ _tmp2_ = rygel_lms_plugin_root;
-+ self = (RygelLMSPlugin*) rygel_media_server_plugin_construct (object_type, (RygelMediaContainer*) _tmp2_, RYGEL_LMS_PLUGIN_NAME, NULL, RYGEL_PLUGIN_CAPABILITIES_TRACK_CHANGES);
-+ return self;
-+}
-+
-+
-+RygelLMSPlugin* rygel_lms_plugin_new (void) {
-+ return rygel_lms_plugin_construct (RYGEL_LMS_TYPE_PLUGIN);
-+}
-+
-+
-+static void rygel_lms_plugin_class_init (RygelLMSPluginClass * klass) {
-+ rygel_lms_plugin_parent_class = g_type_class_peek_parent (klass);
-+ G_OBJECT_CLASS (klass)->finalize = rygel_lms_plugin_finalize;
-+}
-+
-+
-+static void rygel_lms_plugin_instance_init (RygelLMSPlugin * self) {
-+}
-+
-+
-+static void rygel_lms_plugin_finalize (GObject* obj) {
-+ RygelLMSPlugin * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_PLUGIN, RygelLMSPlugin);
-+ G_OBJECT_CLASS (rygel_lms_plugin_parent_class)->finalize (obj);
-+}
-+
-+
-+GType rygel_lms_plugin_get_type (void) {
-+ static volatile gsize rygel_lms_plugin_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_plugin_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSPlugin), 0, (GInstanceInitFunc) rygel_lms_plugin_instance_init, NULL };
-+ GType rygel_lms_plugin_type_id;
-+ rygel_lms_plugin_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_SERVER_PLUGIN, "RygelLMSPlugin", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_plugin_type_id__volatile, rygel_lms_plugin_type_id);
-+ }
-+ return rygel_lms_plugin_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-root-container.c b/src/plugins/lms/rygel-lms-root-container.c
-new file mode 100644
-index 0000000..625ed2f
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-root-container.c
-@@ -0,0 +1,318 @@
-+/* rygel-lms-root-container.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-root-container.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2013 Intel Corporation.
-+ *
-+ * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <rygel-server.h>
-+#include <rygel-core.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <glib/gi18n-lib.h>
-+
-+
-+#define RYGEL_LMS_TYPE_ROOT_CONTAINER (rygel_lms_root_container_get_type ())
-+#define RYGEL_LMS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainer))
-+#define RYGEL_LMS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainerClass))
-+#define RYGEL_LMS_IS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER))
-+#define RYGEL_LMS_IS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ROOT_CONTAINER))
-+#define RYGEL_LMS_ROOT_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainerClass))
-+
-+typedef struct _RygelLMSRootContainer RygelLMSRootContainer;
-+typedef struct _RygelLMSRootContainerClass RygelLMSRootContainerClass;
-+typedef struct _RygelLMSRootContainerPrivate RygelLMSRootContainerPrivate;
-+
-+#define RYGEL_LMS_TYPE_DATABASE (rygel_lms_database_get_type ())
-+#define RYGEL_LMS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabase))
-+#define RYGEL_LMS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+#define RYGEL_LMS_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_DATABASE))
-+#define RYGEL_LMS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_DATABASE, RygelLMSDatabaseClass))
-+
-+typedef struct _RygelLMSDatabase RygelLMSDatabase;
-+typedef struct _RygelLMSDatabaseClass RygelLMSDatabaseClass;
-+#define _rygel_lms_database_unref0(var) ((var == NULL) ? NULL : (var = (rygel_lms_database_unref (var), NULL)))
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-+
-+#define RYGEL_LMS_TYPE_MUSIC_ROOT (rygel_lms_music_root_get_type ())
-+#define RYGEL_LMS_MUSIC_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRoot))
-+#define RYGEL_LMS_MUSIC_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRootClass))
-+#define RYGEL_LMS_IS_MUSIC_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT))
-+#define RYGEL_LMS_IS_MUSIC_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_MUSIC_ROOT))
-+#define RYGEL_LMS_MUSIC_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_MUSIC_ROOT, RygelLMSMusicRootClass))
-+
-+typedef struct _RygelLMSMusicRoot RygelLMSMusicRoot;
-+typedef struct _RygelLMSMusicRootClass RygelLMSMusicRootClass;
-+
-+#define RYGEL_LMS_TYPE_CATEGORY_CONTAINER (rygel_lms_category_container_get_type ())
-+#define RYGEL_LMS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainer))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_CATEGORY_CONTAINER))
-+#define RYGEL_LMS_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_CATEGORY_CONTAINER, RygelLMSCategoryContainerClass))
-+
-+typedef struct _RygelLMSCategoryContainer RygelLMSCategoryContainer;
-+typedef struct _RygelLMSCategoryContainerClass RygelLMSCategoryContainerClass;
-+
-+#define RYGEL_LMS_TYPE_ALL_VIDEOS (rygel_lms_all_videos_get_type ())
-+#define RYGEL_LMS_ALL_VIDEOS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideos))
-+#define RYGEL_LMS_ALL_VIDEOS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideosClass))
-+#define RYGEL_LMS_IS_ALL_VIDEOS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS))
-+#define RYGEL_LMS_IS_ALL_VIDEOS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_ALL_VIDEOS))
-+#define RYGEL_LMS_ALL_VIDEOS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_ALL_VIDEOS, RygelLMSAllVideosClass))
-+
-+typedef struct _RygelLMSAllVideos RygelLMSAllVideos;
-+typedef struct _RygelLMSAllVideosClass RygelLMSAllVideosClass;
-+
-+#define RYGEL_LMS_TYPE_IMAGE_ROOT (rygel_lms_image_root_get_type ())
-+#define RYGEL_LMS_IMAGE_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRoot))
-+#define RYGEL_LMS_IMAGE_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRootClass))
-+#define RYGEL_LMS_IS_IMAGE_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT))
-+#define RYGEL_LMS_IS_IMAGE_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_IMAGE_ROOT))
-+#define RYGEL_LMS_IMAGE_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_IMAGE_ROOT, RygelLMSImageRootClass))
-+
-+typedef struct _RygelLMSImageRoot RygelLMSImageRoot;
-+typedef struct _RygelLMSImageRootClass RygelLMSImageRootClass;
-+
-+struct _RygelLMSRootContainer {
-+ RygelSimpleContainer parent_instance;
-+ RygelLMSRootContainerPrivate * priv;
-+};
-+
-+struct _RygelLMSRootContainerClass {
-+ RygelSimpleContainerClass parent_class;
-+};
-+
-+struct _RygelLMSRootContainerPrivate {
-+ RygelLMSDatabase* lms_db;
-+};
-+
-+typedef enum {
-+ RYGEL_LMS_DATABASE_ERROR_OPEN,
-+ RYGEL_LMS_DATABASE_ERROR_PREPARE,
-+ RYGEL_LMS_DATABASE_ERROR_BIND,
-+ RYGEL_LMS_DATABASE_ERROR_STEP,
-+ RYGEL_LMS_DATABASE_ERROR_NOT_FOUND
-+} RygelLMSDatabaseError;
-+#define RYGEL_LMS_DATABASE_ERROR rygel_lms_database_error_quark ()
-+
-+static gpointer rygel_lms_root_container_parent_class = NULL;
-+
-+GType rygel_lms_root_container_get_type (void) G_GNUC_CONST;
-+gpointer rygel_lms_database_ref (gpointer instance);
-+void rygel_lms_database_unref (gpointer instance);
-+GParamSpec* rygel_lms_param_spec_database (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-+void rygel_lms_value_set_database (GValue* value, gpointer v_object);
-+void rygel_lms_value_take_database (GValue* value, gpointer v_object);
-+gpointer rygel_lms_value_get_database (const GValue* value);
-+GType rygel_lms_database_get_type (void) G_GNUC_CONST;
-+#define RYGEL_LMS_ROOT_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainerPrivate))
-+enum {
-+ RYGEL_LMS_ROOT_CONTAINER_DUMMY_PROPERTY
-+};
-+RygelLMSRootContainer* rygel_lms_root_container_new (void);
-+RygelLMSRootContainer* rygel_lms_root_container_construct (GType object_type);
-+GQuark rygel_lms_database_error_quark (void);
-+RygelLMSDatabase* rygel_lms_database_new (GError** error);
-+RygelLMSDatabase* rygel_lms_database_construct (GType object_type, GError** error);
-+RygelLMSMusicRoot* rygel_lms_music_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSMusicRoot* rygel_lms_music_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_music_root_get_type (void) G_GNUC_CONST;
-+RygelLMSAllVideos* rygel_lms_all_videos_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSAllVideos* rygel_lms_all_videos_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_category_container_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_all_videos_get_type (void) G_GNUC_CONST;
-+RygelLMSImageRoot* rygel_lms_image_root_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+RygelLMSImageRoot* rygel_lms_image_root_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelLMSDatabase* lms_db);
-+GType rygel_lms_image_root_get_type (void) G_GNUC_CONST;
-+static void rygel_lms_root_container_finalize (GObject* obj);
-+
-+
-+RygelLMSRootContainer* rygel_lms_root_container_construct (GType object_type) {
-+ RygelLMSRootContainer * self = NULL;
-+ RygelMetaConfig* config = NULL;
-+ RygelMetaConfig* _tmp0_ = NULL;
-+ gchar* title = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ gchar* _tmp2_ = NULL;
-+ const gchar* _tmp6_ = NULL;
-+ GError * _inner_error_ = NULL;
-+ _tmp0_ = rygel_meta_config_get_default ();
-+ config = _tmp0_;
-+ _tmp1_ = _ ("Shared media");
-+ _tmp2_ = g_strdup (_tmp1_);
-+ title = _tmp2_;
-+ {
-+ gchar* _tmp3_ = NULL;
-+ gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ _tmp4_ = rygel_configuration_get_string ((RygelConfiguration*) config, "LightMediaScanner", "title", &_inner_error_);
-+ _tmp3_ = _tmp4_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ goto __catch0_g_error;
-+ }
-+ _tmp5_ = _tmp3_;
-+ _tmp3_ = NULL;
-+ _g_free0 (title);
-+ title = _tmp5_;
-+ _g_free0 (_tmp3_);
-+ }
-+ goto __finally0;
-+ __catch0_g_error:
-+ {
-+ GError* _error_ = NULL;
-+ _error_ = _inner_error_;
-+ _inner_error_ = NULL;
-+ _g_error_free0 (_error_);
-+ }
-+ __finally0:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (title);
-+ _g_object_unref0 (config);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _tmp6_ = title;
-+ self = (RygelLMSRootContainer*) rygel_simple_container_construct_root (object_type, _tmp6_);
-+ {
-+ RygelLMSDatabase* _tmp7_ = NULL;
-+ RygelLMSDatabase* _tmp8_ = NULL;
-+ RygelLMSDatabase* _tmp9_ = NULL;
-+ const gchar* _tmp10_ = NULL;
-+ RygelLMSDatabase* _tmp11_ = NULL;
-+ RygelLMSMusicRoot* _tmp12_ = NULL;
-+ RygelLMSMusicRoot* _tmp13_ = NULL;
-+ const gchar* _tmp14_ = NULL;
-+ RygelLMSDatabase* _tmp15_ = NULL;
-+ RygelLMSAllVideos* _tmp16_ = NULL;
-+ RygelLMSAllVideos* _tmp17_ = NULL;
-+ const gchar* _tmp18_ = NULL;
-+ RygelLMSDatabase* _tmp19_ = NULL;
-+ RygelLMSImageRoot* _tmp20_ = NULL;
-+ RygelLMSImageRoot* _tmp21_ = NULL;
-+ _tmp8_ = rygel_lms_database_new (&_inner_error_);
-+ _tmp7_ = _tmp8_;
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ if (_inner_error_->domain == RYGEL_LMS_DATABASE_ERROR) {
-+ goto __catch1_rygel_lms_database_error;
-+ }
-+ _g_free0 (title);
-+ _g_object_unref0 (config);
-+ g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _tmp9_ = _tmp7_;
-+ _tmp7_ = NULL;
-+ _rygel_lms_database_unref0 (self->priv->lms_db);
-+ self->priv->lms_db = _tmp9_;
-+ _tmp10_ = _ ("Music");
-+ _tmp11_ = self->priv->lms_db;
-+ _tmp12_ = rygel_lms_music_root_new ("music", (RygelMediaContainer*) self, _tmp10_, _tmp11_);
-+ _tmp13_ = _tmp12_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp13_);
-+ _g_object_unref0 (_tmp13_);
-+ _tmp14_ = _ ("Videos");
-+ _tmp15_ = self->priv->lms_db;
-+ _tmp16_ = rygel_lms_all_videos_new ("all-videos", (RygelMediaContainer*) self, _tmp14_, _tmp15_);
-+ _tmp17_ = _tmp16_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp17_);
-+ _g_object_unref0 (_tmp17_);
-+ _tmp18_ = _ ("Pictures");
-+ _tmp19_ = self->priv->lms_db;
-+ _tmp20_ = rygel_lms_image_root_new ("images", (RygelMediaContainer*) self, _tmp18_, _tmp19_);
-+ _tmp21_ = _tmp20_;
-+ rygel_simple_container_add_child_container ((RygelSimpleContainer*) self, (RygelMediaContainer*) _tmp21_);
-+ _g_object_unref0 (_tmp21_);
-+ _rygel_lms_database_unref0 (_tmp7_);
-+ }
-+ goto __finally1;
-+ __catch1_rygel_lms_database_error:
-+ {
-+ GError* e = NULL;
-+ GError* _tmp22_ = NULL;
-+ const gchar* _tmp23_ = NULL;
-+ e = _inner_error_;
-+ _inner_error_ = NULL;
-+ _tmp22_ = e;
-+ _tmp23_ = _tmp22_->message;
-+ g_warning ("rygel-lms-root-container.vala:49: %s\n", _tmp23_);
-+ _g_error_free0 (e);
-+ }
-+ __finally1:
-+ if (G_UNLIKELY (_inner_error_ != NULL)) {
-+ _g_free0 (title);
-+ _g_object_unref0 (config);
-+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-+ g_clear_error (&_inner_error_);
-+ return NULL;
-+ }
-+ _g_free0 (title);
-+ _g_object_unref0 (config);
-+ return self;
-+}
-+
-+
-+RygelLMSRootContainer* rygel_lms_root_container_new (void) {
-+ return rygel_lms_root_container_construct (RYGEL_LMS_TYPE_ROOT_CONTAINER);
-+}
-+
-+
-+static void rygel_lms_root_container_class_init (RygelLMSRootContainerClass * klass) {
-+ rygel_lms_root_container_parent_class = g_type_class_peek_parent (klass);
-+ g_type_class_add_private (klass, sizeof (RygelLMSRootContainerPrivate));
-+ G_OBJECT_CLASS (klass)->finalize = rygel_lms_root_container_finalize;
-+}
-+
-+
-+static void rygel_lms_root_container_instance_init (RygelLMSRootContainer * self) {
-+ self->priv = RYGEL_LMS_ROOT_CONTAINER_GET_PRIVATE (self);
-+ self->priv->lms_db = NULL;
-+}
-+
-+
-+static void rygel_lms_root_container_finalize (GObject* obj) {
-+ RygelLMSRootContainer * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_ROOT_CONTAINER, RygelLMSRootContainer);
-+ _rygel_lms_database_unref0 (self->priv->lms_db);
-+ G_OBJECT_CLASS (rygel_lms_root_container_parent_class)->finalize (obj);
-+}
-+
-+
-+GType rygel_lms_root_container_get_type (void) {
-+ static volatile gsize rygel_lms_root_container_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_root_container_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSRootContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_root_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSRootContainer), 0, (GInstanceInitFunc) rygel_lms_root_container_instance_init, NULL };
-+ GType rygel_lms_root_container_type_id;
-+ rygel_lms_root_container_type_id = g_type_register_static (RYGEL_TYPE_SIMPLE_CONTAINER, "RygelLMSRootContainer", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_root_container_type_id__volatile, rygel_lms_root_container_type_id);
-+ }
-+ return rygel_lms_root_container_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-sql-function.c b/src/plugins/lms/rygel-lms-sql-function.c
-new file mode 100644
-index 0000000..a56c7be
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-sql-function.c
-@@ -0,0 +1,146 @@
-+/* rygel-lms-sql-function.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-sql-function.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
-+ *
-+ * Author: Jens Georg <mail@jensge.org>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+
-+#define RYGEL_LMS_TYPE_SQL_OPERATOR (rygel_lms_sql_operator_get_type ())
-+#define RYGEL_LMS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperator))
-+#define RYGEL_LMS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+#define RYGEL_LMS_IS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_IS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_SQL_OPERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+
-+typedef struct _RygelLMSSqlOperator RygelLMSSqlOperator;
-+typedef struct _RygelLMSSqlOperatorClass RygelLMSSqlOperatorClass;
-+typedef struct _RygelLMSSqlOperatorPrivate RygelLMSSqlOperatorPrivate;
-+
-+#define RYGEL_LMS_TYPE_SQL_FUNCTION (rygel_lms_sql_function_get_type ())
-+#define RYGEL_LMS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunction))
-+#define RYGEL_LMS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunctionClass))
-+#define RYGEL_LMS_IS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION))
-+#define RYGEL_LMS_IS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_SQL_FUNCTION))
-+#define RYGEL_LMS_SQL_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_SQL_FUNCTION, RygelLMSSqlFunctionClass))
-+
-+typedef struct _RygelLMSSqlFunction RygelLMSSqlFunction;
-+typedef struct _RygelLMSSqlFunctionClass RygelLMSSqlFunctionClass;
-+typedef struct _RygelLMSSqlFunctionPrivate RygelLMSSqlFunctionPrivate;
-+
-+struct _RygelLMSSqlOperator {
-+ GObject parent_instance;
-+ RygelLMSSqlOperatorPrivate * priv;
-+ gchar* name;
-+ gchar* arg;
-+ gchar* collate;
-+};
-+
-+struct _RygelLMSSqlOperatorClass {
-+ GObjectClass parent_class;
-+ gchar* (*to_string) (RygelLMSSqlOperator* self);
-+};
-+
-+struct _RygelLMSSqlFunction {
-+ RygelLMSSqlOperator parent_instance;
-+ RygelLMSSqlFunctionPrivate * priv;
-+};
-+
-+struct _RygelLMSSqlFunctionClass {
-+ RygelLMSSqlOperatorClass parent_class;
-+};
-+
-+
-+static gpointer rygel_lms_sql_function_parent_class = NULL;
-+
-+GType rygel_lms_sql_operator_get_type (void) G_GNUC_CONST;
-+GType rygel_lms_sql_function_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_SQL_FUNCTION_DUMMY_PROPERTY
-+};
-+RygelLMSSqlFunction* rygel_lms_sql_function_new (const gchar* name, const gchar* arg);
-+RygelLMSSqlFunction* rygel_lms_sql_function_construct (GType object_type, const gchar* name, const gchar* arg);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate);
-+static gchar* rygel_lms_sql_function_real_to_string (RygelLMSSqlOperator* base);
-+
-+
-+RygelLMSSqlFunction* rygel_lms_sql_function_construct (GType object_type, const gchar* name, const gchar* arg) {
-+ RygelLMSSqlFunction * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ g_return_val_if_fail (name != NULL, NULL);
-+ g_return_val_if_fail (arg != NULL, NULL);
-+ _tmp0_ = name;
-+ _tmp1_ = arg;
-+ self = (RygelLMSSqlFunction*) rygel_lms_sql_operator_construct (object_type, _tmp0_, _tmp1_, "");
-+ return self;
-+}
-+
-+
-+RygelLMSSqlFunction* rygel_lms_sql_function_new (const gchar* name, const gchar* arg) {
-+ return rygel_lms_sql_function_construct (RYGEL_LMS_TYPE_SQL_FUNCTION, name, arg);
-+}
-+
-+
-+static gchar* rygel_lms_sql_function_real_to_string (RygelLMSSqlOperator* base) {
-+ RygelLMSSqlFunction * self;
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ gchar* _tmp2_ = NULL;
-+ self = (RygelLMSSqlFunction*) base;
-+ _tmp0_ = ((RygelLMSSqlOperator*) self)->name;
-+ _tmp1_ = ((RygelLMSSqlOperator*) self)->arg;
-+ _tmp2_ = g_strdup_printf ("%s(%s,?)", _tmp0_, _tmp1_);
-+ result = _tmp2_;
-+ return result;
-+}
-+
-+
-+static void rygel_lms_sql_function_class_init (RygelLMSSqlFunctionClass * klass) {
-+ rygel_lms_sql_function_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSSqlOperatorClass *) klass)->to_string = rygel_lms_sql_function_real_to_string;
-+}
-+
-+
-+static void rygel_lms_sql_function_instance_init (RygelLMSSqlFunction * self) {
-+}
-+
-+
-+GType rygel_lms_sql_function_get_type (void) {
-+ static volatile gsize rygel_lms_sql_function_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_sql_function_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSSqlFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_sql_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSSqlFunction), 0, (GInstanceInitFunc) rygel_lms_sql_function_instance_init, NULL };
-+ GType rygel_lms_sql_function_type_id;
-+ rygel_lms_sql_function_type_id = g_type_register_static (RYGEL_LMS_TYPE_SQL_OPERATOR, "RygelLMSSqlFunction", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_sql_function_type_id__volatile, rygel_lms_sql_function_type_id);
-+ }
-+ return rygel_lms_sql_function_type_id__volatile;
-+}
-+
-+
-+
-diff --git a/src/plugins/lms/rygel-lms-sql-operator.c b/src/plugins/lms/rygel-lms-sql-operator.c
-new file mode 100644
-index 0000000..90db1a9
---- /dev/null
-+++ b/src/plugins/lms/rygel-lms-sql-operator.c
-@@ -0,0 +1,240 @@
-+/* rygel-lms-sql-operator.c generated by valac 0.28.0, the Vala compiler
-+ * generated from rygel-lms-sql-operator.vala, do not modify */
-+
-+/*
-+ * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
-+ *
-+ * Author: Jens Georg <mail@jensge.org>
-+ *
-+ * This file is part of Rygel.
-+ *
-+ * Rygel is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * Rygel is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ */
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <libgupnp-av/gupnp-av.h>
-+
-+
-+#define RYGEL_LMS_TYPE_SQL_OPERATOR (rygel_lms_sql_operator_get_type ())
-+#define RYGEL_LMS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperator))
-+#define RYGEL_LMS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+#define RYGEL_LMS_IS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_IS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_LMS_TYPE_SQL_OPERATOR))
-+#define RYGEL_LMS_SQL_OPERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperatorClass))
-+
-+typedef struct _RygelLMSSqlOperator RygelLMSSqlOperator;
-+typedef struct _RygelLMSSqlOperatorClass RygelLMSSqlOperatorClass;
-+typedef struct _RygelLMSSqlOperatorPrivate RygelLMSSqlOperatorPrivate;
-+#define _g_free0(var) (var = (g_free (var), NULL))
-+
-+struct _RygelLMSSqlOperator {
-+ GObject parent_instance;
-+ RygelLMSSqlOperatorPrivate * priv;
-+ gchar* name;
-+ gchar* arg;
-+ gchar* collate;
-+};
-+
-+struct _RygelLMSSqlOperatorClass {
-+ GObjectClass parent_class;
-+ gchar* (*to_string) (RygelLMSSqlOperator* self);
-+};
-+
-+
-+static gpointer rygel_lms_sql_operator_parent_class = NULL;
-+
-+GType rygel_lms_sql_operator_get_type (void) G_GNUC_CONST;
-+enum {
-+ RYGEL_LMS_SQL_OPERATOR_DUMMY_PROPERTY
-+};
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new_from_search_criteria_op (GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct_from_search_criteria_op (GType object_type, GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-+gchar* rygel_lms_sql_operator_to_string (RygelLMSSqlOperator* self);
-+static gchar* rygel_lms_sql_operator_real_to_string (RygelLMSSqlOperator* self);
-+static void rygel_lms_sql_operator_finalize (GObject* obj);
-+
-+
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate) {
-+ RygelLMSSqlOperator * self = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ gchar* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ const gchar* _tmp4_ = NULL;
-+ gchar* _tmp5_ = NULL;
-+ g_return_val_if_fail (name != NULL, NULL);
-+ g_return_val_if_fail (arg != NULL, NULL);
-+ g_return_val_if_fail (collate != NULL, NULL);
-+ self = (RygelLMSSqlOperator*) g_object_new (object_type, NULL);
-+ _tmp0_ = name;
-+ _tmp1_ = g_strdup (_tmp0_);
-+ _g_free0 (self->name);
-+ self->name = _tmp1_;
-+ _tmp2_ = arg;
-+ _tmp3_ = g_strdup (_tmp2_);
-+ _g_free0 (self->arg);
-+ self->arg = _tmp3_;
-+ _tmp4_ = collate;
-+ _tmp5_ = g_strdup (_tmp4_);
-+ _g_free0 (self->collate);
-+ self->collate = _tmp5_;
-+ return self;
-+}
-+
-+
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate) {
-+ return rygel_lms_sql_operator_construct (RYGEL_LMS_TYPE_SQL_OPERATOR, name, arg, collate);
-+}
-+
-+
-+RygelLMSSqlOperator* rygel_lms_sql_operator_construct_from_search_criteria_op (GType object_type, GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate) {
-+ RygelLMSSqlOperator * self = NULL;
-+ gchar* sql = NULL;
-+ GUPnPSearchCriteriaOp _tmp0_ = 0;
-+ const gchar* _tmp7_ = NULL;
-+ const gchar* _tmp8_ = NULL;
-+ const gchar* _tmp9_ = NULL;
-+ g_return_val_if_fail (arg != NULL, NULL);
-+ g_return_val_if_fail (collate != NULL, NULL);
-+ sql = NULL;
-+ _tmp0_ = op;
-+ switch (_tmp0_) {
-+ case GUPNP_SEARCH_CRITERIA_OP_EQ:
-+ {
-+ gchar* _tmp1_ = NULL;
-+ _tmp1_ = g_strdup ("=");
-+ _g_free0 (sql);
-+ sql = _tmp1_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_NEQ:
-+ {
-+ gchar* _tmp2_ = NULL;
-+ _tmp2_ = g_strdup ("!=");
-+ _g_free0 (sql);
-+ sql = _tmp2_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_LESS:
-+ {
-+ gchar* _tmp3_ = NULL;
-+ _tmp3_ = g_strdup ("<");
-+ _g_free0 (sql);
-+ sql = _tmp3_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_LEQ:
-+ {
-+ gchar* _tmp4_ = NULL;
-+ _tmp4_ = g_strdup ("<=");
-+ _g_free0 (sql);
-+ sql = _tmp4_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_GREATER:
-+ {
-+ gchar* _tmp5_ = NULL;
-+ _tmp5_ = g_strdup (">");
-+ _g_free0 (sql);
-+ sql = _tmp5_;
-+ break;
-+ }
-+ case GUPNP_SEARCH_CRITERIA_OP_GEQ:
-+ {
-+ gchar* _tmp6_ = NULL;
-+ _tmp6_ = g_strdup (">=");
-+ _g_free0 (sql);
-+ sql = _tmp6_;
-+ break;
-+ }
-+ default:
-+ {
-+ g_assert_not_reached ();
-+ }
-+ }
-+ _tmp7_ = sql;
-+ _tmp8_ = arg;
-+ _tmp9_ = collate;
-+ self = (RygelLMSSqlOperator*) rygel_lms_sql_operator_construct (object_type, _tmp7_, _tmp8_, _tmp9_);
-+ _g_free0 (sql);
-+ return self;
-+}
-+
-+
-+RygelLMSSqlOperator* rygel_lms_sql_operator_new_from_search_criteria_op (GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate) {
-+ return rygel_lms_sql_operator_construct_from_search_criteria_op (RYGEL_LMS_TYPE_SQL_OPERATOR, op, arg, collate);
-+}
-+
-+
-+static gchar* rygel_lms_sql_operator_real_to_string (RygelLMSSqlOperator* self) {
-+ gchar* result = NULL;
-+ const gchar* _tmp0_ = NULL;
-+ const gchar* _tmp1_ = NULL;
-+ const gchar* _tmp2_ = NULL;
-+ gchar* _tmp3_ = NULL;
-+ _tmp0_ = self->arg;
-+ _tmp1_ = self->name;
-+ _tmp2_ = self->collate;
-+ _tmp3_ = g_strdup_printf ("(%s %s ? %s)", _tmp0_, _tmp1_, _tmp2_);
-+ result = _tmp3_;
-+ return result;
-+}
-+
-+
-+gchar* rygel_lms_sql_operator_to_string (RygelLMSSqlOperator* self) {
-+ g_return_val_if_fail (self != NULL, NULL);
-+ return RYGEL_LMS_SQL_OPERATOR_GET_CLASS (self)->to_string (self);
-+}
-+
-+
-+static void rygel_lms_sql_operator_class_init (RygelLMSSqlOperatorClass * klass) {
-+ rygel_lms_sql_operator_parent_class = g_type_class_peek_parent (klass);
-+ ((RygelLMSSqlOperatorClass *) klass)->to_string = rygel_lms_sql_operator_real_to_string;
-+ G_OBJECT_CLASS (klass)->finalize = rygel_lms_sql_operator_finalize;
-+}
-+
-+
-+static void rygel_lms_sql_operator_instance_init (RygelLMSSqlOperator * self) {
-+}
-+
-+
-+static void rygel_lms_sql_operator_finalize (GObject* obj) {
-+ RygelLMSSqlOperator * self;
-+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_LMS_TYPE_SQL_OPERATOR, RygelLMSSqlOperator);
-+ _g_free0 (self->name);
-+ _g_free0 (self->arg);
-+ _g_free0 (self->collate);
-+ G_OBJECT_CLASS (rygel_lms_sql_operator_parent_class)->finalize (obj);
-+}
-+
-+
-+GType rygel_lms_sql_operator_get_type (void) {
-+ static volatile gsize rygel_lms_sql_operator_type_id__volatile = 0;
-+ if (g_once_init_enter (&rygel_lms_sql_operator_type_id__volatile)) {
-+ static const GTypeInfo g_define_type_info = { sizeof (RygelLMSSqlOperatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_lms_sql_operator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelLMSSqlOperator), 0, (GInstanceInitFunc) rygel_lms_sql_operator_instance_init, NULL };
-+ GType rygel_lms_sql_operator_type_id;
-+ rygel_lms_sql_operator_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelLMSSqlOperator", &g_define_type_info, 0);
-+ g_once_init_leave (&rygel_lms_sql_operator_type_id__volatile, rygel_lms_sql_operator_type_id);
-+ }
-+ return rygel_lms_sql_operator_type_id__volatile;
-+}
-+
-+
-+
---
-1.8.3.1
-
diff --git a/meta-agl/recipes-connectivity/rygel/rygel_%.bbappend b/meta-agl/recipes-connectivity/rygel/rygel_%.bbappend
index bfee4f569..4ae59259f 100644
--- a/meta-agl/recipes-connectivity/rygel/rygel_%.bbappend
+++ b/meta-agl/recipes-connectivity/rygel/rygel_%.bbappend
@@ -5,28 +5,21 @@ PACKAGECONFIG = "media-export lms"
PACKAGECONFIG[lms] = "--enable-lms-plugin,--disable-lms-plugin,sqlite3"
# LightMediaScanner plugin patches
-SRC_URI += "file://0001-Add-LightMediaScanner-plugin.patch \
- file://0002-lms-add-C-source-files.patch \
- file://0001-Fix-missing-link-to-unistring-for-lms-plugin.patch \
- file://rygel.service \
- "
+SRC_URI += "\
+ file://0001-Fix-missing-link-to-unistring-for-lms-plugin.patch \
+ file://rygel.service \
+"
-inherit systemd
+do_install_prepend() {
+ # Install rygel systemd service
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -m 644 -p -D ${WORKDIR}/rygel.service ${D}${systemd_user_unitdir}/rygel.service
-do_install_append() {
- # Install rygel systemd service
- if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
- install -m 644 -p -D ${WORKDIR}/rygel.service ${D}${systemd_user_unitdir}/rygel.service
-
- # Execute these manually on behalf of systemctl script (from systemd-systemctl-native.bb)
- # because it does not support systemd's user mode.
- # However, systemctl --global should be checked
- #mkdir -p ${D}/etc/systemd/user/default.target.wants/
- #ln -sf ${systemd_user_unitdir}/rygel.service ${D}/etc/systemd/user/dbus-org.gnome.Rygel1.service
- #ln -sf ${systemd_user_unitdir}/rygel.service ${D}/etc/systemd/user/default.target.wants/rygel.service
- fi
+ # Execute these manually on behalf of systemctl script (from systemd-systemctl-native.bb)
+ # because it does not support systemd's user mode.
+ # However, systemctl --global should be checked
+ #mkdir -p ${D}/etc/systemd/user/default.target.wants/
+ #ln -sf ${systemd_user_unitdir}/rygel.service ${D}/etc/systemd/user/dbus-org.gnome.Rygel1.service
+ #ln -sf ${systemd_user_unitdir}/rygel.service ${D}/etc/systemd/user/default.target.wants/rygel.service
+ fi
}
-
-FILES_${PN} += " \
- ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/rygel.service', '', d)} \
- "
diff --git a/meta-agl/recipes-core/glibc/glibc/arm/local-arm-futex.diff b/meta-agl/recipes-core/glibc/glibc/arm/local-arm-futex.diff
index c6b9d53a1..27d1144d0 100644
--- a/meta-agl/recipes-core/glibc/glibc/arm/local-arm-futex.diff
+++ b/meta-agl/recipes-core/glibc/glibc/arm/local-arm-futex.diff
@@ -18,6 +18,5 @@ Last-Update: 2015-03-25
configuration. */
-#if __LINUX_KERNEL_VERSION < 0x030E03
+#if __LINUX_KERNEL_VERSION < 0x020620
- # undef __ASSUME_REQUEUE_PI
# undef __ASSUME_SET_ROBUST_LIST
#endif
diff --git a/meta-agl/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch b/meta-agl/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch
new file mode 100644
index 000000000..46445be73
--- /dev/null
+++ b/meta-agl/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch
@@ -0,0 +1,52 @@
+From 6cc74075797edb6f698cb7f312bb1c3d8cc6cb28 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 12 Oct 2017 17:17:56 +0200
+Subject: [PATCH] Switch Smack label earlier
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Switching label after removing capability isn't
+possible.
+
+Change-Id: Ib7dac8f071f36119520ed3205d743c1e3df3cd5e
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/core/execute.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/src/core/execute.c b/src/core/execute.c
+index d72e5bf08..0abffd569 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -2707,6 +2707,13 @@ static int exec_child(
+ }
+ }
+
++ r = setup_smack(context, command);
++ if (r < 0) {
++ *exit_status = EXIT_SMACK_PROCESS_LABEL;
++ *error_message = strdup("Failed to set SMACK process label");
++ return r;
++ }
++
+ if (!cap_test_all(context->capability_bounding_set)) {
+ r = capability_bounding_set_drop(context->capability_bounding_set, false);
+ if (r < 0) {
+@@ -2775,13 +2782,6 @@ static int exec_child(
+ }
+ #endif
+
+- r = setup_smack(context, command);
+- if (r < 0) {
+- *exit_status = EXIT_SMACK_PROCESS_LABEL;
+- *error_message = strdup("Failed to set SMACK process label");
+- return r;
+- }
+-
+ #ifdef HAVE_APPARMOR
+ if (context->apparmor_profile && mac_apparmor_use()) {
+ r = aa_change_onexec(context->apparmor_profile);
+--
+2.14.3
+
diff --git a/meta-agl/recipes-core/systemd/systemd/backport-v234-e266c06.patch b/meta-agl/recipes-core/systemd/systemd/backport-v234-e266c06.patch
deleted file mode 100644
index 1f4a23ea7..000000000
--- a/meta-agl/recipes-core/systemd/systemd/backport-v234-e266c06.patch
+++ /dev/null
@@ -1,315 +0,0 @@
-commit e266c068b5597e18b2299f9c9d3ee6cf04198c41
-Author: Michal Sekletar <msekleta@redhat.com>
-Date: Mon Jan 23 17:12:35 2017 +0100
-
- service: serialize information about currently executing command
-
- Stored information will help us to resume execution after the
- daemon-reload.
-
- This commit implements following scheme,
-
- * On serialization:
- - we count rank of the currently executing command
- - we store command type, its rank and command line arguments
-
- * On deserialization:
- - configuration is parsed and loaded
- - we deserialize stored data, command type, rank and arguments
- - we look at the given rank in the list and if command there has same
- arguments then we restore execution at that point
- - otherwise we search respective command list and we look for command
- that has the same arguments
- - if both methods fail we do not do not resume execution at all
-
- To better illustrate how does above scheme works, please consider
- following cases (<<< denotes position where we resume execution after reload)
-
- ; Original unit file
- [Service]
- ExecStart=/bin/true <<<
- ExecStart=/bin/false
-
- ; Swapped commands
- ; Second command is not going to be executed
- [Service]
- ExecStart=/bin/false
- ExecStart=/bin/true <<<
-
- ; Commands added before
- ; Same commands are problematic and execution could be restarted at wrong place
- [Service]
- ExecStart=/bin/foo
- ExecStart=/bin/bar
- ExecStart=/bin/true <<<
- ExecStart=/bin/false
-
- ; Commands added after
- ; Same commands are not an issue in this case
- [Service]
- ExecStart=/bin/true <<<
- ExecStart=/bin/false
- ExecStart=/bin/foo
- ExecStart=/bin/bar
-
- ; New commands interleaved with old commands
- ; Some new commands will be executed while others won't
- ExecStart=/bin/foo
- ExecStart=/bin/true <<<
- ExecStart=/bin/bar
- ExecStart=/bin/false
-
- As you can see, above scheme has some drawbacks. However, in most
- cases (we assume that in most common case unit file command list is not
- changed while some other command is running for the same unit) it
- should cause that systemd does the right thing, which is restoring
- execution exactly at the point we were before daemon-reload.
-
- Fixes #518
-
-Signed-off-by: Scott Murray <scott.murray@konsulko.com>
-
-Upstream-Status: backport
-
-diff --git a/src/core/service.c b/src/core/service.c
-index 74054887b..5e681fb71 100644
---- a/src/core/service.c
-+++ b/src/core/service.c
-@@ -45,6 +45,7 @@
- #include "service.h"
- #include "signal-util.h"
- #include "special.h"
-+#include "stdio-util.h"
- #include "string-table.h"
- #include "string-util.h"
- #include "strv.h"
-@@ -2140,6 +2141,80 @@ _pure_ static bool service_can_reload(Unit *u) {
- return !!s->exec_command[SERVICE_EXEC_RELOAD];
- }
-
-+static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecCommand *current) {
-+ Service *s = SERVICE(u);
-+ unsigned idx = 0;
-+ ExecCommand *first, *c;
-+
-+ assert(s);
-+
-+ first = s->exec_command[id];
-+
-+ /* Figure out where we are in the list by walking back to the beginning */
-+ for (c = current; c != first; c = c->command_prev)
-+ idx++;
-+
-+ return idx;
-+}
-+
-+static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command) {
-+ Service *s = SERVICE(u);
-+ ServiceExecCommand id;
-+ unsigned idx;
-+ const char *type;
-+ char **arg;
-+ _cleanup_strv_free_ char **escaped_args = NULL;
-+ _cleanup_free_ char *args = NULL, *p = NULL;
-+ size_t allocated = 0, length = 0;
-+
-+ assert(s);
-+ assert(f);
-+
-+ if (!command)
-+ return 0;
-+
-+ if (command == s->control_command) {
-+ type = "control";
-+ id = s->control_command_id;
-+ } else {
-+ type = "main";
-+ id = SERVICE_EXEC_START;
-+ }
-+
-+ idx = service_exec_command_index(u, id, command);
-+
-+ STRV_FOREACH(arg, command->argv) {
-+ size_t n;
-+ _cleanup_free_ char *e = NULL;
-+
-+ e = xescape(*arg, WHITESPACE);
-+ if (!e)
-+ return -ENOMEM;
-+
-+ n = strlen(e);
-+ if (!GREEDY_REALLOC(args, allocated, length + 1 + n + 1))
-+ return -ENOMEM;
-+
-+ if (length > 0)
-+ args[length++] = ' ';
-+
-+ memcpy(args + length, e, n);
-+ length += n;
-+ }
-+
-+ if (!GREEDY_REALLOC(args, allocated, length + 1))
-+ return -ENOMEM;
-+ args[length++] = 0;
-+
-+ p = xescape(command->path, WHITESPACE);
-+ if (!p)
-+ return -ENOMEM;
-+
-+ fprintf(f, "%s-command=%s %u %s %s\n", type, service_exec_command_to_string(id), idx, p, args);
-+
-+ return 0;
-+}
-+
- static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
- Service *s = SERVICE(u);
- ServiceFDStore *fs;
-@@ -2167,11 +2242,8 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
- if (r < 0)
- return r;
-
-- /* FIXME: There's a minor uncleanliness here: if there are
-- * multiple commands attached here, we will start from the
-- * first one again */
-- if (s->control_command_id >= 0)
-- unit_serialize_item(u, f, "control-command", service_exec_command_to_string(s->control_command_id));
-+ service_serialize_exec_command(u, f, s->control_command);
-+ service_serialize_exec_command(u, f, s->main_command);
-
- r = unit_serialize_item_fd(u, f, fds, "stdin-fd", s->stdin_fd);
- if (r < 0)
-@@ -2227,6 +2299,106 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
- return 0;
- }
-
-+static int service_deserialize_exec_command(Unit *u, const char *key, const char *value) {
-+ Service *s = SERVICE(u);
-+ int r;
-+ unsigned idx = 0, i;
-+ bool control, found = false;
-+ ServiceExecCommand id = _SERVICE_EXEC_COMMAND_INVALID;
-+ ExecCommand *command = NULL;
-+ _cleanup_free_ char *args = NULL, *path = NULL;
-+ _cleanup_strv_free_ char **argv = NULL;
-+
-+ enum ExecCommandState {
-+ STATE_EXEC_COMMAND_TYPE,
-+ STATE_EXEC_COMMAND_INDEX,
-+ STATE_EXEC_COMMAND_PATH,
-+ STATE_EXEC_COMMAND_ARGS,
-+ _STATE_EXEC_COMMAND_MAX,
-+ _STATE_EXEC_COMMAND_INVALID = -1,
-+ } state;
-+
-+ assert(s);
-+ assert(key);
-+ assert(value);
-+
-+ control = streq(key, "control-command");
-+
-+ state = STATE_EXEC_COMMAND_TYPE;
-+
-+ for (;;) {
-+ _cleanup_free_ char *arg = NULL;
-+
-+ r = extract_first_word(&value, &arg, NULL, EXTRACT_CUNESCAPE);
-+ if (r == 0)
-+ break;
-+ else if (r < 0)
-+ return r;
-+
-+ switch (state) {
-+ case STATE_EXEC_COMMAND_TYPE:
-+ id = service_exec_command_from_string(arg);
-+ if (id < 0)
-+ return -EINVAL;
-+
-+ state = STATE_EXEC_COMMAND_INDEX;
-+ break;
-+ case STATE_EXEC_COMMAND_INDEX:
-+ r = safe_atou(arg, &idx);
-+ if (r < 0)
-+ return -EINVAL;
-+
-+ state = STATE_EXEC_COMMAND_PATH;
-+ break;
-+ case STATE_EXEC_COMMAND_PATH:
-+ path = arg;
-+ arg = NULL;
-+ state = STATE_EXEC_COMMAND_ARGS;
-+
-+ if (!path_is_absolute(path))
-+ return -EINVAL;
-+ break;
-+ case STATE_EXEC_COMMAND_ARGS:
-+ r = strv_extend(&argv, arg);
-+ if (r < 0)
-+ return -ENOMEM;
-+ break;
-+ default:
-+ assert_not_reached("Unknown error at deserialization of exec command");
-+ break;
-+ }
-+ }
-+
-+ if (state != STATE_EXEC_COMMAND_ARGS)
-+ return -EINVAL;
-+
-+ /* Let's check whether exec command on given offset matches data that we just deserialized */
-+ for (command = s->exec_command[id], i = 0; command; command = command->command_next, i++) {
-+ if (i != idx)
-+ continue;
-+
-+ found = strv_equal(argv, command->argv) && streq(command->path, path);
-+ break;
-+ }
-+
-+ if (!found) {
-+ /* Command at the index we serialized is different, let's look for command that exactly
-+ * matches but is on different index. If there is no such command we will not resume execution. */
-+ for (command = s->exec_command[id]; command; command = command->command_next)
-+ if (strv_equal(command->argv, argv) && streq(command->path, path))
-+ break;
-+ }
-+
-+ if (command && control)
-+ s->control_command = command;
-+ else if (command)
-+ s->main_command = command;
-+ else
-+ log_unit_warning(u, "Current command vanished from the unit file, execution of the command list won't be resumed.");
-+
-+ return 0;
-+}
-+
- static int service_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
- Service *s = SERVICE(u);
- int r;
-@@ -2309,16 +2481,6 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
- s->status_text = t;
- }
-
-- } else if (streq(key, "control-command")) {
-- ServiceExecCommand id;
--
-- id = service_exec_command_from_string(value);
-- if (id < 0)
-- log_unit_debug(u, "Failed to parse exec-command value: %s", value);
-- else {
-- s->control_command_id = id;
-- s->control_command = s->exec_command[id];
-- }
- } else if (streq(key, "accept-socket")) {
- Unit *socket;
-
-@@ -2437,6 +2599,10 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
- s->watchdog_override_enable = true;
- s->watchdog_override_usec = watchdog_override_usec;
- }
-+ } else if (STR_IN_SET(key, "main-command", "control-command")) {
-+ r = service_deserialize_exec_command(u, key, value);
-+ if (r < 0)
-+ log_unit_debug_errno(u, r, "Failed to parse serialized command \"%s\": %m", value);
- } else
- log_unit_debug(u, "Unknown serialization key: %s", key);
-
diff --git a/meta-agl/recipes-core/systemd/systemd_%.bbappend b/meta-agl/recipes-core/systemd/systemd_%.bbappend
index 354464c12..f64ca8c8a 100644
--- a/meta-agl/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-agl/recipes-core/systemd/systemd_%.bbappend
@@ -1,9 +1,9 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI += "file://backport-v234-e266c06.patch \
- file://e2fsck.conf \
- ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','systemd','file://wired.network','',d)} \
- "
+SRC_URI += "\
+ file://e2fsck.conf \
+ ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','systemd','file://wired.network','',d)} \
+"
# enable networkd/resolved support
PACKAGECONFIG_append_pn-systemd = " \
diff --git a/meta-agl/recipes-core/systemd/systemd_234.bbappend b/meta-agl/recipes-core/systemd/systemd_234.bbappend
new file mode 100644
index 000000000..4df7684d0
--- /dev/null
+++ b/meta-agl/recipes-core/systemd/systemd_234.bbappend
@@ -0,0 +1,6 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "\
+ file://0001-Switch-Smack-label-earlier.patch \
+"
+
diff --git a/meta-agl/recipes-core/xmlsec1/xmlsec1_1.2.20.bb b/meta-agl/recipes-core/xmlsec1/xmlsec1_1.2.20.bb
deleted file mode 100644
index 7faf7bfd4..000000000
--- a/meta-agl/recipes-core/xmlsec1/xmlsec1_1.2.20.bb
+++ /dev/null
@@ -1,40 +0,0 @@
-inherit autotools pkgconfig
-
-SUMMARY = "Library providing support for "XML Signature" and "XML Encryption" standards"
-DESCRIPTION = "XML Security Library is a C library based on LibXML2 and OpenSSL. \
-The library was created with a goal to support major XML security \
-standards "XML Digital Signature" and "XML Encryption". \
-"
-
-HOMEPAGE = "https://www.aleksey.com/xmlsec"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://Copyright;md5=32e47e213c77c55d2c666351d7ce16b5"
-
-SRC_URI = "git://git.gnome.org/xmlsec;branch=master;protocol=git"
-SRCREV = "84c8281cf927b1cdcc38f343f61c3aa448a5a10f"
-
-SECTION = "base"
-
-S = "${WORKDIR}/git"
-
-RDEPENDS_${PN} = "openssl libxml2"
-
-# choice is made to use openssl only and to not use xslt
-# nss would be a valuable choice
-EXTRA_OECONF = "\
- --disable-crypto-dl \
- --disable-apps-crypto-dl \
- --enable-shared \
- --disable-static \
- --without-gnutls \
- --without-gcrypt \
- --without-nss \
- --without-libxslt \
-"
-
-do_install_append() {
- # discarding this optional file is good for AGL
- rm ${D}${libdir}/xmlsec1Conf.sh
-}
-
-
diff --git a/meta-agl/recipes-devtools/autogen/autogen-native_5.18.12.bbappend b/meta-agl/recipes-devtools/autogen/autogen-native_5.18.12.bbappend
deleted file mode 100644
index a6f697cdb..000000000
--- a/meta-agl/recipes-devtools/autogen/autogen-native_5.18.12.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI_append = "file://0003-autoopts-mk-tpl-config.sh-fix-shell-path.patch"
diff --git a/meta-agl/recipes-devtools/autogen/files/0003-autoopts-mk-tpl-config.sh-fix-shell-path.patch b/meta-agl/recipes-devtools/autogen/files/0003-autoopts-mk-tpl-config.sh-fix-shell-path.patch
deleted file mode 100644
index db6b0cdf8..000000000
--- a/meta-agl/recipes-devtools/autogen/files/0003-autoopts-mk-tpl-config.sh-fix-shell-path.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From df4f5ccc376a630b1a587a8ca3b1f35a305867dd Mon Sep 17 00:00:00 2001
-From: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
-Date: Wed, 23 Aug 2017 07:19:03 +0000
-Subject: [PATCH] autoopts/mk-tpl-config.sh: fix shell path
-
-POSIX_SHELL as shebang doesn't work when it is longer than
-BINPRM_BUF_SIZE which is 128 usually. So use "/bin/sh".
-
-Signed-off-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
----
- autoopts/mk-tpl-config.sh | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/autoopts/mk-tpl-config.sh b/autoopts/mk-tpl-config.sh
-index c4708a2..550870e 100755
---- a/autoopts/mk-tpl-config.sh
-+++ b/autoopts/mk-tpl-config.sh
-@@ -102,7 +102,7 @@ fix_scripts() {
- sed 1d $f
- ;;
-
-- */sh ) echo '#!' ${POSIX_SHELL}
-+ */sh ) echo '#!/bin/sh'
- sed 1d $f
- ;;
-
---
-2.7.4
-
diff --git a/meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts.service b/meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts.service
index 61d6d4679..8f8667db6 100644
--- a/meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts.service
+++ b/meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts.service
@@ -7,6 +7,7 @@ ConditionPathExists=#SYSCONFDIR#/agl-postinsts
[Service]
Type=oneshot
+StandardOutput=journal+console
ExecStart=#SBINDIR#/run-agl-postinsts
ExecStartPost=#BASE_BINDIR#/systemctl disable run-agl-postinsts.service
RemainAfterExit=No
diff --git a/meta-agl/recipes-devtools/run-postinsts/run-postinsts_%.bbappend b/meta-agl/recipes-devtools/run-postinsts/run-postinsts_%.bbappend
new file mode 100644
index 000000000..fc327b6ef
--- /dev/null
+++ b/meta-agl/recipes-devtools/run-postinsts/run-postinsts_%.bbappend
@@ -0,0 +1,5 @@
+do_configure_append() {
+ if ! grep -q StandardOutput= ${WORKDIR}/run-postinsts.service; then
+ sed -i '/ExecStart=/iStandardOutput=journal+console' ${WORKDIR}/run-postinsts.service
+ fi
+}
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/files/0001-Define-comparison_fn_t-for-non-glibc-systems.patch b/meta-agl/recipes-multimedia/lightmediascanner/files/0001-Define-comparison_fn_t-for-non-glibc-systems.patch
new file mode 100644
index 000000000..15d4b3f0e
--- /dev/null
+++ b/meta-agl/recipes-multimedia/lightmediascanner/files/0001-Define-comparison_fn_t-for-non-glibc-systems.patch
@@ -0,0 +1,33 @@
+From 5bc5b8c5dad3edec6736fd7e7ce61250c4ce3725 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 12 Jul 2017 17:13:19 -0700
+Subject: [PATCH] Define comparison_fn_t for non-glibc systems
+
+lightmediascanner.c:324:12: error: 'comparison_fn_t' undeclared (first use in this function)
+ (comparison_fn_t)_plugin_sort);
+ ^~~~~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/lib/lightmediascanner.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/lib/lightmediascanner.c b/src/lib/lightmediascanner.c
+index 344b247..b866883 100644
+--- a/src/lib/lightmediascanner.c
++++ b/src/lib/lightmediascanner.c
+@@ -37,6 +37,11 @@
+ #define DEFAULT_SLAVE_TIMEOUT 1000
+ #define DEFAULT_COMMIT_INTERVAL 100
+
++#if !defined(__GLIBC__)
++typedef int (*__compar_fn_t) (const void*, const void*);
++typedef __compar_fn_t comparison_fn_t;
++#endif
++
+ #ifdef HAVE_MAGIC_H
+ static magic_t _magic_handle;
+
+--
+2.13.2
+
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/files/id3-plugin-support-out-of-tree-build.patch b/meta-agl/recipes-multimedia/lightmediascanner/files/id3-plugin-support-out-of-tree-build.patch
new file mode 100644
index 000000000..9528bec79
--- /dev/null
+++ b/meta-agl/recipes-multimedia/lightmediascanner/files/id3-plugin-support-out-of-tree-build.patch
@@ -0,0 +1,11 @@
+--- a/src/plugins/Makefile.am 2015-10-25 16:12:29.331415823 +0000
++++ b/src/plugins/Makefile.am 2015-10-25 16:14:37.593415808 +0000
+@@ -93,7 +93,7 @@
+ id3_id3_la_SOURCES = id3/id3.c id3/id3v1_genres.c
+ id3_id3_la_LIBADD = $(PLUGINS_LIBADD)
+
+-id3/id3v1_genres.c: $(srcdir)/id3/id3v1_genres.def $(srcdir)/id3/id3v1_genres_gen.awk
++$(srcdir)/id3/id3v1_genres.c: $(srcdir)/id3/id3v1_genres.def $(srcdir)/id3/id3v1_genres_gen.awk
+ $(AWK) -f $(srcdir)/id3/id3v1_genres_gen.awk $(srcdir)/id3/id3v1_genres.def > $@
+
+ EXTRA_DIST += id3/id3v1_genres.def id3/id3v1_genres_gen.awk
diff --git a/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_0.5.1.bb b/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_0.5.1.bb
new file mode 100644
index 000000000..f2158760f
--- /dev/null
+++ b/meta-agl/recipes-multimedia/lightmediascanner/lightmediascanner_0.5.1.bb
@@ -0,0 +1,63 @@
+SUMMARY = "Lightweight media scanner"
+DESCRIPTION = "Lightweight media scanner meant to be used in not-so-powerful devices, like embedded systems or old machines."
+SECTION = "libs/multimedia"
+
+LICENSE = "LGPLv2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \
+ file://src/lib/lightmediascanner.c;endline=21;md5=6d8889bccb4c6c27e8b786342a3eb267"
+
+DEPENDS = "file gawk glib-2.0 sqlite3"
+
+PV = "0.5.1+git${SRCPV}"
+SRCREV = "adfddb3486276a5ed2f5008c9e43a811e1271cc9"
+SRC_URI = "git://github.com/profusion/lightmediascanner.git \
+ file://id3-plugin-support-out-of-tree-build.patch \
+ file://0001-Define-comparison_fn_t-for-non-glibc-systems.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+EXTRA_OECONF = "--enable-static --disable-mp4"
+
+PACKAGECONFIG ??= "ogg flac wave id3 m3u pls asf rm jpeg png"
+PACKAGECONFIG[generic] = "--enable-generic,--disable-generic,libav"
+PACKAGECONFIG[ogg] = "--enable-ogg,--disable-ogg,libogg libvorbis libtheora"
+PACKAGECONFIG[flac] = "--enable-flac,--disable-flac,flac"
+PACKAGECONFIG[wave] = "--enable-wave,--disable-wave"
+PACKAGECONFIG[id3] = "--enable-id3,--disable-id3"
+PACKAGECONFIG[m3u] = "--enable-m3u,--disable-m3u"
+PACKAGECONFIG[pls] = "--enable-pls,--disable-pls"
+PACKAGECONFIG[asf] = "--enable-asf,--disable-asf"
+PACKAGECONFIG[rm] = "--enable-rm,--disable-rm"
+PACKAGECONFIG[jpeg] = "--enable-jpeg,--disable-jpeg"
+PACKAGECONFIG[png] = "--enable-png,--disable-png"
+
+do_install_append() {
+ # Install "test" binary for corresponding package
+ install -d ${D}/${bindir}
+ install -m 755 ${B}/src/bin/.libs/test ${D}/${bindir}/test-lms
+ # Remove .la files for loadable modules
+ rm -f ${D}/${libdir}/${PN}/plugins/*.la
+}
+
+FILES_${PN} += "${datadir}/dbus-1"
+FILES_${PN}-dbg += "${libdir}/${PN}/plugins/.debug"
+
+PACKAGES_prepend = "${PN}-test "
+FILES_${PN}-test_prepend = "${bindir}/test-lms "
+
+PACKAGES += "${PN}-meta"
+ALLOW_EMPTY_${PN}-meta = "1"
+
+PACKAGES_DYNAMIC = "${PN}-plugin-*"
+
+python populate_packages_prepend () {
+ lms_libdir = d.expand('${libdir}/${PN}')
+ pkgs = []
+
+ pkgs += do_split_packages(d, oe.path.join(lms_libdir, "plugins"), '^(.*)\.so$', d.expand('${PN}-plugin-%s'), 'LightMediaScanner plugin for %s', prepend=True, extra_depends=d.expand('${PN}'))
+ metapkg = d.getVar('PN') + '-meta'
+ d.setVar('RDEPENDS_' + metapkg, ' '.join(pkgs))
+}
diff --git a/meta-agl/recipes-navigation/geoclue/geoclue_%.bbappend b/meta-agl/recipes-navigation/geoclue/geoclue_%.bbappend
index 1025e0e79..9d61a9f61 100644
--- a/meta-agl/recipes-navigation/geoclue/geoclue_%.bbappend
+++ b/meta-agl/recipes-navigation/geoclue/geoclue_%.bbappend
@@ -1,4 +1,3 @@
-DEPENDS += "gobject-introspection-native"
inherit gobject-introspection
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/meta-app-framework/conf/include/agl-appfw-smack.inc b/meta-app-framework/conf/include/agl-appfw-smack.inc
index 1d8ab0a77..b6b998a9b 100644
--- a/meta-app-framework/conf/include/agl-appfw-smack.inc
+++ b/meta-app-framework/conf/include/agl-appfw-smack.inc
@@ -1,10 +1,10 @@
# enable security features (smack, cynara) - required by Application Framework
-OVERRIDES .= ":smack"
-DISTRO_FEATURES_append = " smack dbus-cynara xattr"
+OVERRIDES .= ":with-lsm-smack"
+DISTRO_FEATURES_append = " smack xattr"
# use tar-native to support SMACK extended attributes independently of host config
IMAGE_CMD_TAR = "tar --xattrs --xattrs-include='*'"
-IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
EXTRANATIVEPATH += "tar-native"
# security: enable ssh server in place of dropbear to support PAM on user sessions
diff --git a/meta-app-framework/recipes-core/af-main/af-main_1.0.bb b/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
index 8ac661527..e160486b2 100644
--- a/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
+++ b/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
@@ -14,7 +14,7 @@ DEPENDS = "openssl libxml2 xmlsec1 systemd libzip json-c systemd security-manage
DEPENDS_class-native = "openssl libxml2 xmlsec1 libzip json-c"
RDEPENDS_${PN}_class-target += "af-binder-tools"
-PACKAGE_WRITE_DEPS_append_smack = " smack-userspace-native libcap-native"
+PACKAGE_WRITE_DEPS_append_with-lsm-smack = " smack-native libcap-native"
EXTRA_OECMAKE_class-native = "\
-DUSE_LIBZIP=1 \
@@ -46,8 +46,8 @@ GROUPADD_PARAM_${PN} = "-r ${afm_name}"
FILES_${PN} += "\
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service', '', d)} \
"
-RDEPENDS_${PN}_append_smack = " smack-userspace bash"
-DEPENDS_append_smack = " smack-userspace-native"
+RDEPENDS_${PN}_append_with-lsm-smack = " smack bash"
+DEPENDS_append_with-lsm-smack = " smack-native"
# short hacks here
SRC_URI += "\
@@ -90,7 +90,7 @@ pkg_postinst_${PN}() {
chown ${afm_name}:${afm_name} $D${afm_datadir}/icons
}
-pkg_postinst_${PN}_append_smack() {
+pkg_postinst_${PN}_append_with-lsm-smack() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
chsmack -a 'System::Shared' -t $D${systemd_units_root}/system
chsmack -a 'System::Shared' -t $D${systemd_units_root}/system/afm-user-session@.target.wants
diff --git a/meta-app-framework/recipes-core/base-files/base-files_%.bbappend b/meta-app-framework/recipes-core/base-files/base-files_%.bbappend
index 636bcc4df..b837d03ad 100644
--- a/meta-app-framework/recipes-core/base-files/base-files_%.bbappend
+++ b/meta-app-framework/recipes-core/base-files/base-files_%.bbappend
@@ -1,5 +1,5 @@
-RDEPENDS_${PN}_append_smack = " smack-userspace"
-PACKAGE_WRITE_DEPS_append_smack = " smack-userspace-native"
+RDEPENDS_${PN}_append_with-lsm-smack = " smack"
+PACKAGE_WRITE_DEPS_append_with-lsm-smack = " smack-native"
do_install_append() {
install -d ${D}/${sysconfdir}/skel/app-data
@@ -13,7 +13,7 @@ do_install_append() {
ln -s ../../var/local ${D}/usr/local
}
-do_install_append_smack () {
+do_install_append_with-lsm-smack () {
install -d ${D}/${sysconfdir}/smack/accesses.d
cat > ${D}/${sysconfdir}/smack/accesses.d/default-access-domains-no-user <<EOF
System User::App-Shared rwxat
@@ -22,7 +22,7 @@ EOF
chmod 0644 ${D}/${sysconfdir}/smack/accesses.d/default-access-domains-no-user
}
-pkg_postinst_${PN}_append_smack() {
+pkg_postinst_${PN}_append_with-lsm-smack() {
chsmack -r -a 'User::Home' -t -D $D/${sysconfdir}/skel
chsmack -a 'User::App-Shared' -D $D/${sysconfdir}/skel/app-data
cp -rTf --preserve=all $D/${sysconfdir}/skel $D/${ROOT_HOME}
diff --git a/meta-app-framework/recipes-core/packagegroups/packagegroup-agl-core-security.bbappend b/meta-app-framework/recipes-core/packagegroups/packagegroup-agl-core-security.bbappend
index 0c9efe465..a8d04ab6d 100644
--- a/meta-app-framework/recipes-core/packagegroups/packagegroup-agl-core-security.bbappend
+++ b/meta-app-framework/recipes-core/packagegroups/packagegroup-agl-core-security.bbappend
@@ -1,7 +1,6 @@
RDEPENDS_${PN} += "\
xmlsec1 \
cynara \
- dbus-cynara \
security-manager \
security-manager-policy \
agl-users \
diff --git a/meta-app-framework/recipes-core/security-manager/security-manager/0001-gcc-7-requires-include-functional-for-std-function.patch b/meta-app-framework/recipes-core/security-manager/security-manager/0001-gcc-7-requires-include-functional-for-std-function.patch
new file mode 100644
index 000000000..7b6845abc
--- /dev/null
+++ b/meta-app-framework/recipes-core/security-manager/security-manager/0001-gcc-7-requires-include-functional-for-std-function.patch
@@ -0,0 +1,51 @@
+From ed1c105db9d7b1ceb52ec16f35b0a2c959c19c6d Mon Sep 17 00:00:00 2001
+From: Changhyeok Bae <changhyeok.bae@gmail.com>
+Date: Sun, 17 Dec 2017 15:40:58 +0000
+Subject: [PATCH] gcc-7 requires include <functional> for std::function
+
+Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
+---
+ src/client/client-common.cpp | 1 +
+ src/common/smack-labels.cpp | 1 +
+ src/dpl/core/src/binary_queue.cpp | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/src/client/client-common.cpp b/src/client/client-common.cpp
+index 883ab8d..1babdf7 100644
+--- a/src/client/client-common.cpp
++++ b/src/client/client-common.cpp
+@@ -31,6 +31,7 @@
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+ #include <unistd.h>
++#include <functional>
+
+ #include <dpl/log/log.h>
+ #include <dpl/serialization.h>
+diff --git a/src/common/smack-labels.cpp b/src/common/smack-labels.cpp
+index 0294a42..1598099 100644
+--- a/src/common/smack-labels.cpp
++++ b/src/common/smack-labels.cpp
+@@ -29,6 +29,7 @@
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+ #include <memory>
++#include <functional>
+ #include <fts.h>
+ #include <cstring>
+ #include <string>
+diff --git a/src/dpl/core/src/binary_queue.cpp b/src/dpl/core/src/binary_queue.cpp
+index 72817a6..838409f 100644
+--- a/src/dpl/core/src/binary_queue.cpp
++++ b/src/dpl/core/src/binary_queue.cpp
+@@ -26,6 +26,7 @@
+ #include <malloc.h>
+ #include <cstring>
+ #include <new>
++#include <functional>
+
+ namespace SecurityManager {
+ BinaryQueue::BinaryQueue() :
+--
+2.7.4
+
diff --git a/meta-app-framework/recipes-core/security-manager/security-manager_%.bbappend b/meta-app-framework/recipes-core/security-manager/security-manager_%.bbappend
index bd1a43ea3..61c933a7e 100644
--- a/meta-app-framework/recipes-core/security-manager/security-manager_%.bbappend
+++ b/meta-app-framework/recipes-core/security-manager/security-manager_%.bbappend
@@ -1,12 +1,13 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/security-manager:"
-PACKAGE_WRITE_DEPS_append_smack = " smack-userspace-native"
+PACKAGE_WRITE_DEPS_append_with-lsm-smack = " smack-native"
SRC_URI += " file://0001-Adapt-rules-to-AGL.patch \
file://init-security-manager-db.service \
file://init-security-manager-db.sh \
file://0001-Fix-gcc6-build.patch \
file://0001-Fix-Cmake-conf-for-gcc6-build.patch \
+ file://0001-gcc-7-requires-include-functional-for-std-function.patch \
"
FILES_${PN}_append = "${bindir}/init-security-manager-db.sh \
diff --git a/meta-app-framework/recipes-kernel/linux/linux-%.bbappend b/meta-app-framework/recipes-kernel/linux/linux-%.bbappend
index 02595efdf..fba5bf13d 100644
--- a/meta-app-framework/recipes-kernel/linux/linux-%.bbappend
+++ b/meta-app-framework/recipes-kernel/linux/linux-%.bbappend
@@ -1,3 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
-SRC_URI_append_smack = " file://audit.cfg"
+SRC_URI_append_with-lsm-smack = " file://audit.cfg"
diff --git a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend b/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend
deleted file mode 100644
index c1c657201..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend
+++ /dev/null
@@ -1,12 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux/linux-yocto-4.1:"
-
-#-------------------------------------------------------------------------
-# smack patches for handling bluetooth
-
-SRC_URI_append_smack = "\
- file://0001-Smack-File-receive-for-sockets.patch \
- file://0002-smack-fix-cache-of-access-labels.patch \
- file://0003-Smack-ignore-null-signal-in-smack_task_kill.patch \
- file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \
-"
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend b/meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend
deleted file mode 100644
index 51df08719..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend
+++ /dev/null
@@ -1,11 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux/linux-yocto-4.4:"
-
-#-------------------------------------------------------------------------
-# smack patches for handling bluetooth
-
-SRC_URI_append_smack = "\
- file://0002-smack-fix-cache-of-access-labels.patch \
- file://0003-Smack-ignore-null-signal-in-smack_task_kill.patch \
- file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \
-"
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch
deleted file mode 100644
index b0c5ee8f4..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 2e65b888820ea372984d412cee3bd7dcba05d7d2 Mon Sep 17 00:00:00 2001
-From: Casey Schaufler <casey@schaufler-ca.com>
-Date: Mon, 7 Dec 2015 14:34:32 -0800
-Subject: [PATCH 1/4] Smack: File receive for sockets
-
-The existing file receive hook checks for access on
-the file inode even for UDS. This is not right, as
-the inode is not used by Smack to make access checks
-for sockets. This change checks for an appropriate
-access relationship between the receiving (current)
-process and the socket. If the process can't write
-to the socket's send label or the socket's receive
-label can't write to the process fail.
-
-This will allow the legitimate cases, where the
-socket sender and socket receiver can freely communicate.
-Only strangly set socket labels should cause a problem.
-
-Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b644757..487b2f3 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1672,9 +1672,31 @@ static int smack_file_receive(struct file *file)
- int may = 0;
- struct smk_audit_info ad;
- struct inode *inode = file_inode(file);
-+ struct socket *sock;
-+ struct task_smack *tsp;
-+ struct socket_smack *ssp;
-
- smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
- smk_ad_setfield_u_fs_path(&ad, file->f_path);
-+
-+ if (S_ISSOCK(inode->i_mode)) {
-+ sock = SOCKET_I(inode);
-+ ssp = sock->sk->sk_security;
-+ tsp = current_security();
-+ /*
-+ * If the receiving process can't write to the
-+ * passed socket or if the passed socket can't
-+ * write to the receiving process don't accept
-+ * the passed socket.
-+ */
-+ rc = smk_access(tsp->smk_task, ssp->smk_out, MAY_WRITE, &ad);
-+ rc = smk_bu_file(file, may, rc);
-+ if (rc < 0)
-+ return rc;
-+ rc = smk_access(ssp->smk_in, tsp->smk_task, MAY_WRITE, &ad);
-+ rc = smk_bu_file(file, may, rc);
-+ return rc;
-+ }
- /*
- * This code relies on bitmasks.
- */
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch
deleted file mode 100644
index 51c3b31ec..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 5bcea0fc4e5360deca133e211fdc76717a1693a4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net>
-Date: Tue, 12 Jan 2016 21:23:40 +0100
-Subject: [PATCH 2/4] smack: fix cache of access labels
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Before this commit, removing the access property of
-a file, aka, the extended attribute security.SMACK64
-was not effictive until the cache had been cleaned.
-
-This patch fixes that problem.
-
-Signed-off-by: José Bollo <jobol@nonadev.net>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index 487b2f3..b9393e3 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1256,9 +1256,13 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
- * Don't do anything special for these.
- * XATTR_NAME_SMACKIPIN
- * XATTR_NAME_SMACKIPOUT
-- * XATTR_NAME_SMACKEXEC
- */
-- if (strcmp(name, XATTR_NAME_SMACK) == 0)
-+ if (strcmp(name, XATTR_NAME_SMACK) == 0) {
-+ struct super_block *sbp = d_backing_inode(dentry)->i_sb;
-+ struct superblock_smack *sbsp = sbp->s_security;
-+
-+ isp->smk_inode = sbsp->smk_default;
-+ } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0)
- isp->smk_task = NULL;
- else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0)
- isp->smk_mmap = NULL;
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
deleted file mode 100644
index 67761ae46..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From aa63c4f8ece0c54a9be735ac38667f11fcd6f44a Mon Sep 17 00:00:00 2001
-From: Rafal Krypa <r.krypa@samsung.com>
-Date: Mon, 4 Apr 2016 11:14:53 +0200
-Subject: [PATCH 3/4] Smack: ignore null signal in smack_task_kill
-
-Kill with signal number 0 is commonly used for checking PID existence.
-Smack treated such cases like any other kills, although no signal is
-actually delivered when sig == 0.
-
-Checking permissions when sig == 0 didn't prevent an unprivileged caller
-from learning whether PID exists or not. When it existed, kernel returned
-EPERM, when it didn't - ESRCH. The only effect of policy check in such
-case is noise in audit logs.
-
-This change lets Smack silently ignore kill() invocations with sig == 0.
-
-Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b9393e3..c916f58 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2056,6 +2056,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
- struct smack_known *tkp = smk_of_task_struct(p);
- int rc;
-
-+ if (!sig)
-+ return 0; /* null signal; existence test */
-+
- smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
- smk_ad_setfield_u_tsk(&ad, p);
- /*
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
deleted file mode 100644
index 4281c201c..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From b2b9e7ec8e79ede841104f76464f4b77c057b011 Mon Sep 17 00:00:00 2001
-From: jooseong lee <jooseong.lee@samsung.com>
-Date: Thu, 3 Nov 2016 10:55:43 +0100
-Subject: [PATCH 4/4] Smack: Assign smack_known_web label for kernel thread's
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook
-
-Creating struct sock by sk_alloc function in various kernel subsystems
-like bluetooth dosen't call smack_socket_post_create(). In such case,
-received sock label is the floor('_') label and makes access deny.
-
-Refers-to: https://review.tizen.org/gerrit/#/c/80717/4
-
-Change-Id: I2e5c9359bfede84a988fd4d4d74cdb9dfdfc52d8
-Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
-Signed-off-by: José Bollo <jose.bollo@iot.bzh>
----
- security/smack/smack_lsm.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index c916f58..cc6769b 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2138,8 +2138,16 @@ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
- if (ssp == NULL)
- return -ENOMEM;
-
-- ssp->smk_in = skp;
-- ssp->smk_out = skp;
-+ /*
-+ * Sockets created by kernel threads receive web label.
-+ */
-+ if (unlikely(current->flags & PF_KTHREAD)) {
-+ ssp->smk_in = &smack_known_web;
-+ ssp->smk_out = &smack_known_web;
-+ } else {
-+ ssp->smk_in = skp;
-+ ssp->smk_out = skp;
-+ }
- ssp->smk_packet = NULL;
-
- sk->sk_security = ssp;
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch
deleted file mode 100644
index 4021e5d38..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 2b206c36b16e72cfe41cd22448d8527359ffd962 Mon Sep 17 00:00:00 2001
-From: Casey Schaufler <casey@schaufler-ca.com>
-Date: Mon, 7 Dec 2015 14:34:32 -0800
-Subject: [PATCH 1/4] Smack: File receive for sockets
-
-The existing file receive hook checks for access on
-the file inode even for UDS. This is not right, as
-the inode is not used by Smack to make access checks
-for sockets. This change checks for an appropriate
-access relationship between the receiving (current)
-process and the socket. If the process can't write
-to the socket's send label or the socket's receive
-label can't write to the process fail.
-
-This will allow the legitimate cases, where the
-socket sender and socket receiver can freely communicate.
-Only strangly set socket labels should cause a problem.
-
-Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index ff81026..b20ef06 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1860,12 +1860,34 @@ static int smack_file_receive(struct file *file)
- int may = 0;
- struct smk_audit_info ad;
- struct inode *inode = file_inode(file);
-+ struct socket *sock;
-+ struct task_smack *tsp;
-+ struct socket_smack *ssp;
-
- if (unlikely(IS_PRIVATE(inode)))
- return 0;
-
- smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
- smk_ad_setfield_u_fs_path(&ad, file->f_path);
-+
-+ if (S_ISSOCK(inode->i_mode)) {
-+ sock = SOCKET_I(inode);
-+ ssp = sock->sk->sk_security;
-+ tsp = current_security();
-+ /*
-+ * If the receiving process can't write to the
-+ * passed socket or if the passed socket can't
-+ * write to the receiving process don't accept
-+ * the passed socket.
-+ */
-+ rc = smk_access(tsp->smk_task, ssp->smk_out, MAY_WRITE, &ad);
-+ rc = smk_bu_file(file, may, rc);
-+ if (rc < 0)
-+ return rc;
-+ rc = smk_access(ssp->smk_in, tsp->smk_task, MAY_WRITE, &ad);
-+ rc = smk_bu_file(file, may, rc);
-+ return rc;
-+ }
- /*
- * This code relies on bitmasks.
- */
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch
deleted file mode 100644
index c516f3aa5..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 99267706991ab84bd44ceaea9a7ec886bbdd58e0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net>
-Date: Tue, 12 Jan 2016 21:23:40 +0100
-Subject: [PATCH 2/4] smack: fix cache of access labels
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Before this commit, removing the access property of
-a file, aka, the extended attribute security.SMACK64
-was not effictive until the cache had been cleaned.
-
-This patch fixes that problem.
-
-Signed-off-by: José Bollo <jobol@nonadev.net>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b20ef06..b2bcb14 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1444,9 +1444,13 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
- * Don't do anything special for these.
- * XATTR_NAME_SMACKIPIN
- * XATTR_NAME_SMACKIPOUT
-- * XATTR_NAME_SMACKEXEC
- */
-- if (strcmp(name, XATTR_NAME_SMACK) == 0)
-+ if (strcmp(name, XATTR_NAME_SMACK) == 0) {
-+ struct super_block *sbp = d_backing_inode(dentry)->i_sb;
-+ struct superblock_smack *sbsp = sbp->s_security;
-+
-+ isp->smk_inode = sbsp->smk_default;
-+ } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0)
- isp->smk_task = NULL;
- else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0)
- isp->smk_mmap = NULL;
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
deleted file mode 100644
index c9180bb9f..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From ec4eb03af07b0fbc330aecca6ac4ebd6accd8825 Mon Sep 17 00:00:00 2001
-From: Rafal Krypa <r.krypa@samsung.com>
-Date: Mon, 4 Apr 2016 11:14:53 +0200
-Subject: [PATCH 3/4] Smack: ignore null signal in smack_task_kill
-
-Kill with signal number 0 is commonly used for checking PID existence.
-Smack treated such cases like any other kills, although no signal is
-actually delivered when sig == 0.
-
-Checking permissions when sig == 0 didn't prevent an unprivileged caller
-from learning whether PID exists or not. When it existed, kernel returned
-EPERM, when it didn't - ESRCH. The only effect of policy check in such
-case is noise in audit logs.
-
-This change lets Smack silently ignore kill() invocations with sig == 0.
-
-Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b2bcb14..cf8a93f 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2239,6 +2239,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
- struct smack_known *tkp = smk_of_task_struct(p);
- int rc;
-
-+ if (!sig)
-+ return 0; /* null signal; existence test */
-+
- smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
- smk_ad_setfield_u_tsk(&ad, p);
- /*
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
deleted file mode 100644
index a1eeac3d7..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From c8bbb0f916de54610513e376070aea531af19dd6 Mon Sep 17 00:00:00 2001
-From: jooseong lee <jooseong.lee@samsung.com>
-Date: Thu, 3 Nov 2016 10:55:43 +0100
-Subject: [PATCH 4/4] Smack: Assign smack_known_web label for kernel thread's
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook
-
-Creating struct sock by sk_alloc function in various kernel subsystems
-like bluetooth dosen't call smack_socket_post_create(). In such case,
-received sock label is the floor('_') label and makes access deny.
-
-Refers-to: https://review.tizen.org/gerrit/#/c/80717/4
-
-Change-Id: I2e5c9359bfede84a988fd4d4d74cdb9dfdfc52d8
-Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
-Signed-off-by: José Bollo <jose.bollo@iot.bzh>
----
- security/smack/smack_lsm.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index cf8a93f..21651bc 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2321,8 +2321,16 @@ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
- if (ssp == NULL)
- return -ENOMEM;
-
-- ssp->smk_in = skp;
-- ssp->smk_out = skp;
-+ /*
-+ * Sockets created by kernel threads receive web label.
-+ */
-+ if (unlikely(current->flags & PF_KTHREAD)) {
-+ ssp->smk_in = &smack_known_web;
-+ ssp->smk_out = &smack_known_web;
-+ } else {
-+ ssp->smk_in = skp;
-+ ssp->smk_out = skp;
-+ }
- ssp->smk_packet = NULL;
-
- sk->sk_security = ssp;
---
-2.7.4
-
diff --git a/meta-app-framework/recipes-security/cynara/cynara/0001-gcc-7-requires-include-functional-for-std-function.patch b/meta-app-framework/recipes-security/cynara/cynara/0001-gcc-7-requires-include-functional-for-std-function.patch
new file mode 100644
index 000000000..bd060b26d
--- /dev/null
+++ b/meta-app-framework/recipes-security/cynara/cynara/0001-gcc-7-requires-include-functional-for-std-function.patch
@@ -0,0 +1,38 @@
+From 2169344adbb42ff580856204e2b290e3b04fd447 Mon Sep 17 00:00:00 2001
+From: Changhyeok Bae <changhyeok.bae@gmail.com>
+Date: Sun, 17 Dec 2017 15:28:28 +0000
+Subject: [PATCH] gcc-7 requires include <functional> for std::function
+
+Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
+---
+ src/common/types/PolicyBucket.h | 1 +
+ src/cyad/AdminPolicyParser.h | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/common/types/PolicyBucket.h b/src/common/types/PolicyBucket.h
+index 029d3dd..1bceeca 100644
+--- a/src/common/types/PolicyBucket.h
++++ b/src/common/types/PolicyBucket.h
+@@ -30,6 +30,7 @@
+ #include <set>
+ #include <string>
+ #include <vector>
++#include <functional>
+
+ #include <exceptions/NotImplementedException.h>
+ #include <types/pointers.h>
+diff --git a/src/cyad/AdminPolicyParser.h b/src/cyad/AdminPolicyParser.h
+index 53dde23..f38c194 100644
+--- a/src/cyad/AdminPolicyParser.h
++++ b/src/cyad/AdminPolicyParser.h
+@@ -25,6 +25,7 @@
+
+ #include <istream>
+ #include <memory>
++#include <functional>
+
+ #include <cyad/CynaraAdminPolicies.h>
+
+--
+2.7.4
+
diff --git a/meta-app-framework/recipes-security/cynara/cynara_git.bbappend b/meta-app-framework/recipes-security/cynara/cynara_git.bbappend
deleted file mode 100644
index 9a61e7044..000000000
--- a/meta-app-framework/recipes-security/cynara/cynara_git.bbappend
+++ /dev/null
@@ -1,39 +0,0 @@
-pkg_postinst_${PN} () {
- # Fail on error.
- set -e
-
- # It would be nice to run the code below while building an image,
- # but currently the calls to cynara-db-chsgen (a binary) in
- # cynara-db-migration (a script) prevent that. Rely instead
- # on OE's support for running failed postinst scripts at first boot.
- if [ x"$D" != "x" ]; then
- exit 1
- fi
-
- mkdir -p $D${sysconfdir}/cynara
- ${CHSMACK} -a System $D${sysconfdir}/cynara
-
- # Strip git patch level information, the version comparison code
- # in cynara-db-migration only expect major.minor.patch version numbers.
- VERSION=${@d.getVar('PV',d,1).split('+git')[0]}
- if [ -d $D${localstatedir}/cynara ] ; then
- # upgrade
- echo "NOTE: updating cynara DB to version $VERSION"
- $D${sbindir}/cynara-db-migration upgrade -f 0.0.0 -t $VERSION
- else
- # install
- echo "NOTE: creating cynara DB for version $VERSION"
- mkdir -p $D${localstatedir}/cynara
- ${CHSMACK} -a System $D${localstatedir}/cynara
- $D${sbindir}/cynara-db-migration install -t $VERSION
- fi
-
- # Workaround for systemd.bbclass issue: it would call
- # "systemctl start" without "--no-block", but because
- # the service is not ready to run at the time when
- # this scripts gets executed by run-postinsts.service,
- # booting deadlocks.
- echo "NOTE: enabling and starting cynara service"
- systemctl enable cynara
- systemctl start --no-block cynara
-}
diff --git a/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend b/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend
new file mode 100644
index 000000000..08d2a3dd0
--- /dev/null
+++ b/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend
@@ -0,0 +1,4 @@
+
+DEPENDS = "libtool libxml2 libxslt openssl gnutls libgcrypt"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-app-framework/recipes-support/libcap/libcap_%.bbappend b/meta-app-framework/recipes-support/libcap/libcap_%.bbappend
index fbe893501..c4561db22 100644
--- a/meta-app-framework/recipes-support/libcap/libcap_%.bbappend
+++ b/meta-app-framework/recipes-support/libcap/libcap_%.bbappend
@@ -1,5 +1,2 @@
FILESEXTRAPATHS_append_class-native := ":${THISDIR}/${PN}"
SRC_URI_append_class-native = " file://removing-capability-enforcement.patch"
-PACKAGECONFIG_class-native ?= "attr"
-DEPENDS_append_class-native = " attr-native"
-
diff --git a/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.55.bb b/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.55.bb
deleted file mode 100644
index bb650ce23..000000000
--- a/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.55.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-DESCRIPTION = "A small C library that is supposed to make it easy to run an HTTP server as part of another application"
-HOMEPAGE = "http://www.gnu.org/software/libmicrohttpd/"
-LICENSE = "LGPL-2.1+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=9331186f4f80db7da0e724bdd6554ee5"
-SECTION = "net"
-DEPENDS = "libgcrypt gnutls file"
-
-SRC_URI = "http://ftp.gnu.org/gnu/libmicrohttpd/${BPN}-${PV}.tar.gz"
-SRC_URI[md5sum] = "1c20f84a8b9cf692dd50b558b3571a3a"
-SRC_URI[sha256sum] = "0c1cab8dc9f2588bd3076a28f77a7f8de9560cbf2d80e53f9a8696ada80ed0f8"
-
-inherit autotools lib_package pkgconfig gettext
-
-EXTRA_OECONF += "--disable-static --with-gnutls=${STAGING_LIBDIR}/../"
-
-PACKAGECONFIG ?= "curl"
-PACKAGECONFIG_append_class-target = "\
- ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'largefile', '', d)} \
-"
-PACKAGECONFIG[largefile] = "--enable-largefile,--disable-largefile,,"
-PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl,"
-
-do_compile_append() {
- sed -i s:-L${STAGING_LIBDIR}::g libmicrohttpd.pc
-}
diff --git a/meta-app-framework/recipes-support/xmlsec1/xmlsec1/Only-require-libxslt-in-.pc-files-when-necessary.patch b/meta-app-framework/recipes-support/xmlsec1/xmlsec1/Only-require-libxslt-in-.pc-files-when-necessary.patch
deleted file mode 100644
index c92df77f0..000000000
--- a/meta-app-framework/recipes-support/xmlsec1/xmlsec1/Only-require-libxslt-in-.pc-files-when-necessary.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 1e39acf581ef47876b058da41774cbc92560d797 Mon Sep 17 00:00:00 2001
-From: Manuel Bachmann <manuel.bachmann@iot.bzh>
-Date: Wed, 27 Jan 2016 14:16:40 +0100
-Subject: [PATCH] Only require libxslt in .pc files when necessary
-
-If we build xmlsec without libxslt ("--without-libxslt" at
-configure time), dependent packages will still require it
-because it is unconditionally mentioned in .pc files (used
-by pkg-config).
-
-We now make sure that this dependency is mentioned only if
-the configure script validates libxslt presence.
-
-Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
----
- configure.in | 4 ++++
- xmlsec-gcrypt.pc.in | 2 +-
- xmlsec-gnutls.pc.in | 2 +-
- xmlsec-nss.pc.in | 2 +-
- xmlsec-openssl.pc.in | 2 +-
- xmlsec.pc.in | 2 +-
- 6 files changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index 7d976d0..a8350a9 100644
---- a/configure.in
-+++ b/configure.in
-@@ -255,6 +255,7 @@ dnl ==========================================================================
- dnl find libxslt
- dnl ==========================================================================
- XMLSEC_NO_LIBXSLT="1"
-+LIBXSLT_COND="libxslt >="
- LIBXSLT_MIN_VERSION=1.0.20
- LIBXSLT_CONFIG="xslt-config"
- LIBXSLT_CFLAGS=""
-@@ -324,6 +325,8 @@ fi
- if test "z$LIBXSLT_FOUND" = "zyes" ; then
- XMLSEC_NO_LIBXSLT="0"
- else
-+ LIBXSLT_COND=""
-+ LIBXSLT_MIN_VERSION=""
- XMLSEC_DEFINES="$XMLSEC_DEFINES -DXMLSEC_NO_XSLT=1"
- fi
-
-@@ -332,6 +335,7 @@ AC_SUBST(LIBXSLT_CFLAGS)
- AC_SUBST(LIBXSLT_LIBS)
- AC_SUBST(LIBXSLT_CONFIG)
- AC_SUBST(LIBXSLT_MIN_VERSION)
-+AC_SUBST(LIBXSLT_COND)
-
- dnl ==========================================================================
- dnl See if we can find a crypto library
-diff --git a/xmlsec-gcrypt.pc.in b/xmlsec-gcrypt.pc.in
-index 1c00496..33bc2ff 100644
---- a/xmlsec-gcrypt.pc.in
-+++ b/xmlsec-gcrypt.pc.in
-@@ -6,6 +6,6 @@ includedir=@includedir@
- Name: xmlsec1-gcrypt
- Version: @VERSION@
- Description: XML Security Library implements XML Signature and XML Encryption standards
--Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ libxslt >= @LIBXSLT_MIN_VERSION@
-+Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ @LIBXSLT_COND@ @LIBXSLT_MIN_VERSION@
- Cflags: -DXMLSEC_CRYPTO=\"gcrypt\" @XMLSEC_GCRYPT_CFLAGS@
- Libs: @XMLSEC_GCRYPT_LIBS@
-diff --git a/xmlsec-gnutls.pc.in b/xmlsec-gnutls.pc.in
-index e538cd4..d01cf82 100644
---- a/xmlsec-gnutls.pc.in
-+++ b/xmlsec-gnutls.pc.in
-@@ -6,6 +6,6 @@ includedir=@includedir@
- Name: xmlsec1-gnutls
- Version: @VERSION@
- Description: XML Security Library implements XML Signature and XML Encryption standards
--Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ libxslt >= @LIBXSLT_MIN_VERSION@
-+Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ @LIBXSLT_COND@ @LIBXSLT_MIN_VERSION@
- Cflags: -DXMLSEC_CRYPTO=\"gnutls\" @XMLSEC_GNUTLS_CFLAGS@
- Libs: @XMLSEC_GNUTLS_LIBS@
-diff --git a/xmlsec-nss.pc.in b/xmlsec-nss.pc.in
-index a6d6c5c..75f0232 100644
---- a/xmlsec-nss.pc.in
-+++ b/xmlsec-nss.pc.in
-@@ -6,6 +6,6 @@ includedir=@includedir@
- Name: xmlsec1-nss
- Version: @VERSION@
- Description: XML Security Library implements XML Signature and XML Encryption standards
--Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ libxslt >= @LIBXSLT_MIN_VERSION@ @NSPR_PACKAGE@ >= @MOZILLA_MIN_VERSION@ @NSS_PACKAGE@ >= @MOZILLA_MIN_VERSION@
-+Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ @LIBXSLT_COND@ @LIBXSLT_MIN_VERSION@ @NSPR_PACKAGE@ >= @MOZILLA_MIN_VERSION@ @NSS_PACKAGE@ >= @MOZILLA_MIN_VERSION@
- Cflags: -DXMLSEC_CRYPTO=\"nss\" -DXMLSEC_CRYPTO_NSS=1 @XMLSEC_CORE_CFLAGS@
- Libs: -L${libdir} -lxmlsec1-nss @XMLSEC_CORE_LIBS@
-diff --git a/xmlsec-openssl.pc.in b/xmlsec-openssl.pc.in
-index 85ee2b0..e9d0651 100644
---- a/xmlsec-openssl.pc.in
-+++ b/xmlsec-openssl.pc.in
-@@ -6,6 +6,6 @@ includedir=@includedir@
- Name: xmlsec1-openssl
- Version: @VERSION@
- Description: XML Security Library implements XML Signature and XML Encryption standards
--Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ libxslt >= @LIBXSLT_MIN_VERSION@
-+Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ @LIBXSLT_COND@ @LIBXSLT_MIN_VERSION@
- Cflags: -DXMLSEC_CRYPTO=\"openssl\" @XMLSEC_OPENSSL_CFLAGS@
- Libs: @XMLSEC_OPENSSL_LIBS@
-diff --git a/xmlsec.pc.in b/xmlsec.pc.in
-index a750ab8..14ea670 100644
---- a/xmlsec.pc.in
-+++ b/xmlsec.pc.in
-@@ -6,6 +6,6 @@ includedir=@includedir@
- Name: xmlsec1
- Version: @VERSION@
- Description: XML Security Library implements XML Signature and XML Encryption standards
--Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ libxslt >= @LIBXSLT_MIN_VERSION@
-+Requires: libxml-2.0 >= @LIBXML_MIN_VERSION@ @LIBXSLT_COND@ @LIBXSLT_MIN_VERSION@
- Cflags: -DXMLSEC_CRYPTO=\"@XMLSEC_CRYPTO@\" -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 @XMLSEC_CORE_CFLAGS@
- Libs: -L${libdir} @XMLSEC_CORE_LIBS@
---
-2.6.2
-
diff --git a/meta-app-framework/recipes-support/xmlsec1/xmlsec1_1.%.bbappend b/meta-app-framework/recipes-support/xmlsec1/xmlsec1_1.%.bbappend
deleted file mode 100644
index 8f1972f07..000000000
--- a/meta-app-framework/recipes-support/xmlsec1/xmlsec1_1.%.bbappend
+++ /dev/null
@@ -1,6 +0,0 @@
-FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
-SRC_URI += "file://Only-require-libxslt-in-.pc-files-when-necessary.patch"
-
-DEPENDS += "libxml2"
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-ivi-common/recipes-test/freetype/freetype_2.7.1.bbappend b/meta-ivi-common/recipes-test/freetype/freetype_2.8.bbappend
index 0593cf573..282ce784a 100644
--- a/meta-ivi-common/recipes-test/freetype/freetype_2.7.1.bbappend
+++ b/meta-ivi-common/recipes-test/freetype/freetype_2.8.bbappend
@@ -4,8 +4,8 @@ SRC_URI =+ "${SOURCEFORGE_MIRROR}/freetype/ft2demos-${PV}.tar.bz2;name=ft2demos
file://0001-Makefile-dont-build-gfx-demos.patch;patchdir=../ft2demos-${PV} \
file://0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch;patchdir=../ft2demos-${PV} \
"
-SRC_URI[ft2demos.md5sum] = "5c10cb35bec755dbd3f7999e0f97aee3"
-SRC_URI[ft2demos.sha256sum] = "d3f8a0d5a3f0d58701133458a8c1d3f97f658869f3c904b1fda447ed3b290ecd"
+SRC_URI[ft2demos.md5sum] = "61db5831e213acb843f0fc6d10186054"
+SRC_URI[ft2demos.sha256sum] = "2b6ce0d36bcb43fcc8aac07a0287982d855571ee271c3803c768e501f9c1a233"
PACKAGES =+ "${PN}-demos"
diff --git a/meta-ivi-common/recipes-test/packagegroups/packagegroup-ivi-common-test.bb b/meta-ivi-common/recipes-test/packagegroups/packagegroup-ivi-common-test.bb
index bd42820fc..44fabae06 100644
--- a/meta-ivi-common/recipes-test/packagegroups/packagegroup-ivi-common-test.bb
+++ b/meta-ivi-common/recipes-test/packagegroups/packagegroup-ivi-common-test.bb
@@ -34,9 +34,6 @@ RDEPENDS_${PN} += "\
"
# to be added, but needs LICENSE_FLAGS_WHITELIST="non-commercial"
# netperf
-# wayland-fits is broken in jethro, https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg46505.html
-# http://errors.yoctoproject.org/Errors/Details/35141/
-# wayland-fits
# FTBS, SPEC-316
# himeno
diff --git a/meta-ivi-common/recipes-test/wayland/wayland-fits_%.bbappend b/meta-ivi-common/recipes-test/wayland/wayland-fits_%.bbappend
deleted file mode 100644
index 772f81b0f..000000000
--- a/meta-ivi-common/recipes-test/wayland/wayland-fits_%.bbappend
+++ /dev/null
@@ -1,5 +0,0 @@
-# Disable GTK+ and EFL tests
-PACKAGECONFIG = ""
-
-# UInput driver is necessary on QEMU
-RDEPENDS_${PN}_append_qemux86-64 = " kernel-module-uinput"
diff --git a/meta-ivi-common/recipes-test/wayland/wayland-fits_git.bbappend b/meta-ivi-common/recipes-test/wayland/wayland-fits_git.bbappend
deleted file mode 100644
index 84c7cfdbe..000000000
--- a/meta-ivi-common/recipes-test/wayland/wayland-fits_git.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-# Updating to latest version is necessary for Weston >= 1.9.0
-SRCREV = "f108335e374772ae2818a30ae37fe6fcda81980f"
diff --git a/meta-netboot/classes/netboot.bbclass b/meta-netboot/classes/netboot.bbclass
index 65ca4a15d..363e6bcc9 100644
--- a/meta-netboot/classes/netboot.bbclass
+++ b/meta-netboot/classes/netboot.bbclass
@@ -1,10 +1,7 @@
# Enable network bootable image and initrd/initramfs
-# add image classes for uboot
-IMAGE_CLASSES += "${@'image_types_uboot' if (d.getVar("KERNEL_IMAGETYPE", True) == "uImage") else ''}"
-
python () {
- if (bb.utils.contains_any("IMAGE_FSTYPES",["live","vmdk","vmdk.xz"],True,False,d)):
+ if (bb.utils.contains_any("IMAGE_FSTYPES",["live","wic.vmdk"],True,False,d)):
# typical case for Minnowboard Max
d.setVar("INITRD_IMAGE","initramfs-netboot-image")
d.setVar("INITRD_IMAGE_LIVE",d.getVar("INITRD_IMAGE",True))
diff --git a/meta-security/COPYING.MIT b/meta-security/COPYING.MIT
new file mode 100644
index 000000000..89de35479
--- /dev/null
+++ b/meta-security/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/meta-security/README.md b/meta-security/README.md
new file mode 100644
index 000000000..0bae9f3fb
--- /dev/null
+++ b/meta-security/README.md
@@ -0,0 +1,31 @@
+This README file contains information on the contents of the
+meta-security layer.
+
+Please see the corresponding sections below for details.
+
+
+Dependencies
+============
+
+This layer depends on:
+
+ URI: git://git.openembedded.org/bitbake
+ branch: master
+
+ URI: git://git.openembedded.org/openembedded-core
+ layers: meta
+ branch: master
+
+ URI: git://git.yoctoproject.org/meta-security
+ branch: master
+
+
+Patches
+=======
+
+Please submit any patches against the meta-security layer via gerrit
+reviews.
+
+For discussion use the discussion mailing list
+mailto:automotive-discussions@lists.linuxfoundation.org
+
diff --git a/meta-security/conf/layer.conf b/meta-security/conf/layer.conf
new file mode 100644
index 000000000..c051e5885
--- /dev/null
+++ b/meta-security/conf/layer.conf
@@ -0,0 +1,12 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH =. "${LAYERDIR}:"
+
+# We have a packages directory, add to BBFILES
+BBFILES := "${BBFILES} \
+ ${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+# Must prioritize our rpm recipe over the default ones.
+BBFILE_COLLECTIONS += "security-smack"
+BBFILE_PATTERN_security-smack := "^${LAYERDIR}/"
+BBFILE_PRIORITY_security-smack = "8"
diff --git a/meta-security/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-security/recipes-connectivity/bluez5/bluez5_%.bbappend
new file mode 100644
index 000000000..c62842d5b
--- /dev/null
+++ b/meta-security/recipes-connectivity/bluez5/bluez5_%.bbappend
@@ -0,0 +1,55 @@
+# Recent bluez5 releases started limiting the capabilities of
+# bluetoothd. When running on a Smack-enabled system, that change has the
+# effect that bluetoothd can no longer create the input device under
+# /sys because bluez5 running with label "System" has no write
+# access to that.
+#
+# It works when running as normal root with unrestricted capabilities
+# because then CAP_MAC_OVERRIDE (a Smack-specific capability) allows
+# the process to ignore Smack rules.
+#
+# We need to ensure that bluetoothd still has that capability.
+#
+# To fix the issue, Patick and Casey(the Smack architect) had a talk
+# about it in Ostro dev mail list. Casey has some ideas about the issue:
+# "Turning off privilege is a great thing to do *so long as you don't
+# really need the privilege*. In this case you really need it.
+# The application package isn't written to account for Smack's use of
+# CAP_MAC_OVERRIDE as the mechanism for controlling this dangerous operation.
+# Yes, it would be possible to change /proc to change the Smack label on
+# that particular file, but that might open other paths for exploit.
+# I say give the program the required capability. The program maintainer
+# may well say change the kernel handling of /proc. You're stuck in the
+# middle, as both work the way they're intended and hence the system
+# doesn't work. :( There isn't a way to make this work without "loosening"
+# something."
+# Therefore, when we we run the program with CAP_MAC_OVERRIDE,
+# the whole reason for having capabilities is so the we can give a
+# process the ability to bypass one kind of check without giving it the
+# ability to bypass other, unrelated checks. A process with
+# CAP_MAC_OVERRIDE is still constrained by the file mode bits.
+# We was overly worried about granting that capability.
+# When it has no other effect than excluding a process from Smack MAC enforcement,
+# then adding to the process seems like the right solution for now.
+#
+# The conclusion from Patick and Casey is that the Smack architect give the key point
+# that this is the solution preferred.
+#
+# Because the solution is to some extend specific to the environment
+# in which connmand runs, this change is not submitted upstream
+# and it can be overridden by a distro via FIX_BLUEZ5_CAPABILITIES.
+#
+# The related patch has been submitted to upstream too.
+# upstream link: http://permalink.gmane.org/gmane.linux.bluez.kernel/67993
+
+FIX_BLUEZ5_CAPABILITIES ??= ""
+FIX_BLUEZ5_CAPABILITIES_with-lsm-smack ??= "fix_bluez5_capabilities"
+do_install[postfuncs] += "${FIX_BLUEZ5_CAPABILITIES}"
+
+fix_bluez5_capabilities () {
+ service="${D}/${systemd_unitdir}/system/bluetooth.service"
+ if [ -f "$service" ] &&
+ grep -q '^CapabilityBoundingSet=' "$service"; then
+ sed -i -e 's/^CapabilityBoundingSet=/CapabilityBoundingSet=CAP_MAC_OVERRIDE /' "$service"
+ fi
+}
diff --git a/meta-security/recipes-connectivity/connman/connman_%.bbappend b/meta-security/recipes-connectivity/connman/connman_%.bbappend
new file mode 100644
index 000000000..f66c1e79b
--- /dev/null
+++ b/meta-security/recipes-connectivity/connman/connman_%.bbappend
@@ -0,0 +1,32 @@
+# Recent ConnMan releases started limiting the capabilities of
+# ConnMan. When running on a Smack-enabled system, that change has the
+# effect that connmand can no longer change network settings under
+# /proc/net because the Smack label of /proc is "_", and connmand
+# running with label "System" has no write access to that.
+#
+# It works when running as normal root with unrestricted capabilities
+# because then CAP_MAC_OVERRIDE (a Smack-specific capability) allows
+# the process to ignore Smack rules.
+#
+# We need to ensure that connmand still has that capability.
+#
+# The alternative would be to set up fine-grained labelling of
+# /proc with corresponding rules, which is considerably more work
+# and also may depend on kernel changes (like supporting smackfsroot
+# for procfs, which seems to be missing at the moment).
+#
+# Because the solution is to some extend specific to the environment
+# in which connmand runs, this change is not submitted upstream
+# and it can be overridden by a distro via FIX_CONNMAN_CAPABILITIES.
+
+FIX_CONNMAN_CAPABILITIES ??= ""
+FIX_CONNMAN_CAPABILITIES_with-lsm-smack ??= "fix_connman_capabilities"
+do_install[postfuncs] += "${FIX_CONNMAN_CAPABILITIES}"
+
+fix_connman_capabilities () {
+ service="${D}/${systemd_unitdir}/system/connman.service"
+ if [ -f "$service" ] &&
+ grep -q '^CapabilityBoundingSet=' "$service"; then
+ sed -i -e 's/^CapabilityBoundingSet=/CapabilityBoundingSet=CAP_MAC_OVERRIDE /' "$service"
+ fi
+}
diff --git a/meta-security/recipes-core/base-files/base-files_%.bbappend b/meta-security/recipes-core/base-files/base-files_%.bbappend
new file mode 100644
index 000000000..a6af1821b
--- /dev/null
+++ b/meta-security/recipes-core/base-files/base-files_%.bbappend
@@ -0,0 +1,73 @@
+# Install default Smack rules, copied from a running Tizen IVI 3.0.
+# Corresponds to manifest file from default-access-domains in Tizen:
+# https://review.tizen.org/git?p=platform/core/security/default-ac-domains.git;a=blob;f=packaging/default-ac-domains.manifest
+do_install_append_with-lsm-smack () {
+ install -d ${D}/${sysconfdir}/smack/accesses.d
+ cat >${D}/${sysconfdir}/smack/accesses.d/default-access-domains <<EOF
+System _ -----l
+System System::Log rwxa--
+System System::Run rwxat-
+System System::Shared rwxat-
+System ^ rwxa--
+_ System::Run rwxat-
+_ System -wx---
+^ System::Log rwxa--
+^ System::Run rwxat-
+^ System rwxa--
+EOF
+ chmod 0644 ${D}/${sysconfdir}/smack/accesses.d/default-access-domains
+
+ install -d ${D}/${libdir}/tmpfiles.d
+ cat >${D}/${libdir}/tmpfiles.d/packet-forwarding.conf <<EOF
+t /proc/sys/net/ipv4/conf/all/forwarding - - - - security.SMACK64=*
+t /proc/sys/net/ipv6/conf/all/forwarding - - - - security.SMACK64=*
+t /proc/sys/net/ipv4/conf/default/forwarding - - - - security.SMACK64=*
+t /proc/sys/net/ipv6/conf/default/forwarding - - - - security.SMACK64=*
+EOF
+ chmod 0644 ${D}/${libdir}/tmpfiles.d/packet-forwarding.conf
+
+ install -d ${D}/${base_libdir}/udev/rules.d
+ cat >${D}/${base_libdir}/udev/rules.d/85-netdev-ipconf-smacklabel.rules <<EOF
+SUBSYSTEM=="net", ENV{ID_NET_NAME}=="", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv4/conf/%k/*'", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv6/conf/%k/*'"
+
+SUBSYSTEM=="net", ENV{ID_NET_NAME}!="", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv4/conf/\$env{ID_NET_NAME}/*'", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv6/conf/\$env{ID_NET_NAME}/*'"
+EOF
+ chmod 0644 ${D}/${base_libdir}/udev/rules.d/85-netdev-ipconf-smacklabel.rules
+}
+
+# Do not rely on an rpm with manifest support. Apparently that approach
+# will no longer be used in Tizen 3.0. Instead set special Smack attributes
+# via postinst. This is much easier to use with bitbake, too:
+# - no need to maintain a patched rpm
+# - works for directories which are not packaged by default when empty
+RDEPENDS_${PN}_append_with-lsm-smack = " smack"
+DEPENDS_append_with-lsm-smack = " smack-native"
+pkg_postinst_${PN}_with-lsm-smack() {
+ #!/bin/sh -e
+
+ # https://review.tizen.org/gerrit/gitweb?p=platform/upstream/filesystem.git;a=blob;f=packaging/filesystem.manifest:
+ # <filesystem path="/etc" label="System::Shared" type="transmutable" />
+ install -d $D${sysconfdir}
+ # This has no effect on files installed into /etc during image construction
+ # because pseudo does not know the special semantic of SMACK::TRANSMUTE.
+ # To avoid having different xattrs on files inside /etc when pre-installed
+ # in an image vs. installed on a device, the xattr-images.bbclass has
+ # a workaround for this deficiency in pseudo.
+ chsmack -t $D${sysconfdir}
+ chsmack -a 'System::Shared' $D${sysconfdir}
+
+ # Same for /var. Any daemon running as "System" will get write access
+ # to everything.
+ install -d $D${localstatedir}
+ chsmack -t $D${localstatedir}
+ chsmack -a 'System::Shared' $D${localstatedir}
+
+ # <filesystem path="/tmp" label="*" />
+ mkdir -p $D/tmp
+ chsmack -a '*' $D/tmp
+
+ # <filesystem path="/var/log" label="System::Log" type="transmutable" />
+ # <filesystem path="/var/tmp" label="*" />
+ # These are in a file system mounted by systemd. We patch the systemd service
+ # to set these attributes.
+}
diff --git a/meta-security/recipes-core/coreutils/coreutils_%.bbappend b/meta-security/recipes-core/coreutils/coreutils_%.bbappend
new file mode 100644
index 000000000..ceaf6a29c
--- /dev/null
+++ b/meta-security/recipes-core/coreutils/coreutils_%.bbappend
@@ -0,0 +1,7 @@
+# Smack patches are included in coreutils v8.22, we just need to enable them.
+# The default is not deterministic (enabled if libsmack found), so disable
+# explicitly otherwise.
+EXTRA_OECONF_SMACK = "--disable-libsmack"
+EXTRA_OECONF_SMACK_with-lsm-smack = "--enable-libsmack"
+EXTRA_OECONF_append = " ${EXTRA_OECONF_SMACK}"
+DEPENDS_append_with-lsm-smack = " smack"
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0001-Fix-memleak-in-GetConnectionCredentials-handler.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0001-Fix-memleak-in-GetConnectionCredentials-handler.patch
new file mode 100644
index 000000000..271ac48a1
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0001-Fix-memleak-in-GetConnectionCredentials-handler.patch
@@ -0,0 +1,32 @@
+From eacdc525a1f7bfc534e248a5a946c08b6f4aab35 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Wed, 17 Jun 2015 18:53:41 +0100
+Subject: [PATCH 1/8] Fix memleak in GetConnectionCredentials handler
+
+Reply message was not unreferenced when GetConnectionCredentials
+handler was successful.
+
+Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+[smcv: changed bus_message_unref() to dbus_message_unref()]
+Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91008
+---
+ bus/driver.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/bus/driver.c b/bus/driver.c
+index f5d3ebe..888c7ca 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -1613,6 +1613,8 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ goto oom;
+ }
+
++ dbus_message_unref (reply);
++
+ return TRUE;
+
+ oom:
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0002-New-a-sv-helper-for-using-byte-arrays-as-the-variant.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0002-New-a-sv-helper-for-using-byte-arrays-as-the-variant.patch
new file mode 100644
index 000000000..64c8b9b50
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0002-New-a-sv-helper-for-using-byte-arrays-as-the-variant.patch
@@ -0,0 +1,97 @@
+From 25cb15916402c55112cae2be0954d24afe74e2f2 Mon Sep 17 00:00:00 2001
+From: Tyler Hicks <tyhicks@canonical.com>
+Date: Thu, 13 Mar 2014 17:37:38 -0500
+Subject: [PATCH 2/8] New a{sv} helper for using byte arrays as the variant
+
+Create a new helper for using a byte array as the value in the mapping
+from string to variant.
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75113
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89041
+Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
+Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
+---
+ dbus/dbus-asv-util.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ dbus/dbus-asv-util.h | 4 ++++
+ 2 files changed, 58 insertions(+)
+
+diff --git a/dbus/dbus-asv-util.c b/dbus/dbus-asv-util.c
+index 583e41f..d3ac5e9 100644
+--- a/dbus/dbus-asv-util.c
++++ b/dbus/dbus-asv-util.c
+@@ -258,3 +258,57 @@ _dbus_asv_add_string (DBusMessageIter *arr_iter,
+
+ return TRUE;
+ }
++
++/**
++ * Create a new entry in an a{sv} (map from string to variant)
++ * with a byte array value.
++ *
++ * If this function fails, the a{sv} must be abandoned, for instance
++ * with _dbus_asv_abandon().
++ *
++ * @param arr_iter the iterator which is appending to the array
++ * @param key a UTF-8 key for the map
++ * @param value the value
++ * @param n_elements the number of elements to append
++ * @returns #TRUE on success, or #FALSE if not enough memory
++ */
++dbus_bool_t
++_dbus_asv_add_byte_array (DBusMessageIter *arr_iter,
++ const char *key,
++ const void *value,
++ int n_elements)
++{
++ DBusMessageIter entry_iter;
++ DBusMessageIter var_iter;
++ DBusMessageIter byte_array_iter;
++
++ if (!_dbus_asv_open_entry (arr_iter, &entry_iter, key, "ay", &var_iter))
++ return FALSE;
++
++ if (!dbus_message_iter_open_container (&var_iter, DBUS_TYPE_ARRAY,
++ DBUS_TYPE_BYTE_AS_STRING,
++ &byte_array_iter))
++ {
++ _dbus_asv_abandon_entry (arr_iter, &entry_iter, &var_iter);
++ return FALSE;
++ }
++
++ if (!dbus_message_iter_append_fixed_array (&byte_array_iter, DBUS_TYPE_BYTE,
++ &value, n_elements))
++ {
++ dbus_message_iter_abandon_container (&var_iter, &byte_array_iter);
++ _dbus_asv_abandon_entry (arr_iter, &entry_iter, &var_iter);
++ return FALSE;
++ }
++
++ if (!dbus_message_iter_close_container (&var_iter, &byte_array_iter))
++ {
++ _dbus_asv_abandon_entry (arr_iter, &entry_iter, &var_iter);
++ return FALSE;
++ }
++
++ if (!_dbus_asv_close_entry (arr_iter, &entry_iter, &var_iter))
++ return FALSE;
++
++ return TRUE;
++}
+diff --git a/dbus/dbus-asv-util.h b/dbus/dbus-asv-util.h
+index 0337260..277ab80 100644
+--- a/dbus/dbus-asv-util.h
++++ b/dbus/dbus-asv-util.h
+@@ -42,5 +42,9 @@ dbus_bool_t _dbus_asv_add_uint32 (DBusMessageIter *arr_iter,
+ dbus_bool_t _dbus_asv_add_string (DBusMessageIter *arr_iter,
+ const char *key,
+ const char *value);
++dbus_bool_t _dbus_asv_add_byte_array (DBusMessageIter *arr_iter,
++ const char *key,
++ const void *value,
++ int n_elements);
+
+ #endif
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0003-Add-LSM-agnostic-support-for-LinuxSecurityLabel-cred.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0003-Add-LSM-agnostic-support-for-LinuxSecurityLabel-cred.patch
new file mode 100644
index 000000000..fcb85504d
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0003-Add-LSM-agnostic-support-for-LinuxSecurityLabel-cred.patch
@@ -0,0 +1,515 @@
+From 9da49d4eb6982c659fec988231baef8cd1b05be2 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: Wed, 11 Feb 2015 13:19:15 +0000
+Subject: [PATCH 3/8] Add LSM-agnostic support for LinuxSecurityLabel
+ credential
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89041
+Change-Id: I70512843d1a7661c87461b1b6d86fbfbda934ad5
+Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
+Acked-by: Stephen Smalley <sds@tycho.nsa.gov> (for SELinux)
+Acked-by: John Johansen <john.johansen@canonical.com> (for AppArmor)
+Acked-by: Casey Schaufler <casey@schaufler-ca.com> (for Smack)
+Tested-by: Tyler Hicks <tyhicks@canonical.com>
+---
+ bus/driver.c | 19 ++++++++
+ dbus/dbus-auth.c | 11 +++--
+ dbus/dbus-connection-internal.h | 3 ++
+ dbus/dbus-connection.c | 26 ++++++++++
+ dbus/dbus-credentials.c | 68 ++++++++++++++++++++++++++
+ dbus/dbus-credentials.h | 4 ++
+ dbus/dbus-sysdeps-unix.c | 105 ++++++++++++++++++++++++++++++++++++++++
+ dbus/dbus-transport.c | 27 +++++++++++
+ dbus/dbus-transport.h | 3 ++
+ 9 files changed, 262 insertions(+), 4 deletions(-)
+
+diff --git a/bus/driver.c b/bus/driver.c
+index 888c7ca..11706f8 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -34,6 +34,7 @@
+ #include "utils.h"
+
+ #include <dbus/dbus-asv-util.h>
++#include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-string.h>
+ #include <dbus/dbus-internals.h>
+ #include <dbus/dbus-message.h>
+@@ -1567,6 +1568,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ DBusMessageIter reply_iter;
+ DBusMessageIter array_iter;
+ unsigned long ulong_val;
++ char *s;
+ const char *service;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -1601,6 +1603,23 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ goto oom;
+ }
+
++ if (_dbus_connection_get_linux_security_label (conn, &s))
++ {
++ if (s == NULL)
++ goto oom;
++
++ /* use the GVariant bytestring convention for strings of unknown
++ * encoding: include the \0 in the payload, for zero-copy reading */
++ if (!_dbus_asv_add_byte_array (&array_iter, "LinuxSecurityLabel",
++ s, strlen (s) + 1))
++ {
++ dbus_free (s);
++ goto oom;
++ }
++
++ dbus_free (s);
++ }
++
+ if (!_dbus_asv_close (&reply_iter, &array_iter))
+ goto oom;
+
+diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
+index 6a07665..aee877d 100644
+--- a/dbus/dbus-auth.c
++++ b/dbus/dbus-auth.c
+@@ -1102,20 +1102,23 @@ handle_server_data_external_mech (DBusAuth *auth,
+ auth->desired_identity))
+ return FALSE;
+
+- /* also copy process ID from the socket credentials
++ /* also copy misc process info from the socket credentials
+ */
+ if (!_dbus_credentials_add_credential (auth->authorized_identity,
+ DBUS_CREDENTIAL_UNIX_PROCESS_ID,
+ auth->credentials))
+ return FALSE;
+
+- /* also copy audit data from the socket credentials
+- */
+ if (!_dbus_credentials_add_credential (auth->authorized_identity,
+ DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID,
+ auth->credentials))
+ return FALSE;
+-
++
++ if (!_dbus_credentials_add_credential (auth->authorized_identity,
++ DBUS_CREDENTIAL_LINUX_SECURITY_LABEL,
++ auth->credentials))
++ return FALSE;
++
+ if (!send_ok (auth))
+ return FALSE;
+
+diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
+index 2897404..64ef336 100644
+--- a/dbus/dbus-connection-internal.h
++++ b/dbus/dbus-connection-internal.h
+@@ -107,6 +107,9 @@ void _dbus_connection_set_pending_fds_function (DBusConnectio
+ DBusPendingFdsChangeFunction callback,
+ void *data);
+
++dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
++ char **label_p);
++
+ /* if DBUS_ENABLE_STATS */
+ void _dbus_connection_get_stats (DBusConnection *connection,
+ dbus_uint32_t *in_messages,
+diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
+index b574207..8952b75 100644
+--- a/dbus/dbus-connection.c
++++ b/dbus/dbus-connection.c
+@@ -5322,6 +5322,32 @@ dbus_connection_set_unix_user_function (DBusConnection *connection,
+ (* old_free_function) (old_data);
+ }
+
++/* Same calling convention as dbus_connection_get_windows_user */
++dbus_bool_t
++_dbus_connection_get_linux_security_label (DBusConnection *connection,
++ char **label_p)
++{
++ dbus_bool_t result;
++
++ _dbus_assert (connection != NULL);
++ _dbus_assert (label_p != NULL);
++
++ CONNECTION_LOCK (connection);
++
++ if (!_dbus_transport_try_to_authenticate (connection->transport))
++ result = FALSE;
++ else
++ result = _dbus_transport_get_linux_security_label (connection->transport,
++ label_p);
++#ifndef __linux__
++ _dbus_assert (!result);
++#endif
++
++ CONNECTION_UNLOCK (connection);
++
++ return result;
++}
++
+ /**
+ * Gets the Windows user SID of the connection if known. Returns
+ * #TRUE if the ID is filled in. Always returns #FALSE on non-Windows
+diff --git a/dbus/dbus-credentials.c b/dbus/dbus-credentials.c
+index 7325125..151bb00 100644
+--- a/dbus/dbus-credentials.c
++++ b/dbus/dbus-credentials.c
+@@ -50,6 +50,7 @@ struct DBusCredentials {
+ dbus_uid_t unix_uid;
+ dbus_pid_t pid;
+ char *windows_sid;
++ char *linux_security_label;
+ void *adt_audit_data;
+ dbus_int32_t adt_audit_data_size;
+ };
+@@ -79,6 +80,7 @@ _dbus_credentials_new (void)
+ creds->unix_uid = DBUS_UID_UNSET;
+ creds->pid = DBUS_PID_UNSET;
+ creds->windows_sid = NULL;
++ creds->linux_security_label = NULL;
+ creds->adt_audit_data = NULL;
+ creds->adt_audit_data_size = 0;
+
+@@ -133,6 +135,7 @@ _dbus_credentials_unref (DBusCredentials *credentials)
+ if (credentials->refcount == 0)
+ {
+ dbus_free (credentials->windows_sid);
++ dbus_free (credentials->linux_security_label);
+ dbus_free (credentials->adt_audit_data);
+ dbus_free (credentials);
+ }
+@@ -193,6 +196,30 @@ _dbus_credentials_add_windows_sid (DBusCredentials *credentials,
+ }
+
+ /**
++ * Add a Linux security label, as used by LSMs such as SELinux, Smack and
++ * AppArmor, to the credentials.
++ *
++ * @param credentials the object
++ * @param label the label
++ * @returns #FALSE if no memory
++ */
++dbus_bool_t
++_dbus_credentials_add_linux_security_label (DBusCredentials *credentials,
++ const char *label)
++{
++ char *copy;
++
++ copy = _dbus_strdup (label);
++ if (copy == NULL)
++ return FALSE;
++
++ dbus_free (credentials->linux_security_label);
++ credentials->linux_security_label = copy;
++
++ return TRUE;
++}
++
++/**
+ * Add ADT audit data to the credentials.
+ *
+ * @param credentials the object
+@@ -236,6 +263,8 @@ _dbus_credentials_include (DBusCredentials *credentials,
+ return credentials->unix_uid != DBUS_UID_UNSET;
+ case DBUS_CREDENTIAL_WINDOWS_SID:
+ return credentials->windows_sid != NULL;
++ case DBUS_CREDENTIAL_LINUX_SECURITY_LABEL:
++ return credentials->linux_security_label != NULL;
+ case DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID:
+ return credentials->adt_audit_data != NULL;
+ }
+@@ -284,6 +313,19 @@ _dbus_credentials_get_windows_sid (DBusCredentials *credentials)
+ }
+
+ /**
++ * Gets the Linux security label (as used by LSMs) from the credentials,
++ * or #NULL if the credentials object doesn't contain a security label.
++ *
++ * @param credentials the object
++ * @returns the security label
++ */
++const char *
++_dbus_credentials_get_linux_security_label (DBusCredentials *credentials)
++{
++ return credentials->linux_security_label;
++}
++
++/**
+ * Gets the ADT audit data in the credentials, or #NULL if
+ * the credentials object doesn't contain ADT audit data.
+ *
+@@ -329,6 +371,10 @@ _dbus_credentials_are_superset (DBusCredentials *credentials,
+ (possible_subset->windows_sid == NULL ||
+ (credentials->windows_sid && strcmp (possible_subset->windows_sid,
+ credentials->windows_sid) == 0)) &&
++ (possible_subset->linux_security_label == NULL ||
++ (credentials->linux_security_label != NULL &&
++ strcmp (possible_subset->linux_security_label,
++ credentials->linux_security_label) == 0)) &&
+ (possible_subset->adt_audit_data == NULL ||
+ (credentials->adt_audit_data && memcmp (possible_subset->adt_audit_data,
+ credentials->adt_audit_data,
+@@ -348,6 +394,7 @@ _dbus_credentials_are_empty (DBusCredentials *credentials)
+ credentials->pid == DBUS_PID_UNSET &&
+ credentials->unix_uid == DBUS_UID_UNSET &&
+ credentials->windows_sid == NULL &&
++ credentials->linux_security_label == NULL &&
+ credentials->adt_audit_data == NULL;
+ }
+
+@@ -388,6 +435,9 @@ _dbus_credentials_add_credentials (DBusCredentials *credentials,
+ DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID,
+ other_credentials) &&
+ _dbus_credentials_add_credential (credentials,
++ DBUS_CREDENTIAL_LINUX_SECURITY_LABEL,
++ other_credentials) &&
++ _dbus_credentials_add_credential (credentials,
+ DBUS_CREDENTIAL_WINDOWS_SID,
+ other_credentials);
+ }
+@@ -427,6 +477,13 @@ _dbus_credentials_add_credential (DBusCredentials *credentials,
+ if (!_dbus_credentials_add_windows_sid (credentials, other_credentials->windows_sid))
+ return FALSE;
+ }
++ else if (which == DBUS_CREDENTIAL_LINUX_SECURITY_LABEL &&
++ other_credentials->linux_security_label != NULL)
++ {
++ if (!_dbus_credentials_add_linux_security_label (credentials,
++ other_credentials->linux_security_label))
++ return FALSE;
++ }
+ else if (which == DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID &&
+ other_credentials->adt_audit_data != NULL)
+ {
+@@ -449,6 +506,8 @@ _dbus_credentials_clear (DBusCredentials *credentials)
+ credentials->unix_uid = DBUS_UID_UNSET;
+ dbus_free (credentials->windows_sid);
+ credentials->windows_sid = NULL;
++ dbus_free (credentials->linux_security_label);
++ credentials->linux_security_label = NULL;
+ dbus_free (credentials->adt_audit_data);
+ credentials->adt_audit_data = NULL;
+ credentials->adt_audit_data_size = 0;
+@@ -540,6 +599,15 @@ _dbus_credentials_to_string_append (DBusCredentials *credentials,
+ else
+ join = FALSE;
+
++ if (credentials->linux_security_label != NULL)
++ {
++ if (!_dbus_string_append_printf (string, "%slsm='%s'",
++ join ? " " : "",
++ credentials->linux_security_label))
++ goto oom;
++ join = TRUE;
++ }
++
+ return TRUE;
+ oom:
+ return FALSE;
+diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h
+index abcc4bb..ab74eac 100644
+--- a/dbus/dbus-credentials.h
++++ b/dbus/dbus-credentials.h
+@@ -34,6 +34,7 @@ typedef enum {
+ DBUS_CREDENTIAL_UNIX_PROCESS_ID,
+ DBUS_CREDENTIAL_UNIX_USER_ID,
+ DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID,
++ DBUS_CREDENTIAL_LINUX_SECURITY_LABEL,
+ DBUS_CREDENTIAL_WINDOWS_SID
+ } DBusCredentialType;
+
+@@ -47,6 +48,8 @@ dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials
+ dbus_uid_t uid);
+ dbus_bool_t _dbus_credentials_add_windows_sid (DBusCredentials *credentials,
+ const char *windows_sid);
++dbus_bool_t _dbus_credentials_add_linux_security_label (DBusCredentials *credentials,
++ const char *label);
+ dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials *credentials,
+ void *audit_data,
+ dbus_int32_t size);
+@@ -55,6 +58,7 @@ dbus_bool_t _dbus_credentials_include (DBusCredentials
+ dbus_pid_t _dbus_credentials_get_pid (DBusCredentials *credentials);
+ dbus_uid_t _dbus_credentials_get_unix_uid (DBusCredentials *credentials);
+ const char* _dbus_credentials_get_windows_sid (DBusCredentials *credentials);
++const char * _dbus_credentials_get_linux_security_label (DBusCredentials *credentials);
+ void * _dbus_credentials_get_adt_audit_data (DBusCredentials *credentials);
+ dbus_int32_t _dbus_credentials_get_adt_audit_data_size (DBusCredentials *credentials);
+ dbus_bool_t _dbus_credentials_are_superset (DBusCredentials *credentials,
+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
+index fe891ab..61af423 100644
+--- a/dbus/dbus-sysdeps-unix.c
++++ b/dbus/dbus-sysdeps-unix.c
+@@ -1639,6 +1639,105 @@ write_credentials_byte (int server_fd,
+ }
+ }
+
++/* return FALSE on OOM, TRUE otherwise, even if no credentials were found */
++static dbus_bool_t
++add_linux_security_label_to_credentials (int client_fd,
++ DBusCredentials *credentials)
++{
++#if defined(__linux__) && defined(SO_PEERSEC)
++ DBusString buf;
++ socklen_t len = 1024;
++ dbus_bool_t oom = FALSE;
++
++ if (!_dbus_string_init_preallocated (&buf, len) ||
++ !_dbus_string_set_length (&buf, len))
++ return FALSE;
++
++ while (getsockopt (client_fd, SOL_SOCKET, SO_PEERSEC,
++ _dbus_string_get_data (&buf), &len) < 0)
++ {
++ int e = errno;
++
++ _dbus_verbose ("getsockopt failed with %s, len now %lu\n",
++ _dbus_strerror (e), (unsigned long) len);
++
++ if (e != ERANGE || len <= _dbus_string_get_length (&buf))
++ {
++ _dbus_verbose ("Failed to getsockopt(SO_PEERSEC): %s\n",
++ _dbus_strerror (e));
++ goto out;
++ }
++
++ /* If not enough space, len is updated to be enough.
++ * Try again with a large enough buffer. */
++ if (!_dbus_string_set_length (&buf, len))
++ {
++ oom = TRUE;
++ goto out;
++ }
++
++ _dbus_verbose ("will try again with %lu\n", (unsigned long) len);
++ }
++
++ if (len <= 0)
++ {
++ _dbus_verbose ("getsockopt(SO_PEERSEC) yielded <= 0 bytes: %lu\n",
++ (unsigned long) len);
++ goto out;
++ }
++
++ if (len > _dbus_string_get_length (&buf))
++ {
++ _dbus_verbose ("%lu > %d", (unsigned long) len,
++ _dbus_string_get_length (&buf));
++ _dbus_assert_not_reached ("getsockopt(SO_PEERSEC) overflowed");
++ }
++
++ if (_dbus_string_get_byte (&buf, len - 1) == 0)
++ {
++ /* the kernel included the trailing \0 in its count,
++ * but DBusString always has an extra \0 after the data anyway */
++ _dbus_verbose ("subtracting trailing \\0\n");
++ len--;
++ }
++
++ if (!_dbus_string_set_length (&buf, len))
++ {
++ _dbus_assert_not_reached ("shortening string should not lead to OOM");
++ oom = TRUE;
++ goto out;
++ }
++
++ if (strlen (_dbus_string_get_const_data (&buf)) != len)
++ {
++ /* LSM people on the linux-security-module@ mailing list say this
++ * should never happen: the label should be a bytestring with
++ * an optional trailing \0 */
++ _dbus_verbose ("security label from kernel had an embedded \\0, "
++ "ignoring it\n");
++ goto out;
++ }
++
++ _dbus_verbose ("getsockopt(SO_PEERSEC): %lu bytes excluding \\0: %s\n",
++ (unsigned long) len,
++ _dbus_string_get_const_data (&buf));
++
++ if (!_dbus_credentials_add_linux_security_label (credentials,
++ _dbus_string_get_const_data (&buf)))
++ {
++ oom = TRUE;
++ goto out;
++ }
++
++out:
++ _dbus_string_free (&buf);
++ return !oom;
++#else
++ /* no error */
++ return TRUE;
++#endif
++}
++
+ /**
+ * Reads a single byte which must be nul (an error occurs otherwise),
+ * and reads unix credentials if available. Clears the credentials
+@@ -1922,6 +2021,12 @@ _dbus_read_credentials_socket (int client_fd,
+ }
+ }
+
++ if (!add_linux_security_label_to_credentials (client_fd, credentials))
++ {
++ _DBUS_SET_OOM (error);
++ return FALSE;
++ }
++
+ return TRUE;
+ }
+
+diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c
+index e9dcc56..a43e7bb 100644
+--- a/dbus/dbus-transport.c
++++ b/dbus/dbus-transport.c
+@@ -1425,6 +1425,33 @@ _dbus_transport_set_unix_user_function (DBusTransport *transport,
+ transport->free_unix_user_data = free_data_function;
+ }
+
++dbus_bool_t
++_dbus_transport_get_linux_security_label (DBusTransport *transport,
++ char **label_p)
++{
++ DBusCredentials *auth_identity;
++
++ *label_p = NULL;
++
++ if (!transport->authenticated)
++ return FALSE;
++
++ auth_identity = _dbus_auth_get_identity (transport->auth);
++
++ if (_dbus_credentials_include (auth_identity,
++ DBUS_CREDENTIAL_LINUX_SECURITY_LABEL))
++ {
++ /* If no memory, we are supposed to return TRUE and set NULL */
++ *label_p = _dbus_strdup (_dbus_credentials_get_linux_security_label (auth_identity));
++
++ return TRUE;
++ }
++ else
++ {
++ return FALSE;
++ }
++}
++
+ /**
+ * See dbus_connection_get_windows_user().
+ *
+diff --git a/dbus/dbus-transport.h b/dbus/dbus-transport.h
+index 39c74c4..843f231 100644
+--- a/dbus/dbus-transport.h
++++ b/dbus/dbus-transport.h
+@@ -87,6 +87,9 @@ void _dbus_transport_set_unix_user_function (DBusTransport
+ DBusFreeFunction *old_free_data_function);
+ dbus_bool_t _dbus_transport_get_windows_user (DBusTransport *transport,
+ char **windows_sid_p);
++dbus_bool_t _dbus_transport_get_linux_security_label (DBusTransport *transport,
++ char **label_p);
++
+ void _dbus_transport_set_windows_user_function (DBusTransport *transport,
+ DBusAllowWindowsUserFunction function,
+ void *data,
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0004-Integration-of-Cynara-asynchronous-security-checks.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0004-Integration-of-Cynara-asynchronous-security-checks.patch
new file mode 100644
index 000000000..70d5fc9d7
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0004-Integration-of-Cynara-asynchronous-security-checks.patch
@@ -0,0 +1,2253 @@
+From 4dcfb02f17247ff9de966b62182cd2e08f301238 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Thu, 27 Nov 2014 18:11:05 +0100
+Subject: [PATCH 4/8] Integration of Cynara asynchronous security checks
+
+This commit introduces basic framework for asynchronous policy
+checks and Cynara integration code. Functions for checking security
+policy can now return third value - BUS_RESULT_LATER denoting check
+result unavailability. Whenever policy checker cannot decide on the
+result of the check it is supposed to allocate DeferredMessage structure
+that will be passed to the upper layers which can decide what should be
+done in such situation.
+Proper handling of such case will be implemented in subsequent commits.
+Currently such return value results in message denial.
+
+Change-Id: I9bcbce34577e5dc2a3cecf6233a0a2b0e43e1108
+---
+ bus/Makefile.am | 6 +
+ bus/bus.c | 134 +++++---
+ bus/bus.h | 58 ++--
+ bus/check.c | 215 ++++++++++++
+ bus/check.h | 68 ++++
+ bus/config-parser-common.c | 6 +
+ bus/config-parser-common.h | 1 +
+ bus/config-parser.c | 71 +++-
+ bus/connection.c | 56 ++-
+ bus/connection.h | 5 +
+ bus/cynara.c | 374 +++++++++++++++++++++
+ bus/cynara.h | 37 ++
+ bus/dispatch.c | 51 ++-
+ bus/policy.c | 193 +++++++----
+ bus/policy.h | 51 ++-
+ configure.ac | 13 +
+ test/Makefile.am | 1 +
+ test/data/invalid-config-files/badcheck-1.conf | 9 +
+ test/data/invalid-config-files/badcheck-2.conf | 9 +
+ test/data/valid-config-files/check-1.conf | 9 +
+ .../valid-config-files/debug-check-some.conf.in | 18 +
+ 22 files changed, 1211 insertions(+), 180 deletions(-)
+ create mode 100644 bus/check.c
+ create mode 100644 bus/check.h
+ create mode 100644 bus/cynara.c
+ create mode 100644 bus/cynara.h
+ create mode 100644 test/data/invalid-config-files/badcheck-1.conf
+ create mode 100644 test/data/invalid-config-files/badcheck-2.conf
+ create mode 100644 test/data/valid-config-files/check-1.conf
+ create mode 100644 test/data/valid-config-files/debug-check-some.conf.in
+
+diff --git a/bus/Makefile.am b/bus/Makefile.am
+index f335e30..b057d6b 100644
+--- a/bus/Makefile.am
++++ b/bus/Makefile.am
+@@ -7,6 +7,7 @@ DBUS_BUS_LIBS = \
+ $(THREAD_LIBS) \
+ $(ADT_LIBS) \
+ $(NETWORK_libs) \
++ $(CYNARA_LIBS) \
+ $(NULL)
+
+ DBUS_LAUNCHER_LIBS = \
+@@ -21,6 +22,7 @@ AM_CPPFLAGS = \
+ -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \
+ -DDBUS_COMPILATION \
+ -DDBUS_STATIC_BUILD \
++ $(CYNARA_CFLAGS) \
+ $(NULL)
+
+ # if assertions are enabled, improve backtraces
+@@ -60,12 +62,16 @@ BUS_SOURCES= \
+ activation-exit-codes.h \
+ bus.c \
+ bus.h \
++ check.c \
++ check.h \
+ config-parser.c \
+ config-parser.h \
+ config-parser-common.c \
+ config-parser-common.h \
+ connection.c \
+ connection.h \
++ cynara.c \
++ cynara.h \
+ desktop-file.c \
+ desktop-file.h \
+ $(DIR_WATCH_SOURCE) \
+diff --git a/bus/bus.c b/bus/bus.c
+index f0d980e..ac9ea8d 100644
+--- a/bus/bus.c
++++ b/bus/bus.c
+@@ -35,6 +35,7 @@
+ #include "signals.h"
+ #include "selinux.h"
+ #include "dir-watch.h"
++#include "check.h"
+ #include <dbus/dbus-list.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-credentials.h>
+@@ -63,6 +64,7 @@ struct BusContext
+ BusRegistry *registry;
+ BusPolicy *policy;
+ BusMatchmaker *matchmaker;
++ BusCheck *check;
+ BusLimits limits;
+ DBusRLimit *initial_fd_limit;
+ unsigned int fork : 1;
+@@ -962,6 +964,10 @@ bus_context_new (const DBusString *config_file,
+ #endif
+ }
+
++ context->check = bus_check_new(context, error);
++ if (context->check == NULL)
++ goto failed;
++
+ dbus_server_free_data_slot (&server_data_slot);
+
+ return context;
+@@ -1086,6 +1092,12 @@ bus_context_unref (BusContext *context)
+
+ bus_context_shutdown (context);
+
++ if (context->check)
++ {
++ bus_check_unref(context->check);
++ context->check = NULL;
++ }
++
+ if (context->connections)
+ {
+ bus_connections_unref (context->connections);
+@@ -1215,6 +1227,12 @@ bus_context_get_loop (BusContext *context)
+ return context->loop;
+ }
+
++BusCheck*
++bus_context_get_check (BusContext *context)
++{
++ return context->check;
++}
++
+ dbus_bool_t
+ bus_context_allow_unix_user (BusContext *context,
+ unsigned long uid)
+@@ -1386,6 +1404,7 @@ complain_about_message (BusContext *context,
+ DBusConnection *proposed_recipient,
+ dbus_bool_t requested_reply,
+ dbus_bool_t log,
++ const char *privilege,
+ DBusError *error)
+ {
+ DBusError stack_error = DBUS_ERROR_INIT;
+@@ -1415,7 +1434,8 @@ complain_about_message (BusContext *context,
+ dbus_set_error (&stack_error, error_name,
+ "%s, %d matched rules; type=\"%s\", sender=\"%s\" (%s) "
+ "interface=\"%s\" member=\"%s\" error name=\"%s\" "
+- "requested_reply=\"%d\" destination=\"%s\" (%s)",
++ "requested_reply=\"%d\" destination=\"%s\" (%s) "
++ "privilege=\"%s\"",
+ complaint,
+ matched_rules,
+ dbus_message_type_to_string (dbus_message_get_type (message)),
+@@ -1426,7 +1446,8 @@ complain_about_message (BusContext *context,
+ nonnull (dbus_message_get_error_name (message), "(unset)"),
+ requested_reply,
+ nonnull (dbus_message_get_destination (message), DBUS_SERVICE_DBUS),
+- proposed_recipient_loginfo);
++ proposed_recipient_loginfo,
++ nonnull (privilege, "(n/a)"));
+
+ /* If we hit OOM while setting the error, this will syslog "out of memory"
+ * which is itself an indication that something is seriously wrong */
+@@ -1450,14 +1471,15 @@ complain_about_message (BusContext *context,
+ * NULL for addressed_recipient may mean the bus driver, or may mean
+ * no destination was specified in the message (e.g. a signal).
+ */
+-dbus_bool_t
+-bus_context_check_security_policy (BusContext *context,
+- BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- DBusError *error)
++BusResult
++bus_context_check_security_policy (BusContext *context,
++ BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ DBusError *error,
++ BusDeferredMessage **deferred_message)
+ {
+ const char *dest;
+ BusClientPolicy *sender_policy;
+@@ -1466,6 +1488,7 @@ bus_context_check_security_policy (BusContext *context,
+ dbus_bool_t log;
+ int type;
+ dbus_bool_t requested_reply;
++ const char *privilege;
+
+ type = dbus_message_get_type (message);
+ dest = dbus_message_get_destination (message);
+@@ -1493,7 +1516,7 @@ bus_context_check_security_policy (BusContext *context,
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Message bus will not accept messages of unknown type\n");
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ requested_reply = FALSE;
+@@ -1517,11 +1540,11 @@ bus_context_check_security_policy (BusContext *context,
+ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+ "An SELinux policy prevents this sender from sending this "
+ "message to this recipient",
+- 0, message, sender, proposed_recipient, FALSE, FALSE, error);
++ 0, message, sender, proposed_recipient, FALSE, FALSE, NULL, error);
+ _dbus_verbose ("SELinux security check denying send to service\n");
+ }
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (bus_connection_is_active (sender))
+@@ -1547,7 +1570,7 @@ bus_context_check_security_policy (BusContext *context,
+ if (dbus_error_is_set (&error2))
+ {
+ dbus_move_error (&error2, error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+ }
+@@ -1564,7 +1587,7 @@ bus_context_check_security_policy (BusContext *context,
+ {
+ _dbus_verbose ("security check allowing %s message\n",
+ "Hello");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ else
+ {
+@@ -1575,7 +1598,7 @@ bus_context_check_security_policy (BusContext *context,
+ "Client tried to send a message other than %s without being registered",
+ "Hello");
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+ }
+@@ -1624,20 +1647,29 @@ bus_context_check_security_policy (BusContext *context,
+ (proposed_recipient == NULL && recipient_policy == NULL));
+
+ log = FALSE;
+- if (sender_policy &&
+- !bus_client_policy_check_can_send (sender_policy,
+- context->registry,
+- requested_reply,
+- proposed_recipient,
+- message, &toggles, &log))
+- {
+- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+- "Rejected send message", toggles,
+- message, sender, proposed_recipient, requested_reply,
+- (addressed_recipient == proposed_recipient), error);
+- _dbus_verbose ("security policy disallowing message due to sender policy\n");
+- return FALSE;
+- }
++ if (sender_policy)
++ {
++ BusResult res = bus_client_policy_check_can_send (sender,
++ sender_policy,
++ context->registry,
++ requested_reply,
++ addressed_recipient,
++ proposed_recipient,
++ message, &toggles, &log, &privilege,
++ deferred_message);
++ if (res == BUS_RESULT_FALSE)
++ {
++ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
++ "Rejected send message", toggles,
++ message, sender, proposed_recipient, requested_reply,
++ (addressed_recipient == proposed_recipient), privilege,
++ error);
++ _dbus_verbose ("security policy disallowing message due to sender policy\n");
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ return BUS_RESULT_LATER;
++ }
+
+ if (log)
+ {
+@@ -1646,23 +1678,29 @@ bus_context_check_security_policy (BusContext *context,
+ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+ "Would reject message", toggles,
+ message, sender, proposed_recipient, requested_reply,
+- TRUE, NULL);
++ TRUE, privilege, NULL);
+ }
+
+- if (recipient_policy &&
+- !bus_client_policy_check_can_receive (recipient_policy,
+- context->registry,
+- requested_reply,
+- sender,
+- addressed_recipient, proposed_recipient,
+- message, &toggles))
++ if (recipient_policy)
+ {
+- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+- "Rejected receive message", toggles,
+- message, sender, proposed_recipient, requested_reply,
+- (addressed_recipient == proposed_recipient), error);
+- _dbus_verbose ("security policy disallowing message due to recipient policy\n");
+- return FALSE;
++ BusResult res;
++ res = bus_client_policy_check_can_receive (recipient_policy,
++ context->registry,
++ requested_reply,
++ sender,
++ addressed_recipient, proposed_recipient,
++ message, &toggles, &privilege, deferred_message);
++ if (res == BUS_RESULT_FALSE)
++ {
++ complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected receive message",
++ toggles, message, sender, proposed_recipient, requested_reply,
++ (addressed_recipient == proposed_recipient), privilege, error);
++ _dbus_verbose(
++ "security policy disallowing message due to recipient policy\n");
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ return BUS_RESULT_LATER;
+ }
+
+ /* See if limits on size have been exceeded */
+@@ -1672,10 +1710,10 @@ bus_context_check_security_policy (BusContext *context,
+ {
+ complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
+ "Rejected: destination has a full message queue",
+- 0, message, sender, proposed_recipient, requested_reply, TRUE,
++ 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL,
+ error);
+ _dbus_verbose ("security policy disallowing message due to full message queue\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /* Record that we will allow a reply here in the future (don't
+@@ -1692,11 +1730,11 @@ bus_context_check_security_policy (BusContext *context,
+ message, error))
+ {
+ _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ _dbus_verbose ("security policy allowing message\n");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+
+ void
+diff --git a/bus/bus.h b/bus/bus.h
+index dac6ea5..78084dd 100644
+--- a/bus/bus.h
++++ b/bus/bus.h
+@@ -30,19 +30,35 @@
+ #include <dbus/dbus-pipe.h>
+ #include <dbus/dbus-sysdeps.h>
+
+-typedef struct BusActivation BusActivation;
+-typedef struct BusConnections BusConnections;
+-typedef struct BusContext BusContext;
+-typedef struct BusPolicy BusPolicy;
+-typedef struct BusClientPolicy BusClientPolicy;
+-typedef struct BusPolicyRule BusPolicyRule;
+-typedef struct BusRegistry BusRegistry;
+-typedef struct BusSELinuxID BusSELinuxID;
+-typedef struct BusService BusService;
+-typedef struct BusOwner BusOwner;
+-typedef struct BusTransaction BusTransaction;
+-typedef struct BusMatchmaker BusMatchmaker;
+-typedef struct BusMatchRule BusMatchRule;
++typedef struct BusActivation BusActivation;
++typedef struct BusConnections BusConnections;
++typedef struct BusContext BusContext;
++typedef struct BusPolicy BusPolicy;
++typedef struct BusClientPolicy BusClientPolicy;
++typedef struct BusPolicyRule BusPolicyRule;
++typedef struct BusRegistry BusRegistry;
++typedef struct BusSELinuxID BusSELinuxID;
++typedef struct BusService BusService;
++typedef struct BusOwner BusOwner;
++typedef struct BusTransaction BusTransaction;
++typedef struct BusMatchmaker BusMatchmaker;
++typedef struct BusMatchRule BusMatchRule;
++typedef struct BusCheck BusCheck;
++typedef struct BusDeferredMessage BusDeferredMessage;
++typedef struct BusCynara BusCynara;
++
++/**
++ * BusResult is defined as a pointer to a dummy structure to allow detection of type mismatches.
++ * The disadvantage of such solution is that now BusResult variables cannot be used in switch
++ * statement.
++ * Additionally, BUS_RESULT_TRUE is defined as 0 instead of 1 to help detect type mismatches
++ * at runtime.
++ */
++typedef const struct BusResultStruct { int dummy; } *BusResult;
++
++static const BusResult BUS_RESULT_TRUE = (BusResult)0x0;
++static const BusResult BUS_RESULT_FALSE = (BusResult)0x1;
++static const BusResult BUS_RESULT_LATER = (BusResult)0x2;
+
+ typedef struct
+ {
+@@ -96,6 +112,7 @@ BusConnections* bus_context_get_connections (BusContext
+ BusActivation* bus_context_get_activation (BusContext *context);
+ BusMatchmaker* bus_context_get_matchmaker (BusContext *context);
+ DBusLoop* bus_context_get_loop (BusContext *context);
++BusCheck * bus_context_get_check (BusContext *context);
+ dbus_bool_t bus_context_allow_unix_user (BusContext *context,
+ unsigned long uid);
+ dbus_bool_t bus_context_allow_windows_user (BusContext *context,
+@@ -121,13 +138,14 @@ void bus_context_log (BusContext
+ DBusSystemLogSeverity severity,
+ const char *msg,
+ ...);
+-dbus_bool_t bus_context_check_security_policy (BusContext *context,
+- BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- DBusError *error);
+ void bus_context_check_all_watches (BusContext *context);
++BusResult bus_context_check_security_policy (BusContext *context,
++ BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ DBusError *error,
++ BusDeferredMessage **deferred_message);
+
+ #endif /* BUS_BUS_H */
+diff --git a/bus/check.c b/bus/check.c
+new file mode 100644
+index 0000000..d2f418a
+--- /dev/null
++++ b/bus/check.c
+@@ -0,0 +1,215 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* check.c Bus security policy runtime check
++ *
++ * Copyright (C) 2014 Intel, Inc.
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include <config.h>
++#include "check.h"
++#include "connection.h"
++#include "dispatch.h"
++#include "cynara.h"
++#include "utils.h"
++#include <dbus/dbus-connection-internal.h>
++#include <dbus/dbus-message-internal.h>
++#include <dbus/dbus-internals.h>
++
++
++typedef struct BusCheck
++{
++ int refcount;
++
++ BusContext *context;
++ BusCynara *cynara;
++} BusCheck;
++
++typedef struct BusDeferredMessage
++{
++ int refcount;
++
++ DBusMessage *message;
++ DBusConnection *sender;
++ DBusConnection *proposed_recipient;
++ DBusConnection *addressed_recipient;
++ dbus_bool_t full_dispatch;
++ BusDeferredMessageStatus status;
++ BusResult response;
++ BusCheckResponseFunc response_callback;
++} BusDeferredMessage;
++
++BusCheck *
++bus_check_new (BusContext *context, DBusError *error)
++{
++ BusCheck *check;
++
++ check = dbus_new(BusCheck, 1);
++ if (check == NULL)
++ {
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
++ check->refcount = 1;
++ check->context = context;
++ check->cynara = bus_cynara_new(check, error);
++ if (dbus_error_is_set(error))
++ {
++ dbus_free(check);
++ return NULL;
++ }
++
++ return check;
++}
++
++BusCheck *
++bus_check_ref (BusCheck *check)
++{
++ _dbus_assert (check->refcount > 0);
++ check->refcount += 1;
++
++ return check;
++}
++
++void
++bus_check_unref (BusCheck *check)
++{
++ _dbus_assert (check->refcount > 0);
++
++ check->refcount -= 1;
++
++ if (check->refcount == 0)
++ {
++ bus_cynara_unref(check->cynara);
++ dbus_free(check);
++ }
++}
++
++BusContext *
++bus_check_get_context (BusCheck *check)
++{
++ return check->context;
++}
++
++BusCynara *
++bus_check_get_cynara (BusCheck *check)
++{
++ return check->cynara;
++}
++
++BusResult
++bus_check_privilege (BusCheck *check,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message)
++{
++ BusResult result = BUS_RESULT_FALSE;
++ BusCynara *cynara;
++ DBusConnection *connection;
++
++ connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender;
++
++ if (!dbus_connection_get_is_connected(connection))
++ {
++ return BUS_RESULT_FALSE;
++ }
++
++ /* ask policy checkers */
++#ifdef DBUS_ENABLE_CYNARA
++ cynara = bus_check_get_cynara(check);
++ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
++ proposed_recipient, privilege, check_type, deferred_message);
++#endif
++
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ {
++ (*deferred_message)->status |= check_type;
++ }
++ return result;
++}
++
++BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ BusResult response)
++{
++ BusDeferredMessage *deferred_message;
++
++ deferred_message = dbus_new(BusDeferredMessage, 1);
++ if (deferred_message == NULL)
++ {
++ return NULL;
++ }
++
++ deferred_message->refcount = 1;
++ deferred_message->sender = sender != NULL ? dbus_connection_ref(sender) : NULL;
++ deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL;
++ deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL;
++ deferred_message->message = dbus_message_ref(message);
++ deferred_message->response = response;
++ deferred_message->status = 0;
++ deferred_message->full_dispatch = FALSE;
++ deferred_message->response_callback = NULL;
++
++ return deferred_message;
++}
++
++BusDeferredMessage *
++bus_deferred_message_ref (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert (deferred_message->refcount > 0);
++ deferred_message->refcount += 1;
++ return deferred_message;
++}
++
++void
++bus_deferred_message_unref (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert (deferred_message->refcount > 0);
++
++ deferred_message->refcount -= 1;
++
++ if (deferred_message->refcount == 0)
++ {
++ dbus_message_unref(deferred_message->message);
++ if (deferred_message->sender != NULL)
++ dbus_connection_unref(deferred_message->sender);
++ if (deferred_message->addressed_recipient != NULL)
++ dbus_connection_unref(deferred_message->addressed_recipient);
++ if (deferred_message->proposed_recipient != NULL)
++ dbus_connection_unref(deferred_message->proposed_recipient);
++ dbus_free(deferred_message);
++ }
++}
++
++void
++bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ if (deferred_message->response_callback != NULL)
++ {
++ deferred_message->response_callback(deferred_message, result);
++ }
++}
+diff --git a/bus/check.h b/bus/check.h
+new file mode 100644
+index 0000000..c3fcaf9
+--- /dev/null
++++ b/bus/check.h
+@@ -0,0 +1,68 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* check.h Bus security policy runtime check
++ *
++ * Copyright (C) 2014 Intel, Inc.
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#ifndef BUS_CHECK_H
++#define BUS_CHECK_H
++
++#include "bus.h"
++#include "policy.h"
++
++
++typedef void (*BusCheckResponseFunc) (BusDeferredMessage *message,
++ BusResult result);
++
++typedef enum {
++ BUS_DEFERRED_MESSAGE_CHECK_SEND = 1 << 0,
++ BUS_DEFERRED_MESSAGE_CHECK_RECEIVE = 1 << 1,
++ BUS_DEFERRED_MESSAGE_CHECK_OWN = 1 << 2,
++} BusDeferredMessageStatus;
++
++
++BusCheck *bus_check_new (BusContext *context,
++ DBusError *error);
++BusCheck *bus_check_ref (BusCheck *check);
++void bus_check_unref (BusCheck *check);
++
++BusContext *bus_check_get_context (BusCheck *check);
++BusCynara *bus_check_get_cynara (BusCheck *check);
++BusResult bus_check_privilege (BusCheck *check,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message);
++
++BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ BusResult response);
++
++BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message);
++void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
++void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
++ BusResult result);
++#endif /* BUS_CHECK_H */
+diff --git a/bus/config-parser-common.c b/bus/config-parser-common.c
+index c522ff4..1cfe4c8 100644
+--- a/bus/config-parser-common.c
++++ b/bus/config-parser-common.c
+@@ -75,6 +75,10 @@ bus_config_parser_element_name_to_type (const char *name)
+ {
+ return ELEMENT_DENY;
+ }
++ else if (strcmp (name, "check") == 0)
++ {
++ return ELEMENT_CHECK;
++ }
+ else if (strcmp (name, "servicehelper") == 0)
+ {
+ return ELEMENT_SERVICEHELPER;
+@@ -155,6 +159,8 @@ bus_config_parser_element_type_to_name (ElementType type)
+ return "allow";
+ case ELEMENT_DENY:
+ return "deny";
++ case ELEMENT_CHECK:
++ return "check";
+ case ELEMENT_FORK:
+ return "fork";
+ case ELEMENT_PIDFILE:
+diff --git a/bus/config-parser-common.h b/bus/config-parser-common.h
+index 186bf4c..bff6fdb 100644
+--- a/bus/config-parser-common.h
++++ b/bus/config-parser-common.h
+@@ -36,6 +36,7 @@ typedef enum
+ ELEMENT_LIMIT,
+ ELEMENT_ALLOW,
+ ELEMENT_DENY,
++ ELEMENT_CHECK,
+ ELEMENT_FORK,
+ ELEMENT_PIDFILE,
+ ELEMENT_SERVICEDIR,
+diff --git a/bus/config-parser.c b/bus/config-parser.c
+index ee2d4e7..73c9e6f 100644
+--- a/bus/config-parser.c
++++ b/bus/config-parser.c
+@@ -1150,7 +1150,7 @@ append_rule_from_element (BusConfigParser *parser,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+- dbus_bool_t allow,
++ BusPolicyRuleAccess access,
+ DBusError *error)
+ {
+ const char *log;
+@@ -1173,6 +1173,7 @@ append_rule_from_element (BusConfigParser *parser,
+ const char *own_prefix;
+ const char *user;
+ const char *group;
++ const char *privilege;
+
+ BusPolicyRule *rule;
+
+@@ -1200,6 +1201,7 @@ append_rule_from_element (BusConfigParser *parser,
+ "user", &user,
+ "group", &group,
+ "log", &log,
++ "privilege", &privilege,
+ NULL))
+ return FALSE;
+
+@@ -1208,6 +1210,7 @@ append_rule_from_element (BusConfigParser *parser,
+ receive_interface || receive_member || receive_error || receive_sender ||
+ receive_type || receive_path || eavesdrop ||
+ send_requested_reply || receive_requested_reply ||
++ privilege ||
+ own || own_prefix || user || group))
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+@@ -1224,7 +1227,30 @@ append_rule_from_element (BusConfigParser *parser,
+ element_name);
+ return FALSE;
+ }
+-
++
++ if (access == BUS_POLICY_RULE_ACCESS_CHECK)
++ {
++ if (privilege == NULL || !*privilege)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED,
++ "On element <%s>, you must specify the privilege to be checked.",
++ element_name);
++ return FALSE;
++ }
++ }
++ else
++ {
++ if (privilege != NULL && *privilege)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED,
++ "On element <%s>, privilege %s is used outside of a check rule.",
++ element_name, privilege);
++ return FALSE;
++ }
++ else
++ privilege = NULL; /* replace (potentially) empty string with NULL pointer, it wouldn't be used anyway */
++ }
++
+ /* Allowed combinations of elements are:
+ *
+ * base, must be all send or all receive:
+@@ -1398,7 +1424,7 @@ append_rule_from_element (BusConfigParser *parser,
+ return FALSE;
+ }
+
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1480,7 +1506,7 @@ append_rule_from_element (BusConfigParser *parser,
+ return FALSE;
+ }
+
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1510,7 +1536,7 @@ append_rule_from_element (BusConfigParser *parser,
+ }
+ else if (own || own_prefix)
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1536,7 +1562,7 @@ append_rule_from_element (BusConfigParser *parser,
+ {
+ if (IS_WILDCARD (user))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1551,7 +1577,7 @@ append_rule_from_element (BusConfigParser *parser,
+
+ if (_dbus_parse_unix_user_from_config (&username, &uid))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1568,7 +1594,7 @@ append_rule_from_element (BusConfigParser *parser,
+ {
+ if (IS_WILDCARD (group))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1583,7 +1609,7 @@ append_rule_from_element (BusConfigParser *parser,
+
+ if (_dbus_parse_unix_group_from_config (&groupname, &gid))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1607,6 +1633,10 @@ append_rule_from_element (BusConfigParser *parser,
+ _dbus_assert (pe != NULL);
+ _dbus_assert (pe->type == ELEMENT_POLICY);
+
++ rule->privilege = _dbus_strdup (privilege);
++ if (privilege && !rule->privilege)
++ goto nomem;
++
+ switch (pe->d.policy.type)
+ {
+ case POLICY_IGNORED:
+@@ -1681,7 +1711,7 @@ start_policy_child (BusConfigParser *parser,
+ {
+ if (!append_rule_from_element (parser, element_name,
+ attribute_names, attribute_values,
+- TRUE, error))
++ BUS_POLICY_RULE_ACCESS_ALLOW, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_ALLOW) == NULL)
+@@ -1696,7 +1726,7 @@ start_policy_child (BusConfigParser *parser,
+ {
+ if (!append_rule_from_element (parser, element_name,
+ attribute_names, attribute_values,
+- FALSE, error))
++ BUS_POLICY_RULE_ACCESS_DENY, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_DENY) == NULL)
+@@ -1707,6 +1737,21 @@ start_policy_child (BusConfigParser *parser,
+
+ return TRUE;
+ }
++ else if (strcmp (element_name, "check") == 0)
++ {
++ if (!append_rule_from_element (parser, element_name,
++ attribute_names, attribute_values,
++ BUS_POLICY_RULE_ACCESS_CHECK, error))
++ return FALSE;
++
++ if (push_element (parser, ELEMENT_CHECK) == NULL)
++ {
++ BUS_SET_OOM (error);
++ return FALSE;
++ }
++
++ return TRUE;
++ }
+ else
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+@@ -2066,6 +2111,7 @@ bus_config_parser_end_element (BusConfigParser *parser,
+ case ELEMENT_POLICY:
+ case ELEMENT_ALLOW:
+ case ELEMENT_DENY:
++ case ELEMENT_CHECK:
+ case ELEMENT_FORK:
+ case ELEMENT_SYSLOG:
+ case ELEMENT_KEEP_UMASK:
+@@ -2365,6 +2411,7 @@ bus_config_parser_content (BusConfigParser *parser,
+ case ELEMENT_POLICY:
+ case ELEMENT_ALLOW:
+ case ELEMENT_DENY:
++ case ELEMENT_CHECK:
+ case ELEMENT_FORK:
+ case ELEMENT_SYSLOG:
+ case ELEMENT_KEEP_UMASK:
+@@ -2829,6 +2876,8 @@ do_load (const DBusString *full_path,
+ dbus_error_init (&error);
+
+ parser = bus_config_load (full_path, TRUE, NULL, &error);
++ if (dbus_error_is_set (&error))
++ _dbus_verbose ("Failed to load file: %s\n", error.message);
+ if (parser == NULL)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (&error);
+diff --git a/bus/connection.c b/bus/connection.c
+index 7107434..a6d87e5 100644
+--- a/bus/connection.c
++++ b/bus/connection.c
+@@ -34,6 +34,10 @@
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-timeout.h>
+ #include <dbus/dbus-connection-internal.h>
++#ifdef DBUS_ENABLE_CYNARA
++#include <stdlib.h>
++#include <cynara-session.h>
++#endif
+
+ /* Trim executed commands to this length; we want to keep logs readable */
+ #define MAX_LOG_COMMAND_LEN 50
+@@ -105,6 +109,9 @@ typedef struct
+ #endif
+ int n_pending_unix_fds;
+ DBusTimeout *pending_unix_fds_timeout;
++#ifdef DBUS_ENABLE_CYNARA
++ char *cynara_session_id;
++#endif
+ } BusConnectionData;
+
+ static dbus_bool_t bus_pending_reply_expired (BusExpireList *list,
+@@ -118,8 +125,8 @@ static dbus_bool_t expire_incomplete_timeout (void *data);
+
+ #define BUS_CONNECTION_DATA(connection) (dbus_connection_get_data ((connection), connection_data_slot))
+
+-static DBusLoop*
+-connection_get_loop (DBusConnection *connection)
++DBusLoop*
++bus_connection_get_loop (DBusConnection *connection)
+ {
+ BusConnectionData *d;
+
+@@ -331,7 +338,7 @@ add_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- return _dbus_loop_add_watch (connection_get_loop (connection), watch);
++ return _dbus_loop_add_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static void
+@@ -340,7 +347,7 @@ remove_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_remove_watch (connection_get_loop (connection), watch);
++ _dbus_loop_remove_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static void
+@@ -349,7 +356,7 @@ toggle_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_toggle_watch (connection_get_loop (connection), watch);
++ _dbus_loop_toggle_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static dbus_bool_t
+@@ -358,7 +365,7 @@ add_connection_timeout (DBusTimeout *timeout,
+ {
+ DBusConnection *connection = data;
+
+- return _dbus_loop_add_timeout (connection_get_loop (connection), timeout);
++ return _dbus_loop_add_timeout (bus_connection_get_loop (connection), timeout);
+ }
+
+ static void
+@@ -367,7 +374,7 @@ remove_connection_timeout (DBusTimeout *timeout,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_remove_timeout (connection_get_loop (connection), timeout);
++ _dbus_loop_remove_timeout (bus_connection_get_loop (connection), timeout);
+ }
+
+ static void
+@@ -425,6 +432,10 @@ free_connection_data (void *data)
+
+ dbus_free (d->name);
+
++#ifdef DBUS_ENABLE_CYNARA
++ free (d->cynara_session_id);
++#endif
++
+ dbus_free (d);
+ }
+
+@@ -984,6 +995,22 @@ bus_connection_get_policy (DBusConnection *connection)
+ return d->policy;
+ }
+
++#ifdef DBUS_ENABLE_CYNARA
++const char *bus_connection_get_cynara_session_id (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA (connection);
++ _dbus_assert (d != NULL);
++
++ if (d->cynara_session_id == NULL)
++ {
++ unsigned long pid;
++ if (dbus_connection_get_unix_process_id(connection, &pid))
++ d->cynara_session_id = cynara_session_from_pid(pid);
++ }
++ return d->cynara_session_id;
++}
++#endif
++
+ static dbus_bool_t
+ foreach_active (BusConnections *connections,
+ BusConnectionForeachFunction function,
+@@ -2104,6 +2131,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ DBusConnection *connection,
+ DBusMessage *message)
+ {
++ BusResult res;
+ /* We have to set the sender to the driver, and have
+ * to check security policy since it was not done in
+ * dispatch.c
+@@ -2132,10 +2160,18 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ /* If security policy doesn't allow the message, we silently
+ * eat it; the driver doesn't care about getting a reply.
+ */
+- if (!bus_context_check_security_policy (bus_transaction_get_context (transaction),
+- transaction,
+- NULL, connection, connection, message, NULL))
++ res = bus_context_check_security_policy (bus_transaction_get_context (transaction),
++ transaction,
++ NULL, connection, connection, message, NULL,
++ NULL);
++
++ if (res == BUS_RESULT_FALSE)
+ return TRUE;
++ else if (res == BUS_RESULT_LATER)
++ {
++ _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n");
++ return TRUE;
++ }
+
+ return bus_transaction_send (transaction, connection, message);
+ }
+diff --git a/bus/connection.h b/bus/connection.h
+index 6fbcd38..7433746 100644
+--- a/bus/connection.h
++++ b/bus/connection.h
+@@ -31,6 +31,7 @@
+ typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection,
+ void *data);
+
++DBusLoop* bus_connection_get_loop (DBusConnection *connection);
+
+ BusConnections* bus_connections_new (BusContext *context);
+ BusConnections* bus_connections_ref (BusConnections *connections);
+@@ -116,6 +117,10 @@ dbus_bool_t bus_connection_get_unix_groups (DBusConnection *connecti
+ DBusError *error);
+ BusClientPolicy* bus_connection_get_policy (DBusConnection *connection);
+
++#ifdef DBUS_ENABLE_CYNARA
++const char *bus_connection_get_cynara_session_id (DBusConnection *connection);
++#endif
++
+ /* transaction API so we can send or not send a block of messages as a whole */
+
+ typedef void (* BusTransactionCancelFunction) (void *data);
+diff --git a/bus/cynara.c b/bus/cynara.c
+new file mode 100644
+index 0000000..57a4c45
+--- /dev/null
++++ b/bus/cynara.c
+@@ -0,0 +1,374 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* cynara.c Cynara runtime privilege checking
++ *
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include <config.h>
++#include "cynara.h"
++#include "check.h"
++#include "utils.h"
++
++#include <stdio.h>
++
++#include <dbus/dbus.h>
++#include <dbus/dbus-watch.h>
++#include <dbus/dbus-connection-internal.h>
++#include <bus/connection.h>
++#ifdef DBUS_ENABLE_CYNARA
++#include <cynara-client-async.h>
++#endif
++
++
++#ifdef DBUS_ENABLE_CYNARA
++typedef struct BusCynara
++{
++ int refcount;
++
++ BusContext *context;
++ BusCheck *check;
++ cynara_async *cynara;
++ DBusWatch *cynara_watch;
++} BusCynara;
++
++#define USE_CYNARA_CACHE 1
++#ifdef USE_CYNARA_CACHE
++#define CYNARA_CACHE_SIZE 1000
++#endif
++
++static dbus_bool_t bus_cynara_watch_callback(DBusWatch *watch,
++ unsigned int flags,
++ void *data);
++
++static void status_callback(int old_fd,
++ int new_fd,
++ cynara_async_status status,
++ void *user_status_data);
++static void bus_cynara_check_response_callback (cynara_check_id check_id,
++ cynara_async_call_cause cause,
++ int response,
++ void *user_response_data);
++#endif
++
++
++BusCynara *
++bus_cynara_new(BusCheck *check, DBusError *error)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ BusContext *context;
++ BusCynara *cynara;
++ cynara_async_configuration *conf = NULL;
++ int ret;
++
++ cynara = dbus_new(BusCynara, 1);
++ if (cynara == NULL)
++ {
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
++ context = bus_check_get_context(check);
++
++ cynara->refcount = 1;
++ cynara->check = check;
++ cynara->context = context;
++ cynara->cynara_watch = NULL;
++
++ ret = cynara_async_configuration_create(&conf);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to create Cynara configuration");
++ goto out;
++ }
++
++#ifdef CYNARA_CACHE_SIZE
++ ret = cynara_async_configuration_set_cache_size(conf, CYNARA_CACHE_SIZE);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to Cynara cache size");
++ goto out;
++ }
++#endif
++
++ ret = cynara_async_initialize(&cynara->cynara, conf, &status_callback, cynara);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to initialize Cynara client");
++ goto out;
++ }
++
++out:
++ cynara_async_configuration_destroy(conf);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_free(cynara);
++ return NULL;
++ }
++
++ return cynara;
++#else
++ return NULL;
++#endif
++}
++
++BusCynara *
++bus_cynara_ref (BusCynara *cynara)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ _dbus_assert (cynara->refcount > 0);
++ cynara->refcount += 1;
++
++ return cynara;
++#else
++ return NULL;
++#endif
++}
++
++void
++bus_cynara_unref (BusCynara *cynara)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ _dbus_assert (cynara->refcount > 0);
++
++ cynara->refcount -= 1;
++
++ if (cynara->refcount == 0)
++ {
++ cynara_async_finish(cynara->cynara);
++ dbus_free(cynara);
++ }
++#endif
++}
++
++BusResult
++bus_cynara_check_privilege (BusCynara *cynara,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message_param)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ int result;
++ unsigned long uid;
++ char *label;
++ const char *session_id;
++ char user[32];
++ cynara_check_id check_id;
++ DBusConnection *connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender;
++ BusDeferredMessage *deferred_message;
++ BusResult ret;
++
++ _dbus_assert(connection != NULL);
++
++ if (dbus_connection_get_unix_user(connection, &uid) == FALSE)
++ return BUS_RESULT_FALSE;
++
++ if (_dbus_connection_get_linux_security_label(connection, &label) == FALSE || label == NULL)
++ {
++ _dbus_warn("Failed to obtain security label for connection\n");
++ return BUS_RESULT_FALSE;
++ }
++
++ session_id = bus_connection_get_cynara_session_id (connection);
++ if (session_id == NULL)
++ {
++ ret = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ snprintf(user, sizeof(user), "%lu", uid);
++
++#if USE_CYNARA_CACHE
++ result = cynara_async_check_cache(cynara->cynara, label, session_id, user, privilege);
++#else
++ result = CYNARA_API_CACHE_MISS;
++#endif
++
++ switch (result)
++ {
++ case CYNARA_API_ACCESS_ALLOWED:
++ _dbus_verbose("Cynara: got ALLOWED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n",
++ label, session_id, user, privilege);
++ ret = BUS_RESULT_TRUE;
++ break;
++
++ case CYNARA_API_ACCESS_DENIED:
++ _dbus_verbose("Cynara: got DENIED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n",
++ label, session_id, user, privilege);
++ ret = BUS_RESULT_FALSE;
++ break;
++
++ case CYNARA_API_CACHE_MISS:
++ deferred_message = bus_deferred_message_new(message, sender, addressed_recipient,
++ proposed_recipient, BUS_RESULT_LATER);
++ if (deferred_message == NULL)
++ {
++ _dbus_verbose("Failed to allocate memory for deferred message\n");
++ ret = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ /* callback is supposed to unref deferred_message*/
++ result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id,
++ &bus_cynara_check_response_callback, deferred_message);
++ if (result == CYNARA_API_SUCCESS)
++ {
++ _dbus_verbose("Created Cynara request: client=%s session_id=%s user=%s privilege=%s check_id=%u "
++ "deferred_message=%p\n", label, session_id, user, privilege, (unsigned int)check_id, deferred_message);
++ if (deferred_message_param != NULL)
++ *deferred_message_param = deferred_message;
++ ret = BUS_RESULT_LATER;
++ }
++ else
++ {
++ _dbus_verbose("Error on cynara request create: %i\n", result);
++ bus_deferred_message_unref(deferred_message);
++ ret = BUS_RESULT_FALSE;
++ }
++ break;
++ default:
++ _dbus_verbose("Error when accessing Cynara cache: %i\n", result);
++ ret = BUS_RESULT_FALSE;
++ }
++out:
++ dbus_free(label);
++ return ret;
++
++#else
++ return BUS_RESULT_FALSE;
++#endif
++}
++
++
++
++#ifdef DBUS_ENABLE_CYNARA
++static void
++status_callback(int old_fd, int new_fd, cynara_async_status status,
++ void *user_status_data)
++{
++ BusCynara *cynara = (BusCynara *)user_status_data;
++ DBusLoop *loop = bus_context_get_loop(cynara->context);
++
++ if (cynara->cynara_watch != NULL)
++ {
++ _dbus_loop_remove_watch(loop, cynara->cynara_watch);
++ _dbus_watch_invalidate(cynara->cynara_watch);
++ _dbus_watch_unref(cynara->cynara_watch);
++ cynara->cynara_watch = NULL;
++ }
++
++ if (new_fd != -1)
++ {
++ unsigned int flags;
++ DBusWatch *watch;
++
++ switch (status)
++ {
++ case CYNARA_STATUS_FOR_READ:
++ flags = DBUS_WATCH_READABLE;
++ break;
++ case CYNARA_STATUS_FOR_RW:
++ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE;
++ break;
++ default:
++ /* Cynara passed unknown status - warn and add RW watch */
++ _dbus_verbose("Cynara passed unknown status value: 0x%08X\n", (unsigned int)status);
++ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE;
++ break;
++ }
++
++ watch = _dbus_watch_new(new_fd, flags, TRUE, &bus_cynara_watch_callback, cynara, NULL);
++ if (watch != NULL)
++ {
++ if (_dbus_loop_add_watch(loop, watch) == TRUE)
++ {
++ cynara->cynara_watch = watch;
++ return;
++ }
++
++ _dbus_watch_invalidate(watch);
++ _dbus_watch_unref(watch);
++ }
++
++ /* It seems like not much can be done at this point. Cynara events won't be processed
++ * until next Cynara function call triggering status callback */
++ _dbus_verbose("Failed to add dbus watch\n");
++ }
++}
++
++static dbus_bool_t
++bus_cynara_watch_callback(DBusWatch *watch,
++ unsigned int flags,
++ void *data)
++{
++ BusCynara *cynara = (BusCynara *)data;
++ int result = cynara_async_process(cynara->cynara);
++ if (result != CYNARA_API_SUCCESS)
++ _dbus_verbose("cynara_async_process returned %d\n", result);
++
++ return result != CYNARA_API_OUT_OF_MEMORY ? TRUE : FALSE;
++}
++
++static inline const char *
++call_cause_to_string(cynara_async_call_cause cause)
++{
++ switch (cause)
++ {
++ case CYNARA_CALL_CAUSE_ANSWER:
++ return "ANSWER";
++ case CYNARA_CALL_CAUSE_CANCEL:
++ return "CANCEL";
++ case CYNARA_CALL_CAUSE_FINISH:
++ return "FINSIH";
++ case CYNARA_CALL_CAUSE_SERVICE_NOT_AVAILABLE:
++ return "SERVICE NOT AVAILABLE";
++ default:
++ return "INVALID";
++ }
++}
++
++static void
++bus_cynara_check_response_callback (cynara_check_id check_id,
++ cynara_async_call_cause cause,
++ int response,
++ void *user_response_data)
++{
++ BusDeferredMessage *deferred_message = user_response_data;
++ BusResult result;
++
++ _dbus_verbose("Cynara callback: check_id=%u, cause=%s response=%i response_data=%p\n",
++ (unsigned int)check_id, call_cause_to_string(cause), response, user_response_data);
++
++ if (deferred_message == NULL)
++ return;
++
++ if (cause == CYNARA_CALL_CAUSE_ANSWER && response == CYNARA_API_ACCESS_ALLOWED)
++ result = BUS_RESULT_TRUE;
++ else
++ result = BUS_RESULT_FALSE;
++
++ bus_deferred_message_response_received(deferred_message, result);
++ bus_deferred_message_unref(deferred_message);
++}
++
++#endif /* DBUS_ENABLE_CYNARA */
+diff --git a/bus/cynara.h b/bus/cynara.h
+new file mode 100644
+index 0000000..c4728bb
+--- /dev/null
++++ b/bus/cynara.h
+@@ -0,0 +1,37 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* cynara.h Cynara runtime privilege checking
++ *
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include "bus.h"
++#include "check.h"
++
++BusCynara *bus_cynara_new (BusCheck *check, DBusError *error);
++BusCynara *bus_cynara_ref (BusCynara *cynara);
++void bus_cynara_unref (BusCynara *cynara);
++BusResult bus_cynara_check_privilege (BusCynara *cynara,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message);
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index 7a61953..ce4076d 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -25,6 +25,7 @@
+
+ #include <config.h>
+ #include "dispatch.h"
++#include "check.h"
+ #include "connection.h"
+ #include "driver.h"
+ #include "services.h"
+@@ -56,13 +57,14 @@ send_one_message (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusError *error)
+ {
+- if (!bus_context_check_security_policy (context, transaction,
+- sender,
+- addressed_recipient,
+- connection,
+- message,
+- NULL))
+- return TRUE; /* silently don't send it */
++ BusDeferredMessage *deferred_message;
++ BusResult result;
++
++ result = bus_context_check_security_policy (context, transaction, sender, addressed_recipient,
++ connection, message, NULL, &deferred_message);
++
++ if (result != BUS_RESULT_TRUE)
++ return TRUE; /* silently don't send it */
+
+ if (dbus_message_contains_unix_fds(message) &&
+ !dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
+@@ -92,6 +94,7 @@ bus_dispatch_matches (BusTransaction *transaction,
+ BusMatchmaker *matchmaker;
+ DBusList *link;
+ BusContext *context;
++ BusDeferredMessage *deferred_message;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+@@ -107,11 +110,21 @@ bus_dispatch_matches (BusTransaction *transaction,
+ /* First, send the message to the addressed_recipient, if there is one. */
+ if (addressed_recipient != NULL)
+ {
+- if (!bus_context_check_security_policy (context, transaction,
+- sender, addressed_recipient,
+- addressed_recipient,
+- message, error))
++ BusResult res;
++ res = bus_context_check_security_policy (context, transaction,
++ sender, addressed_recipient,
++ addressed_recipient,
++ message, error,
++ &deferred_message);
++ if (res == BUS_RESULT_FALSE)
+ return FALSE;
++ else if (res == BUS_RESULT_LATER)
++ {
++ dbus_set_error (error,
++ DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ return FALSE;
++ }
+
+ if (dbus_message_contains_unix_fds (message) &&
+ !dbus_connection_can_send_type (addressed_recipient,
+@@ -273,12 +286,24 @@ bus_dispatch (DBusConnection *connection,
+ if (service_name &&
+ strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */
+ {
+- if (!bus_context_check_security_policy (context, transaction,
+- connection, NULL, NULL, message, &error))
++ BusDeferredMessage *deferred_message;
++ BusResult res;
++ res = bus_context_check_security_policy (context, transaction,
++ connection, NULL, NULL, message, &error,
++ &deferred_message);
++ if (res == BUS_RESULT_FALSE)
+ {
+ _dbus_verbose ("Security policy rejected message\n");
+ goto out;
+ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ dbus_set_error (&error,
++ DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ _dbus_verbose ("Security policy needs time to check policy. Dropping message\n");
++ goto out;
++ }
+
+ _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
+ if (!bus_driver_handle_message (connection, transaction, message, &error))
+diff --git a/bus/policy.c b/bus/policy.c
+index 082f385..ec888df 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -22,6 +22,7 @@
+ */
+
+ #include <config.h>
++#include "check.h"
+ #include "policy.h"
+ #include "services.h"
+ #include "test.h"
+@@ -32,7 +33,7 @@
+
+ BusPolicyRule*
+ bus_policy_rule_new (BusPolicyRuleType type,
+- dbus_bool_t allow)
++ BusPolicyRuleAccess access)
+ {
+ BusPolicyRule *rule;
+
+@@ -42,7 +43,7 @@ bus_policy_rule_new (BusPolicyRuleType type,
+
+ rule->type = type;
+ rule->refcount = 1;
+- rule->allow = allow;
++ rule->access = access;
+
+ switch (rule->type)
+ {
+@@ -54,18 +55,19 @@ bus_policy_rule_new (BusPolicyRuleType type,
+ break;
+ case BUS_POLICY_RULE_SEND:
+ rule->d.send.message_type = DBUS_MESSAGE_TYPE_INVALID;
+-
+ /* allow rules default to TRUE (only requested replies allowed)
++ * check rules default to TRUE (only requested replies are checked)
+ * deny rules default to FALSE (only unrequested replies denied)
+ */
+- rule->d.send.requested_reply = rule->allow;
++ rule->d.send.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY;
+ break;
+ case BUS_POLICY_RULE_RECEIVE:
+ rule->d.receive.message_type = DBUS_MESSAGE_TYPE_INVALID;
+ /* allow rules default to TRUE (only requested replies allowed)
++ * check rules default to TRUE (only requested replies are checked)
+ * deny rules default to FALSE (only unrequested replies denied)
+ */
+- rule->d.receive.requested_reply = rule->allow;
++ rule->d.receive.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY;
+ break;
+ case BUS_POLICY_RULE_OWN:
+ break;
+@@ -117,7 +119,8 @@ bus_policy_rule_unref (BusPolicyRule *rule)
+ case BUS_POLICY_RULE_GROUP:
+ break;
+ }
+-
++
++ dbus_free (rule->privilege);
+ dbus_free (rule);
+ }
+ }
+@@ -427,7 +430,10 @@ list_allows_user (dbus_bool_t def,
+ else
+ continue;
+
+- allowed = rule->allow;
++ /* We don't intend to support <check user="..." /> and <check group="..." />
++ rules. They are treated like deny.
++ */
++ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
+ }
+
+ return allowed;
+@@ -862,18 +868,23 @@ bus_client_policy_append_rule (BusClientPolicy *policy,
+ return TRUE;
+ }
+
+-dbus_bool_t
+-bus_client_policy_check_can_send (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *receiver,
+- DBusMessage *message,
+- dbus_int32_t *toggles,
+- dbus_bool_t *log)
++BusResult
++bus_client_policy_check_can_send (DBusConnection *sender,
++ BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *addressed_recipient,
++ DBusConnection *receiver,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ dbus_bool_t *log,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
+-
++ BusResult result;
++ const char *privilege;
++
+ /* policy->rules is in the order the rules appeared
+ * in the config file, i.e. last rule that applies wins
+ */
+@@ -881,7 +892,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ _dbus_verbose (" (policy) checking send rules\n");
+ *toggles = 0;
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&policy->rules);
+ while (link != NULL)
+ {
+@@ -912,13 +923,14 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ /* If it's a reply, the requested_reply flag kicks in */
+ if (dbus_message_get_reply_serial (message) != 0)
+ {
+- /* for allow, requested_reply=true means the rule applies
+- * only when reply was requested. requested_reply=false means
+- * always allow.
++ /* for allow or check requested_reply=true means the rule applies
++ * only when reply was requested. requested_reply=false means the
++ * rule always applies
+ */
+- if (!requested_reply && rule->allow && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
++ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check");
+ continue;
+ }
+
+@@ -926,7 +938,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ * when the reply was not requested. requested_reply=true means the
+ * rule always applies.
+ */
+- if (requested_reply && !rule->allow && !rule->d.send.requested_reply)
++ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.send.requested_reply)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n");
+ continue;
+@@ -949,13 +961,15 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ /* The interface is optional in messages. For allow rules, if the message
+ * has no interface we want to skip the rule (and thus not allow);
+ * for deny rules, if the message has no interface we want to use the
+- * rule (and thus deny).
++ * rule (and thus deny). Check rules are meant to be used like allow
++ * rules (they can grant access, but not remove it), so we treat it like
++ * allow here.
+ */
+ dbus_bool_t no_interface;
+
+ no_interface = dbus_message_get_interface (message) == NULL;
+
+- if ((no_interface && rule->allow) ||
++ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) ||
+ (!no_interface &&
+ strcmp (dbus_message_get_interface (message),
+ rule->d.send.interface) != 0))
+@@ -1029,33 +1043,63 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
++
+ *log = rule->d.send.log;
+ (*toggles)++;
+
+- _dbus_verbose (" (policy) used rule, allow now = %d\n",
+- allowed);
++ _dbus_verbose (" (policy) used rule, result now = %d\n",
++ result);
+ }
+
+- return allowed;
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(sender);
++ BusCheck *check = bus_context_get_check(context);
++
++ result = bus_check_privilege(check, message, sender, addressed_recipient, receiver,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message);
++ }
++ else
++ privilege = NULL;
++
++ if (privilege_param != NULL)
++ *privilege_param = privilege;
++
++ return result;
+ }
+
+ /* See docs on what the args mean on bus_context_check_security_policy()
+ * comment
+ */
+-dbus_bool_t
+-bus_client_policy_check_can_receive (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- dbus_int32_t *toggles)
++BusResult
++bus_client_policy_check_can_receive (BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
+ dbus_bool_t eavesdropping;
++ BusResult result;
++ const char *privilege;
+
+ eavesdropping =
+ addressed_recipient != proposed_recipient &&
+@@ -1068,7 +1112,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ _dbus_verbose (" (policy) checking receive rules, eavesdropping = %d\n", eavesdropping);
+ *toggles = 0;
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&policy->rules);
+ while (link != NULL)
+ {
+@@ -1091,19 +1135,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ }
+ }
+
+- /* for allow, eavesdrop=false means the rule doesn't apply when
+- * eavesdropping. eavesdrop=true means always allow.
++
++ /* for allow or check, eavesdrop=false means the rule doesn't apply when
++ * eavesdropping. eavesdrop=true means the rule always applies
+ */
+- if (eavesdropping && rule->allow && !rule->d.receive.eavesdrop)
++ if (eavesdropping && rule->access != BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it doesn't apply to eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it doesn't apply to eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check");
+ continue;
+ }
+
+ /* for deny, eavesdrop=true means the rule applies only when
+ * eavesdropping; eavesdrop=false means always deny.
+ */
+- if (!eavesdropping && !rule->allow && rule->d.receive.eavesdrop)
++ if (!eavesdropping && rule->access == BUS_POLICY_RULE_ACCESS_DENY && rule->d.receive.eavesdrop)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to eavesdropping\n");
+ continue;
+@@ -1112,13 +1158,14 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ /* If it's a reply, the requested_reply flag kicks in */
+ if (dbus_message_get_reply_serial (message) != 0)
+ {
+- /* for allow, requested_reply=true means the rule applies
+- * only when reply was requested. requested_reply=false means
+- * always allow.
++ /* for allow or check requested_reply=true means the rule applies
++ * only when reply was requested. requested_reply=false means the
++ * rule always applies
+ */
+- if (!requested_reply && rule->allow && rule->d.receive.requested_reply && !rule->d.receive.eavesdrop)
++ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_DENY ? "allow" : "deny");
+ continue;
+ }
+
+@@ -1126,7 +1173,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ * when the reply was not requested. requested_reply=true means the
+ * rule always applies.
+ */
+- if (requested_reply && !rule->allow && !rule->d.receive.requested_reply)
++ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.requested_reply)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n");
+ continue;
+@@ -1149,13 +1196,13 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ /* The interface is optional in messages. For allow rules, if the message
+ * has no interface we want to skip the rule (and thus not allow);
+ * for deny rules, if the message has no interface we want to use the
+- * rule (and thus deny).
++ * rule (and thus deny). Check rules are treated like allow rules.
+ */
+ dbus_bool_t no_interface;
+
+ no_interface = dbus_message_get_interface (message) == NULL;
+
+- if ((no_interface && rule->allow) ||
++ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) ||
+ (!no_interface &&
+ strcmp (dbus_message_get_interface (message),
+ rule->d.receive.interface) != 0))
+@@ -1230,14 +1277,42 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
++
+ (*toggles)++;
+
+- _dbus_verbose (" (policy) used rule, allow now = %d\n",
+- allowed);
++ _dbus_verbose (" (policy) used rule, result now = %d\n",
++ result);
+ }
+
+- return allowed;
++
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(proposed_recipient);
++ BusCheck *check = bus_context_get_check(context);
++
++ result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message);
++ }
++ else
++ privilege = NULL;
++
++ if (privilege_param != NULL)
++ *privilege_param = privilege;
++
++ return result;
+ }
+
+
+@@ -1289,7 +1364,7 @@ bus_rules_check_can_own (DBusList *rules,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
+ }
+
+ return allowed;
+diff --git a/bus/policy.h b/bus/policy.h
+index d1d3e72..e9f193a 100644
+--- a/bus/policy.h
++++ b/bus/policy.h
+@@ -39,6 +39,14 @@ typedef enum
+ BUS_POLICY_RULE_GROUP
+ } BusPolicyRuleType;
+
++typedef enum
++{
++ BUS_POLICY_RULE_ACCESS_DENY,
++ BUS_POLICY_RULE_ACCESS_ALLOW,
++ /** runtime check resulting in allow or deny */
++ BUS_POLICY_RULE_ACCESS_CHECK
++} BusPolicyRuleAccess;
++
+ /** determines whether the rule affects a connection, or some global item */
+ #define BUS_POLICY_RULE_IS_PER_CLIENT(rule) (!((rule)->type == BUS_POLICY_RULE_USER || \
+ (rule)->type == BUS_POLICY_RULE_GROUP))
+@@ -49,8 +57,9 @@ struct BusPolicyRule
+
+ BusPolicyRuleType type;
+
+- unsigned int allow : 1; /**< #TRUE if this allows, #FALSE if it denies */
+-
++ unsigned int access : 2; /**< BusPolicyRuleAccess */
++ char *privilege; /**< for BUS_POLICY_RULE_ACCESS_CHECK */
++
+ union
+ {
+ struct
+@@ -106,7 +115,7 @@ struct BusPolicyRule
+ };
+
+ BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type,
+- dbus_bool_t allow);
++ BusPolicyRuleAccess access);
+ BusPolicyRule* bus_policy_rule_ref (BusPolicyRule *rule);
+ void bus_policy_rule_unref (BusPolicyRule *rule);
+
+@@ -140,21 +149,27 @@ dbus_bool_t bus_policy_merge (BusPolicy *policy,
+ BusClientPolicy* bus_client_policy_new (void);
+ BusClientPolicy* bus_client_policy_ref (BusClientPolicy *policy);
+ void bus_client_policy_unref (BusClientPolicy *policy);
+-dbus_bool_t bus_client_policy_check_can_send (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *receiver,
+- DBusMessage *message,
+- dbus_int32_t *toggles,
+- dbus_bool_t *log);
+-dbus_bool_t bus_client_policy_check_can_receive (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- dbus_int32_t *toggles);
++BusResult bus_client_policy_check_can_send (DBusConnection *sender,
++ BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *addressed_recipient,
++ DBusConnection *receiver,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ dbus_bool_t *log,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message);
++BusResult bus_client_policy_check_can_receive (BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message);
+ dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy,
+ const DBusString *service_name);
+ dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy,
+diff --git a/configure.ac b/configure.ac
+index eb803af..b131f30 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1748,6 +1748,18 @@ if test "x$enable_stats" = xyes; then
+ [Define to enable bus daemon usage statistics])
+ fi
+
++#enable cynara integration
++AC_ARG_ENABLE([cynara], [AS_HELP_STRING([--enable-cynara], [enable Cynara integration])], [], [enable_cynara=no])
++if test "x$enable_cynara" = xyes; then
++ PKG_CHECK_MODULES([CYNARA], [cynara-client-async >= 0.6.0 cynara-session >= 0.6.0],
++ [AC_DEFINE([DBUS_ENABLE_CYNARA], [1], [Define to enable Cynara privilege checks in dbus-daemon])],
++ [AC_MSG_ERROR([libcynara-client-async and cynara-session are required to enable Cynara integration])])
++fi
++
++AC_SUBST([CYNARA_CFLAGS])
++AC_SUBST([CYNARA_LIBS])
++
++
+ AC_CONFIG_FILES([
+ Doxyfile
+ dbus/versioninfo.rc
+@@ -1778,6 +1790,7 @@ dbus-1.pc
+ dbus-1-uninstalled.pc
+ test/data/valid-config-files/debug-allow-all.conf
+ test/data/valid-config-files/debug-allow-all-sha1.conf
++test/data/valid-config-files/debug-check-some.conf
+ test/data/valid-config-files/incoming-limit.conf
+ test/data/valid-config-files-system/debug-allow-all-pass.conf
+ test/data/valid-config-files-system/debug-allow-all-fail.conf
+diff --git a/test/Makefile.am b/test/Makefile.am
+index e0ed3c8..ab63edc 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -254,6 +254,7 @@ in_data = \
+ data/valid-config-files-system/debug-allow-all-pass.conf.in \
+ data/valid-config-files/debug-allow-all-sha1.conf.in \
+ data/valid-config-files/debug-allow-all.conf.in \
++ data/valid-config-files/debug-check-some.conf.in \
+ data/valid-config-files/incoming-limit.conf.in \
+ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \
+ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \
+diff --git a/test/data/invalid-config-files/badcheck-1.conf b/test/data/invalid-config-files/badcheck-1.conf
+new file mode 100644
+index 0000000..fad9f50
+--- /dev/null
++++ b/test/data/invalid-config-files/badcheck-1.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <allow privilege="foo" send_destination="*"/> <!-- extra privilege="foo" -->
++ </policy>
++</busconfig>
+diff --git a/test/data/invalid-config-files/badcheck-2.conf b/test/data/invalid-config-files/badcheck-2.conf
+new file mode 100644
+index 0000000..63c7ef2
+--- /dev/null
++++ b/test/data/invalid-config-files/badcheck-2.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <check send_destination="*"/> <!-- missing privilege="foo" -->
++ </policy>
++</busconfig>
+diff --git a/test/data/valid-config-files/check-1.conf b/test/data/valid-config-files/check-1.conf
+new file mode 100644
+index 0000000..ad71473
+--- /dev/null
++++ b/test/data/valid-config-files/check-1.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <check privilege="foo" send_destination="*"/>
++ </policy>
++</busconfig>
+diff --git a/test/data/valid-config-files/debug-check-some.conf.in b/test/data/valid-config-files/debug-check-some.conf.in
+new file mode 100644
+index 0000000..47ee854
+--- /dev/null
++++ b/test/data/valid-config-files/debug-check-some.conf.in
+@@ -0,0 +1,18 @@
++<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
++
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <listen>debug-pipe:name=test-server</listen>
++ <listen>@TEST_LISTEN@</listen>
++ <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
++ <policy context="default">
++ <allow send_interface="*"/>
++ <allow receive_interface="*"/>
++ <allow own="*"/>
++ <allow user="*"/>
++
++ <deny send_interface="org.freedesktop.TestSuite" send_member="Echo"/>
++ <check privilege="foo" send_interface="org.freedesktop.TestSuite" send_member="Echo"/>
++ </policy>
++</busconfig>
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0005-Disable-message-dispatching-when-send-rule-result-is.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0005-Disable-message-dispatching-when-send-rule-result-is.patch
new file mode 100644
index 000000000..ca787149e
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0005-Disable-message-dispatching-when-send-rule-result-is.patch
@@ -0,0 +1,941 @@
+From b1b87ad9f20b2052c28431b48e81073078a745ce Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Fri, 28 Nov 2014 12:07:39 +0100
+Subject: [PATCH 5/8] Disable message dispatching when send rule result is not
+ known
+
+When unicast message is sent to addressed recipient and policy result
+is not available message dispatch from the sender is disabled.
+This also means that any further messages from the given connection are
+put into the incoming queue without being processed. If response is received
+message dispatching is resumed. This time answer is attached to the message
+which is now processed synchronously.
+Receive rule result unavailability is not yet handled - such messages are
+rejected. Also, if message is sent to non-addressed recipient and policy result
+is unknown, message is silently dropped.
+
+Change-Id: I57eccbf973525fd51369c7d4e58908292f44da80
+---
+ bus/activation.c | 79 +++++++++++++++--
+ bus/check.c | 109 ++++++++++++++++++++++--
+ bus/check.h | 10 +++
+ bus/cynara.c | 1 -
+ bus/dispatch.c | 183 ++++++++++++++++++++++++++++++++++++----
+ bus/dispatch.h | 2 +-
+ bus/driver.c | 13 ++-
+ dbus/dbus-connection-internal.h | 9 ++
+ dbus/dbus-connection.c | 125 +++++++++++++++++++++++++--
+ dbus/dbus-list.c | 29 +++++++
+ dbus/dbus-list.h | 2 +
+ dbus/dbus-shared.h | 3 +-
+ 12 files changed, 522 insertions(+), 43 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index ecd19bb..8c43941 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -31,6 +31,7 @@
+ #include "services.h"
+ #include "test.h"
+ #include "utils.h"
++#include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-internals.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-list.h>
+@@ -91,6 +92,8 @@ struct BusPendingActivationEntry
+ DBusConnection *connection;
+
+ dbus_bool_t auto_activation;
++
++ dbus_bool_t is_put_back;
+ };
+
+ typedef struct
+@@ -1180,20 +1183,23 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ BusPendingActivationEntry *entry = link->data;
+ DBusList *next = _dbus_list_get_next_link (&pending_activation->entries, link);
+
+- if (entry->auto_activation && (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection)))
++ if (entry->auto_activation && !entry->is_put_back &&
++ (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection)))
+ {
+ DBusConnection *addressed_recipient;
+ DBusError error;
++ BusResult res;
+
+ dbus_error_init (&error);
+
+ addressed_recipient = bus_service_get_primary_owners_connection (service);
+
+ /* Resume dispatching where we left off in bus_dispatch() */
+- if (!bus_dispatch_matches (transaction,
+- entry->connection,
+- addressed_recipient,
+- entry->activation_message, &error))
++ res = bus_dispatch_matches (transaction,
++ entry->connection,
++ addressed_recipient,
++ entry->activation_message, &error);
++ if (res == BUS_RESULT_FALSE)
+ {
+ /* If permission is denied, we just want to return the error
+ * to the original method invoker; in particular, we don't
+@@ -1205,9 +1211,40 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ bus_connection_send_oom_error (entry->connection,
+ entry->activation_message);
+ }
++ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ DBusList *putback_message_link = link;
++ DBusMessage *last_inserted_message = NULL;
++
++ /* NULL entry->connection implies sending pending ActivationRequest message to systemd */
++ if (entry->connection == NULL)
++ {
++ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly when sender is NULL");
++ link = next;
++ continue;
++ }
+
+- link = next;
+- continue;
++ /**
++ * Getting here means that policy check result is not yet available and dispatching
++ * messages from entry->connection has been disabled.
++ * Let's put back all messages for the given connection in the incoming queue and mark
++ * this entry as put back so they are not handled twice.
++ */
++ while (putback_message_link != NULL)
++ {
++ BusPendingActivationEntry *putback_message = putback_message_link->data;
++ if (putback_message->connection == entry->connection)
++ {
++ if (!_dbus_connection_putback_message (putback_message->connection, last_inserted_message,
++ putback_message->activation_message, &error))
++ goto error;
++ last_inserted_message = putback_message->activation_message;
++ putback_message->is_put_back = TRUE;
++ }
++
++ putback_message_link = _dbus_list_get_next_link(&pending_activation->entries, putback_message_link);
++ }
+ }
+ }
+
+@@ -1225,6 +1262,19 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ return TRUE;
+
+ error:
++ /* remove all messages that have been put to connections' incoming queues */
++ link = _dbus_list_get_first_link (&pending_activation->entries);
++ while (link != NULL)
++ {
++ BusPendingActivationEntry *entry = link->data;
++ if (entry->is_put_back)
++ {
++ _dbus_connection_remove_message(entry->connection, entry->activation_message);
++ entry->is_put_back = FALSE;
++ }
++ link = _dbus_list_get_next_link(&pending_activation->entries, link);
++ }
++
+ return FALSE;
+ }
+
+@@ -2009,13 +2059,24 @@ bus_activation_activate_service (BusActivation *activation,
+
+ if (service != NULL)
+ {
++ BusResult res;
+ bus_context_log (activation->context,
+ DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s'",
+ service_name,
+ entry->systemd_service);
+ /* Wonderful, systemd is connected, let's just send the msg */
+- retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
+- message, error);
++ res = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
++ message, error);
++
++ if (res == BUS_RESULT_TRUE)
++ retval = TRUE;
++ else if (res == BUS_RESULT_FALSE)
++ retval = FALSE;
++ else if (res == BUS_RESULT_LATER)
++ {
++ _dbus_verbose("Unexpectedly need time to check message from bus driver to systemd - dropping the message.\n");
++ retval = FALSE;
++ }
+ }
+ else
+ {
+diff --git a/bus/check.c b/bus/check.c
+index d2f418a..cd6a74b 100644
+--- a/bus/check.c
++++ b/bus/check.c
+@@ -55,6 +55,8 @@ typedef struct BusDeferredMessage
+ BusCheckResponseFunc response_callback;
+ } BusDeferredMessage;
+
++static dbus_int32_t deferred_message_data_slot = -1;
++
+ BusCheck *
+ bus_check_new (BusContext *context, DBusError *error)
+ {
+@@ -67,11 +69,19 @@ bus_check_new (BusContext *context, DBusError *error)
+ return NULL;
+ }
+
++ if (!dbus_message_allocate_data_slot(&deferred_message_data_slot))
++ {
++ dbus_free(check);
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
+ check->refcount = 1;
+ check->context = context;
+ check->cynara = bus_cynara_new(check, error);
+ if (dbus_error_is_set(error))
+ {
++ dbus_message_free_data_slot(&deferred_message_data_slot);
+ dbus_free(check);
+ return NULL;
+ }
+@@ -98,6 +108,7 @@ bus_check_unref (BusCheck *check)
+ if (check->refcount == 0)
+ {
+ bus_cynara_unref(check->cynara);
++ dbus_message_free_data_slot(&deferred_message_data_slot);
+ dbus_free(check);
+ }
+ }
+@@ -114,6 +125,45 @@ bus_check_get_cynara (BusCheck *check)
+ return check->cynara;
+ }
+
++static void
++bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ _dbus_verbose("bus_check_enable_dispatch_callback called deferred_message=%p\n", deferred_message);
++
++ deferred_message->response = result;
++ _dbus_connection_enable_dispatch(deferred_message->sender);
++}
++
++static void
++deferred_message_free_function(void *data)
++{
++ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data;
++ bus_deferred_message_unref(deferred_message);
++}
++
++void
++bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert(deferred_message != NULL);
++ _dbus_assert(deferred_message->sender != NULL);
++
++ if (dbus_message_get_data(deferred_message->message, deferred_message_data_slot) == NULL)
++ {
++ if (dbus_message_set_data(deferred_message->message, deferred_message_data_slot, deferred_message,
++ deferred_message_free_function))
++ bus_deferred_message_ref(deferred_message);
++ }
++
++ _dbus_connection_disable_dispatch(deferred_message->sender);
++ deferred_message->response_callback = bus_check_enable_dispatch_callback;
++}
++
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++dbus_bool_t (*bus_check_test_override) (DBusConnection *connection,
++ const char *privilege);
++#endif
++
+ BusResult
+ bus_check_privilege (BusCheck *check,
+ DBusMessage *message,
+@@ -124,6 +174,7 @@ bus_check_privilege (BusCheck *check,
+ BusDeferredMessageStatus check_type,
+ BusDeferredMessage **deferred_message)
+ {
++ BusDeferredMessage *previous_deferred_message;
+ BusResult result = BUS_RESULT_FALSE;
+ BusCynara *cynara;
+ DBusConnection *connection;
+@@ -135,16 +186,54 @@ bus_check_privilege (BusCheck *check,
+ return BUS_RESULT_FALSE;
+ }
+
+- /* ask policy checkers */
+-#ifdef DBUS_ENABLE_CYNARA
+- cynara = bus_check_get_cynara(check);
+- result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
+- proposed_recipient, privilege, check_type, deferred_message);
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++ if (bus_check_test_override)
++ return bus_check_test_override (connection, privilege);
+ #endif
+
+- if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ previous_deferred_message = dbus_message_get_data(message, deferred_message_data_slot);
++ /* check if message blocked at sender's queue is being processed */
++ if (previous_deferred_message != NULL)
++ {
++ if ((check_type & BUS_DEFERRED_MESSAGE_CHECK_SEND) &&
++ !(previous_deferred_message->status & BUS_DEFERRED_MESSAGE_CHECK_SEND))
++ {
++ /**
++ * Message has been deferred due to receive or own rule which means that sending this message
++ * is allowed - it must have been checked previously.
++ * This might happen when client calls RequestName method which depending on security
++ * policy might result in both "can_send" and "can_own" Cynara checks.
++ */
++ result = BUS_RESULT_TRUE;
++ }
++ else
++ {
++ result = previous_deferred_message->response;
++ if (result == BUS_RESULT_LATER)
++ {
++ /* result is still not known - reuse deferred message object */
++ if (deferred_message != NULL)
++ *deferred_message = previous_deferred_message;
++ }
++ else
++ {
++ /* result is available - we can remove deferred message from the processed message */
++ dbus_message_set_data(message, deferred_message_data_slot, NULL, NULL);
++ }
++ }
++ }
++ else
+ {
+- (*deferred_message)->status |= check_type;
++ /* ask policy checkers */
++#ifdef DBUS_ENABLE_CYNARA
++ cynara = bus_check_get_cynara(check);
++ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
++ proposed_recipient, privilege, check_type, deferred_message);
++#endif
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ {
++ (*deferred_message)->status |= check_type;
++ }
+ }
+ return result;
+ }
+@@ -204,6 +293,12 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message)
+ }
+ }
+
++BusDeferredMessageStatus
++bus_deferred_message_get_status (BusDeferredMessage *deferred_message)
++{
++ return deferred_message->status;
++}
++
+ void
+ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result)
+diff --git a/bus/check.h b/bus/check.h
+index c3fcaf9..f381789 100644
+--- a/bus/check.h
++++ b/bus/check.h
+@@ -55,6 +55,7 @@ BusResult bus_check_privilege (BusCheck *check,
+ BusDeferredMessageStatus check_type,
+ BusDeferredMessage **deferred_message);
+
++
+ BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
+ DBusConnection *sender,
+ DBusConnection *addressed_recipient,
+@@ -65,4 +66,13 @@ BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage
+ void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result);
++void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message);
++
++BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message);
++
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++extern dbus_bool_t (*bus_check_test_override) (DBusConnection *connection,
++ const char *privilege);
++#endif
++
+ #endif /* BUS_CHECK_H */
+diff --git a/bus/cynara.c b/bus/cynara.c
+index 57a4c45..77aed62 100644
+--- a/bus/cynara.c
++++ b/bus/cynara.c
+@@ -36,7 +36,6 @@
+ #include <cynara-client-async.h>
+ #endif
+
+-
+ #ifdef DBUS_ENABLE_CYNARA
+ typedef struct BusCynara
+ {
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index ce4076d..6b0eadc 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -81,7 +81,7 @@ send_one_message (DBusConnection *connection,
+ return TRUE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_dispatch_matches (BusTransaction *transaction,
+ DBusConnection *sender,
+ DBusConnection *addressed_recipient,
+@@ -117,13 +117,29 @@ bus_dispatch_matches (BusTransaction *transaction,
+ message, error,
+ &deferred_message);
+ if (res == BUS_RESULT_FALSE)
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ else if (res == BUS_RESULT_LATER)
+ {
+- dbus_set_error (error,
+- DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- return FALSE;
++ BusDeferredMessageStatus status;
++ status = bus_deferred_message_get_status(deferred_message);
++
++ if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND)
++ {
++ /* send rule result not available - disable dispatching messages from the sender */
++ bus_deferred_message_disable_sender(deferred_message);
++ return BUS_RESULT_LATER;
++ }
++ else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE)
++ {
++ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ return BUS_RESULT_FALSE;
++ }
++ else
++ {
++ _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n");
++ return BUS_RESULT_FALSE;
++ }
+ }
+
+ if (dbus_message_contains_unix_fds (message) &&
+@@ -134,14 +150,14 @@ bus_dispatch_matches (BusTransaction *transaction,
+ DBUS_ERROR_NOT_SUPPORTED,
+ "Tried to send message with Unix file descriptors"
+ "to a client that doesn't support that.");
+- return FALSE;
+- }
++ return BUS_RESULT_FALSE;
++ }
+
+ /* Dispatch the message */
+ if (!bus_transaction_send (transaction, addressed_recipient, message))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -156,7 +172,7 @@ bus_dispatch_matches (BusTransaction *transaction,
+ &recipients))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ link = _dbus_list_get_first_link (&recipients);
+@@ -178,10 +194,10 @@ bus_dispatch_matches (BusTransaction *transaction,
+ if (dbus_error_is_set (&tmp_error))
+ {
+ dbus_move_error (&tmp_error, error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+
+ static DBusHandlerResult
+@@ -298,10 +314,12 @@ bus_dispatch (DBusConnection *connection,
+ }
+ else if (res == BUS_RESULT_LATER)
+ {
+- dbus_set_error (&error,
+- DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- _dbus_verbose ("Security policy needs time to check policy. Dropping message\n");
++ /* Disable dispatching messages from the sender,
++ * roll back and dispatch the message once the policy result is available */
++ bus_deferred_message_disable_sender(deferred_message);
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
+ goto out;
+ }
+
+@@ -366,8 +384,14 @@ bus_dispatch (DBusConnection *connection,
+ * addressed_recipient == NULL), and match it against other connections'
+ * match rules.
+ */
+- if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error))
+- goto out;
++ if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient,
++ message, &error))
++ {
++ /* Roll back and dispatch the message once the policy result is available */
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
++ }
+
+ out:
+ if (dbus_error_is_set (&error))
+@@ -4714,9 +4738,132 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir,
+ return TRUE;
+ }
+
++typedef struct {
++ DBusTimeout *timeout;
++ DBusConnection *connection;
++ dbus_bool_t timedout;
++ int check_counter;
++} BusTestCheckData;
++
++static BusTestCheckData *cdata;
++
++static dbus_bool_t
++bus_dispatch_test_check_timeout (void *data)
++{
++ _dbus_verbose ("timeout triggered - pretend that privilege check result is available\n");
++
++ /* should only happen once during the test */
++ _dbus_assert (!cdata->timedout);
++ cdata->timedout = TRUE;
++ _dbus_connection_enable_dispatch (cdata->connection);
++
++ /* don't call this again */
++ _dbus_loop_remove_timeout (bus_connection_get_loop (cdata->connection),
++ cdata->timeout);
++ dbus_connection_unref (cdata->connection);
++ cdata->connection = NULL;
++ return TRUE;
++}
++
++static dbus_bool_t
++bus_dispatch_test_check_override (DBusConnection *connection,
++ const char *privilege)
++{
++ _dbus_verbose ("overriding privilege check %s #%d\n", privilege, cdata->check_counter);
++ cdata->check_counter++;
++ if (!cdata->timedout)
++ {
++ dbus_bool_t added;
++
++ /* Should be the first privilege check for the "Echo" method. */
++ _dbus_assert (cdata->check_counter == 1);
++ cdata->timeout = _dbus_timeout_new (1, bus_dispatch_test_check_timeout,
++ NULL, NULL);
++ _dbus_assert (cdata->timeout);
++ added = _dbus_loop_add_timeout (bus_connection_get_loop (connection),
++ cdata->timeout);
++ _dbus_assert (added);
++ cdata->connection = connection;
++ dbus_connection_ref (connection);
++ _dbus_connection_disable_dispatch (connection);
++ return BUS_RESULT_LATER;
++ }
++ else
++ {
++ /* Should only be checked one more time, and this time succeeds. */
++ _dbus_assert (cdata->check_counter == 2);
++ return BUS_RESULT_TRUE;
++ }
++}
++
++static dbus_bool_t
++bus_dispatch_test_check (const DBusString *test_data_dir)
++{
++ const char *filename = "valid-config-files/debug-check-some.conf";
++ BusContext *context;
++ DBusConnection *foo;
++ DBusError error;
++ dbus_bool_t result = TRUE;
++ BusTestCheckData data;
++
++ /* save the config name for the activation helper */
++ if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename))
++ _dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
++
++ dbus_error_init (&error);
++
++ context = bus_context_new_test (test_data_dir, filename);
++ if (context == NULL)
++ return FALSE;
++
++ foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
++ if (foo == NULL)
++ _dbus_assert_not_reached ("could not alloc connection");
++
++ if (!bus_setup_debug_client (foo))
++ _dbus_assert_not_reached ("could not set up connection");
++
++ spin_connection_until_authenticated (context, foo);
++
++ if (!check_hello_message (context, foo))
++ _dbus_assert_not_reached ("hello message failed");
++
++ if (!check_double_hello_message (context, foo))
++ _dbus_assert_not_reached ("double hello message failed");
++
++ if (!check_add_match_all (context, foo))
++ _dbus_assert_not_reached ("AddMatch message failed");
++
++ /*
++ * Cause bus_check_send_privilege() to return BUS_RESULT_LATER in the
++ * first call, then BUS_RESULT_TRUE.
++ */
++ cdata = &data;
++ memset (cdata, 0, sizeof(*cdata));
++ bus_check_test_override = bus_dispatch_test_check_override;
++
++ result = check_existent_service_auto_start (context, foo);
++
++ _dbus_assert (cdata->check_counter == 2);
++ _dbus_assert (cdata->timedout);
++ _dbus_assert (cdata->timeout);
++ _dbus_assert (!cdata->connection);
++ _dbus_timeout_unref (cdata->timeout);
++
++ kill_client_connection_unchecked (foo);
++
++ bus_context_unref (context);
++
++ return result;
++}
++
+ dbus_bool_t
+ bus_dispatch_test (const DBusString *test_data_dir)
+ {
++ _dbus_verbose ("<check> tests\n");
++ if (!bus_dispatch_test_check (test_data_dir))
++ return FALSE;
++
+ /* run normal activation tests */
+ _dbus_verbose ("Normal activation tests\n");
+ if (!bus_dispatch_test_conf (test_data_dir,
+diff --git a/bus/dispatch.h b/bus/dispatch.h
+index fb5ba7a..afba6a2 100644
+--- a/bus/dispatch.h
++++ b/bus/dispatch.h
+@@ -29,7 +29,7 @@
+
+ dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection);
+ void bus_dispatch_remove_connection (DBusConnection *connection);
+-dbus_bool_t bus_dispatch_matches (BusTransaction *transaction,
++BusResult bus_dispatch_matches (BusTransaction *transaction,
+ DBusConnection *sender,
+ DBusConnection *recipient,
+ DBusMessage *message,
+diff --git a/bus/driver.c b/bus/driver.c
+index 11706f8..4dbce3d 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -97,6 +97,7 @@ bus_driver_send_service_owner_changed (const char *service_name,
+ {
+ DBusMessage *message;
+ dbus_bool_t retval;
++ BusResult res;
+ const char *null_service;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -129,7 +130,17 @@ bus_driver_send_service_owner_changed (const char *service_name,
+
+ _dbus_assert (dbus_message_has_signature (message, "sss"));
+
+- retval = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ res = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ if (res == BUS_RESULT_TRUE)
++ retval = TRUE;
++ else if (res == BUS_RESULT_FALSE)
++ retval = FALSE;
++ else if (res == BUS_RESULT_LATER)
++ {
++ /* should never happen */
++ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly");
++ retval = FALSE;
++ }
+ dbus_message_unref (message);
+
+ return retval;
+diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
+index 64ef336..4fcd118 100644
+--- a/dbus/dbus-connection-internal.h
++++ b/dbus/dbus-connection-internal.h
+@@ -109,6 +109,15 @@ void _dbus_connection_set_pending_fds_function (DBusConnectio
+
+ dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
+ char **label_p);
++void _dbus_connection_enable_dispatch (DBusConnection *connection);
++void _dbus_connection_disable_dispatch (DBusConnection *connection);
++dbus_bool_t _dbus_connection_putback_message (DBusConnection *connection,
++ DBusMessage *after_message,
++ DBusMessage *message,
++ DBusError *error);
++
++dbus_bool_t _dbus_connection_remove_message (DBusConnection *connection,
++ DBusMessage *message);
+
+ /* if DBUS_ENABLE_STATS */
+ void _dbus_connection_get_stats (DBusConnection *connection,
+diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
+index 8952b75..5d8d943 100644
+--- a/dbus/dbus-connection.c
++++ b/dbus/dbus-connection.c
+@@ -311,7 +311,8 @@ struct DBusConnection
+ */
+ dbus_bool_t dispatch_acquired; /**< Someone has dispatch path (can drain incoming queue) */
+ dbus_bool_t io_path_acquired; /**< Someone has transport io path (can use the transport to read/write messages) */
+-
++
++ unsigned int dispatch_disabled : 1; /**< if true, then dispatching incoming messages is stopped until enabled again */
+ unsigned int shareable : 1; /**< #TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more than once */
+
+ unsigned int exit_on_disconnect : 1; /**< If #TRUE, exit after handling disconnect signal */
+@@ -439,6 +440,39 @@ _dbus_connection_wakeup_mainloop (DBusConnection *connection)
+ (*connection->wakeup_main_function) (connection->wakeup_main_data);
+ }
+
++static void
++_dbus_connection_set_dispatch(DBusConnection *connection,
++ dbus_bool_t disabled)
++{
++ CONNECTION_LOCK (connection);
++ if (connection->dispatch_disabled != disabled)
++ {
++ DBusDispatchStatus status;
++
++ connection->dispatch_disabled = disabled;
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++ }
++ else
++ {
++ CONNECTION_UNLOCK (connection);
++ }
++}
++
++
++void
++_dbus_connection_enable_dispatch (DBusConnection *connection)
++{
++ _dbus_connection_set_dispatch (connection, FALSE);
++}
++
++void
++ _dbus_connection_disable_dispatch (DBusConnection *connection)
++{
++ _dbus_connection_set_dispatch (connection, TRUE);
++}
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ /**
+ * Gets the locks so we can examine them
+@@ -4068,6 +4102,82 @@ _dbus_connection_putback_message_link_unlocked (DBusConnection *connection,
+ "_dbus_connection_putback_message_link_unlocked");
+ }
+
++dbus_bool_t
++_dbus_connection_putback_message (DBusConnection *connection,
++ DBusMessage *after_message,
++ DBusMessage *message,
++ DBusError *error)
++{
++ DBusDispatchStatus status;
++ DBusList *message_link = _dbus_list_alloc_link (message);
++ DBusList *after_link;
++ if (message_link == NULL)
++ {
++ _DBUS_SET_OOM (error);
++ return FALSE;
++ }
++ dbus_message_ref (message);
++
++ CONNECTION_LOCK (connection);
++ _dbus_connection_acquire_dispatch (connection);
++ HAVE_LOCK_CHECK (connection);
++
++ after_link = _dbus_list_find_first(&connection->incoming_messages, after_message);
++ _dbus_list_insert_after_link (&connection->incoming_messages, after_link, message_link);
++ connection->n_incoming += 1;
++
++ _dbus_verbose ("Message %p (%s %s %s '%s') put back into queue %p, %d incoming\n",
++ message_link->data,
++ dbus_message_type_to_string (dbus_message_get_type (message_link->data)),
++ dbus_message_get_interface (message_link->data) ?
++ dbus_message_get_interface (message_link->data) :
++ "no interface",
++ dbus_message_get_member (message_link->data) ?
++ dbus_message_get_member (message_link->data) :
++ "no member",
++ dbus_message_get_signature (message_link->data),
++ connection, connection->n_incoming);
++
++ _dbus_message_trace_ref (message_link->data, -1, -1,
++ "_dbus_connection_putback_message");
++
++ _dbus_connection_release_dispatch (connection);
++
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++
++ return TRUE;
++}
++
++dbus_bool_t
++_dbus_connection_remove_message (DBusConnection *connection,
++ DBusMessage *message)
++{
++ DBusDispatchStatus status;
++ dbus_bool_t removed;
++
++ CONNECTION_LOCK (connection);
++ _dbus_connection_acquire_dispatch (connection);
++ HAVE_LOCK_CHECK (connection);
++
++ removed = _dbus_list_remove(&connection->incoming_messages, message);
++
++ if (removed)
++ {
++ connection->n_incoming -= 1;
++ dbus_message_unref(message);
++ _dbus_verbose ("Message %p removed from incoming queue\n", message);
++ }
++ else
++ _dbus_verbose ("Message %p not found in the incoming queue\n", message);
++
++ _dbus_connection_release_dispatch (connection);
++
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++ return removed;
++}
++
+ /**
+ * Returns the first-received message from the incoming message queue,
+ * removing it from the queue. The caller owns a reference to the
+@@ -4251,8 +4361,9 @@ static DBusDispatchStatus
+ _dbus_connection_get_dispatch_status_unlocked (DBusConnection *connection)
+ {
+ HAVE_LOCK_CHECK (connection);
+-
+- if (connection->n_incoming > 0)
++ if (connection->dispatch_disabled && dbus_connection_get_is_connected(connection))
++ return DBUS_DISPATCH_COMPLETE;
++ else if (connection->n_incoming > 0)
+ return DBUS_DISPATCH_DATA_REMAINS;
+ else if (!_dbus_transport_queue_messages (connection->transport))
+ return DBUS_DISPATCH_NEED_MEMORY;
+@@ -4689,6 +4800,8 @@ dbus_connection_dispatch (DBusConnection *connection)
+
+ CONNECTION_LOCK (connection);
+
++ if (result == DBUS_HANDLER_RESULT_LATER)
++ goto out;
+ if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
+ {
+ _dbus_verbose ("No memory\n");
+@@ -4811,9 +4924,11 @@ dbus_connection_dispatch (DBusConnection *connection)
+ connection);
+
+ out:
+- if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
++ if (result == DBUS_HANDLER_RESULT_LATER ||
++ result == DBUS_HANDLER_RESULT_NEED_MEMORY)
+ {
+- _dbus_verbose ("out of memory\n");
++ if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
++ _dbus_verbose ("out of memory\n");
+
+ /* Put message back, and we'll start over.
+ * Yes this means handlers must be idempotent if they
+diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c
+index c4c1856..f84918b 100644
+--- a/dbus/dbus-list.c
++++ b/dbus/dbus-list.c
+@@ -459,6 +459,35 @@ _dbus_list_remove_last (DBusList **list,
+ }
+
+ /**
++ * Finds a value in the list. Returns the first link
++ * with value equal to the given data pointer.
++ * This is a linear-time operation.
++ * Returns #NULL if no value found that matches.
++ *
++ * @param list address of the list head.
++ * @param data the value to find.
++ * @returns the link if found
++ */
++DBusList*
++_dbus_list_find_first (DBusList **list,
++ void *data)
++{
++ DBusList *link;
++
++ link = _dbus_list_get_first_link (list);
++
++ while (link != NULL)
++ {
++ if (link->data == data)
++ return link;
++
++ link = _dbus_list_get_next_link (list, link);
++ }
++
++ return NULL;
++}
++
++/**
+ * Finds a value in the list. Returns the last link
+ * with value equal to the given data pointer.
+ * This is a linear-time operation.
+diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h
+index 910d738..abe8331 100644
+--- a/dbus/dbus-list.h
++++ b/dbus/dbus-list.h
+@@ -59,6 +59,8 @@ dbus_bool_t _dbus_list_remove_last (DBusList **list,
+ void *data);
+ void _dbus_list_remove_link (DBusList **list,
+ DBusList *link);
++DBusList* _dbus_list_find_first (DBusList **list,
++ void *data);
+ DBusList* _dbus_list_find_last (DBusList **list,
+ void *data);
+ void _dbus_list_clear (DBusList **list);
+diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h
+index 6a57670..5371d88 100644
+--- a/dbus/dbus-shared.h
++++ b/dbus/dbus-shared.h
+@@ -67,7 +67,8 @@ typedef enum
+ {
+ DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
+- DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
++ DBUS_HANDLER_RESULT_NEED_MEMORY, /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
++ DBUS_HANDLER_RESULT_LATER /**< Message dispatch deferred due to pending policy check */
+ } DBusHandlerResult;
+
+ /* Bus names */
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0006-Handle-unavailability-of-policy-results-for-broadcas.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0006-Handle-unavailability-of-policy-results-for-broadcas.patch
new file mode 100644
index 000000000..66f4e14e5
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0006-Handle-unavailability-of-policy-results-for-broadcas.patch
@@ -0,0 +1,1071 @@
+From 1e231194610892dd4360224998d91336097b05a1 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Fri, 28 Nov 2014 12:39:33 +0100
+Subject: [PATCH 6/8] Handle unavailability of policy results for broadcasts
+ and receive rules
+
+When message is sent to the addressed recipient and receive rule
+result is unavailable we don't want to block the sender
+as it most likely will be the privileged service, so instead we queue
+it at the recipient. Any further messages sent to it will be queued to
+maintain message order. Once the answer from Cynara arrives messages are
+dispatched from the recipient queue. In such case full dispatch is
+performed - messages are sent to addressed recipient and other
+interested connections.
+Messages sent to non-addressed recipients (eavesdroppers or broadcast
+message recipients) are handled in a similar way. The difference is
+that it is not full dispatch meaning message is sent to a single recipient.
+
+Change-Id: Iecd5395f75a4c7811fa97247a37d8fc4d42e8814
+---
+ bus/activation.c | 4 +-
+ bus/bus.c | 50 +++++++--
+ bus/bus.h | 19 ++++
+ bus/check.c | 307 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ bus/check.h | 25 +++++
+ bus/connection.c | 166 ++++++++++++++++++++++++++++--
+ bus/connection.h | 19 +++-
+ bus/dispatch.c | 122 ++++++++++++++++++----
+ bus/dispatch.h | 11 +-
+ bus/driver.c | 2 +-
+ bus/policy.c | 6 ++
+ 11 files changed, 685 insertions(+), 46 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index 8c43941..308bf41 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -1198,7 +1198,7 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ res = bus_dispatch_matches (transaction,
+ entry->connection,
+ addressed_recipient,
+- entry->activation_message, &error);
++ entry->activation_message, NULL, &error);
+ if (res == BUS_RESULT_FALSE)
+ {
+ /* If permission is denied, we just want to return the error
+@@ -2066,7 +2066,7 @@ bus_activation_activate_service (BusActivation *activation,
+ entry->systemd_service);
+ /* Wonderful, systemd is connected, let's just send the msg */
+ res = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
+- message, error);
++ message, NULL, error);
+
+ if (res == BUS_RESULT_TRUE)
+ retval = TRUE;
+diff --git a/bus/bus.c b/bus/bus.c
+index ac9ea8d..b478b8e 100644
+--- a/bus/bus.c
++++ b/bus/bus.c
+@@ -1704,17 +1704,9 @@ bus_context_check_security_policy (BusContext *context,
+ }
+
+ /* See if limits on size have been exceeded */
+- if (proposed_recipient &&
+- ((dbus_connection_get_outgoing_size (proposed_recipient) > context->limits.max_outgoing_bytes) ||
+- (dbus_connection_get_outgoing_unix_fds (proposed_recipient) > context->limits.max_outgoing_unix_fds)))
+- {
+- complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
+- "Rejected: destination has a full message queue",
+- 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL,
+- error);
+- _dbus_verbose ("security policy disallowing message due to full message queue\n");
++ if (!bus_context_check_recipient_message_limits(context, proposed_recipient, sender, message,
++ requested_reply, error))
+ return BUS_RESULT_FALSE;
+- }
+
+ /* Record that we will allow a reply here in the future (don't
+ * bother if the recipient is the bus or this is an eavesdropping
+@@ -1769,3 +1761,41 @@ bus_context_check_all_watches (BusContext *context)
+ _dbus_server_toggle_all_watches (server, enabled);
+ }
+ }
++
++void
++bus_context_complain_about_message (BusContext *context,
++ const char *error_name,
++ const char *complaint,
++ int matched_rules,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *proposed_recipient,
++ dbus_bool_t requested_reply,
++ dbus_bool_t log,
++ const char *privilege,
++ DBusError *error)
++{
++ complain_about_message(context, error_name, complaint, matched_rules, message, sender,
++ proposed_recipient, requested_reply, log, privilege, error);
++}
++
++dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context,
++ DBusConnection *recipient,
++ DBusConnection *sender,
++ DBusMessage *message,
++ dbus_bool_t requested_reply,
++ DBusError *error)
++{
++ if (recipient &&
++ ((dbus_connection_get_outgoing_size (recipient) > context->limits.max_outgoing_bytes) ||
++ (dbus_connection_get_outgoing_unix_fds (recipient) > context->limits.max_outgoing_unix_fds)))
++ {
++ complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
++ "Rejected: destination has a full message queue",
++ 0, message, sender, recipient, requested_reply, TRUE, NULL,
++ error);
++ _dbus_verbose ("security policy disallowing message due to full message queue\n");
++ return FALSE;
++ }
++ return TRUE;
++}
+diff --git a/bus/bus.h b/bus/bus.h
+index 78084dd..27a5e49 100644
+--- a/bus/bus.h
++++ b/bus/bus.h
+@@ -148,4 +148,23 @@ BusResult bus_context_check_security_policy (BusContext
+ DBusError *error,
+ BusDeferredMessage **deferred_message);
+
++dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context,
++ DBusConnection *recipient,
++ DBusConnection *sender,
++ DBusMessage *message,
++ dbus_bool_t requested_reply,
++ DBusError *error);
++void bus_context_complain_about_message (BusContext *context,
++ const char *error_name,
++ const char *complaint,
++ int matched_rules,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *proposed_recipient,
++ dbus_bool_t requested_reply,
++ dbus_bool_t log,
++ const char *privilege,
++ DBusError *error);
++
++
+ #endif /* BUS_BUS_H */
+diff --git a/bus/check.c b/bus/check.c
+index cd6a74b..733763a 100644
+--- a/bus/check.c
++++ b/bus/check.c
+@@ -49,6 +49,9 @@ typedef struct BusDeferredMessage
+ DBusConnection *sender;
+ DBusConnection *proposed_recipient;
+ DBusConnection *addressed_recipient;
++ dbus_bool_t requested_reply;
++ int matched_rules;
++ const char *privilege;
+ dbus_bool_t full_dispatch;
+ BusDeferredMessageStatus status;
+ BusResult response;
+@@ -136,6 +139,89 @@ bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message,
+ }
+
+ static void
++bus_check_queued_message_reply_callback (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ int status;
++
++ _dbus_verbose("bus_check_queued_message_reply_callback called message=%p\n", deferred_message);
++
++ if (!bus_connection_is_active(deferred_message->proposed_recipient))
++ return;
++
++ status = deferred_message->status;
++
++ deferred_message->status = 0; /* mark message as not waiting for response */
++ deferred_message->response = result;
++
++ /*
++ * If send rule allows us to send message we still need to check receive rules.
++ */
++ if ((status & BUS_DEFERRED_MESSAGE_CHECK_SEND) && (result == BUS_RESULT_TRUE))
++ {
++ int toggles;
++ BusContext *context;
++ BusRegistry *registry;
++ BusClientPolicy *recipient_policy;
++ BusDeferredMessage *deferred_message_receive;
++
++ context = bus_connection_get_context(deferred_message->proposed_recipient);
++ registry = bus_context_get_registry(context);
++ recipient_policy = bus_connection_get_policy(deferred_message->proposed_recipient);
++
++ deferred_message->response = bus_client_policy_check_can_receive(recipient_policy, registry,
++ deferred_message->requested_reply, deferred_message->sender,
++ deferred_message->addressed_recipient, deferred_message->proposed_recipient, deferred_message->message,
++ &toggles, NULL, &deferred_message_receive);
++ if (deferred_message->response == BUS_RESULT_LATER)
++ {
++ /* replace deferred message associated with send check with the one associated with
++ * receive check */
++ if (!bus_deferred_message_replace(deferred_message, deferred_message_receive))
++ {
++ /* failed to replace deferred message (due to oom). Set it to rejected */
++ deferred_message->response = BUS_RESULT_FALSE;
++ }
++ }
++ }
++
++ bus_connection_dispatch_deferred(deferred_message->proposed_recipient);
++}
++
++static void
++queue_deferred_message_cancel_transaction_hook (void *data)
++{
++ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data;
++ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message);
++}
++
++
++dbus_bool_t
++bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ dbus_bool_t full_dispatch,
++ dbus_bool_t prepend)
++{
++ _dbus_assert(deferred_message != NULL);
++ _dbus_assert(deferred_message->proposed_recipient != NULL);
++
++ if (!bus_connection_queue_deferred_message(deferred_message->proposed_recipient,
++ deferred_message, prepend))
++ return FALSE;
++
++ if (!bus_transaction_add_cancel_hook(transaction, queue_deferred_message_cancel_transaction_hook,
++ deferred_message, NULL))
++ {
++ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message);
++ return FALSE;
++ }
++ deferred_message->response_callback = bus_check_queued_message_reply_callback;
++ deferred_message->full_dispatch = full_dispatch;
++
++ return TRUE;
++}
++
++static void
+ deferred_message_free_function(void *data)
+ {
+ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data;
+@@ -159,6 +245,20 @@ bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message)
+ deferred_message->response_callback = bus_check_enable_dispatch_callback;
+ }
+
++void
++bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message,
++ dbus_bool_t requested_reply,
++ int matched_rules,
++ const char *privilege)
++{
++ _dbus_assert(deferred_message != NULL);
++
++ deferred_message->requested_reply = requested_reply;
++ deferred_message->matched_rules = matched_rules;
++ deferred_message->privilege = privilege;
++}
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ dbus_bool_t (*bus_check_test_override) (DBusConnection *connection,
+ const char *privilege);
+@@ -257,6 +357,9 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
+ deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL;
+ deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL;
+ deferred_message->message = dbus_message_ref(message);
++ deferred_message->requested_reply = FALSE;
++ deferred_message->matched_rules = 0;
++ deferred_message->privilege = NULL;
+ deferred_message->response = response;
+ deferred_message->status = 0;
+ deferred_message->full_dispatch = FALSE;
+@@ -293,12 +396,215 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message)
+ }
+ }
+
++dbus_bool_t
++bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message, DBusError *error)
++{
++ BusContext *context = bus_connection_get_context(deferred_message->proposed_recipient);
++
++ return bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient,
++ deferred_message->sender, deferred_message->message, deferred_message->requested_reply,
++ error);
++}
++
++dbus_bool_t
++bus_deferred_message_expect_method_reply(BusDeferredMessage *deferred_message, BusTransaction *transaction, DBusError *error)
++{
++ int type = dbus_message_get_type(deferred_message->message);
++ if (type == DBUS_MESSAGE_TYPE_METHOD_CALL &&
++ deferred_message->sender &&
++ deferred_message->addressed_recipient &&
++ deferred_message->addressed_recipient == deferred_message->proposed_recipient && /* not eavesdropping */
++ !bus_connections_expect_reply (bus_connection_get_connections (deferred_message->sender),
++ transaction,
++ deferred_message->sender, deferred_message->addressed_recipient,
++ deferred_message->message, error))
++ {
++ _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n");
++ return FALSE;
++ }
++ return TRUE;
++}
++
++void
++bus_deferred_message_create_error(BusDeferredMessage *deferred_message,
++ const char *error_message, DBusError *error)
++{
++ BusContext *context;
++ _dbus_assert (deferred_message->status == 0 && deferred_message->response == BUS_RESULT_FALSE);
++
++ if (deferred_message->sender == NULL)
++ return; /* error won't be sent to bus driver anyway */
++
++ context = bus_connection_get_context(deferred_message->sender);
++ bus_context_complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected message",
++ deferred_message->matched_rules, deferred_message->message, deferred_message->sender,
++ deferred_message->proposed_recipient, deferred_message->requested_reply, FALSE,
++ deferred_message->privilege, error);
++}
++
++BusResult
++bus_deferred_message_dispatch (BusDeferredMessage *deferred_message)
++{
++ BusContext *context = bus_connection_get_context (deferred_message->proposed_recipient);
++ BusTransaction *transaction = bus_transaction_new (context);
++ BusResult result = BUS_RESULT_TRUE;
++ DBusError error;
++
++ if (transaction == NULL)
++ {
++ return BUS_RESULT_FALSE;
++ }
++
++ dbus_error_init(&error);
++
++ if (!deferred_message->full_dispatch)
++ {
++ result = deferred_message->response;
++ if (result == BUS_RESULT_TRUE)
++ {
++ if (!bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient,
++ deferred_message->sender, deferred_message->message, deferred_message->requested_reply, &error))
++ result = BUS_RESULT_FALSE;
++ }
++ else if (result == BUS_RESULT_LATER)
++ {
++ BusDeferredMessage *deferred_message2;
++ result = bus_context_check_security_policy (context, transaction,
++ deferred_message->sender,
++ deferred_message->addressed_recipient,
++ deferred_message->proposed_recipient,
++ deferred_message->message, NULL,
++ &deferred_message2);
++
++ if (result == BUS_RESULT_LATER)
++ {
++ /* prepend at recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message2, transaction,
++ FALSE, TRUE))
++ result = BUS_RESULT_FALSE;
++ }
++ }
++
++ /* silently drop messages on access denial */
++ if (result == BUS_RESULT_TRUE)
++ {
++ if (!bus_transaction_send (transaction, deferred_message->proposed_recipient, deferred_message->message, TRUE))
++ result = BUS_RESULT_FALSE;
++ }
++
++ bus_transaction_execute_and_free(transaction);
++
++ goto out;
++ }
++
++ /* do not attempt to send message if sender has disconnected */
++ if (deferred_message->sender != NULL && !bus_connection_is_active(deferred_message->sender))
++ {
++ bus_transaction_cancel_and_free(transaction);
++ result = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ result = bus_dispatch_matches(transaction, deferred_message->sender,
++ deferred_message->addressed_recipient, deferred_message->message, deferred_message, &error);
++
++ if (result == BUS_RESULT_LATER)
++ {
++ /* Message deferring was already done in bus_dispatch_matches */
++ bus_transaction_cancel_and_free(transaction);
++ goto out;
++ }
++
++ /* this part is a copy & paste from bus_dispatch function. Probably can be moved to a function */
++ if (dbus_error_is_set (&error))
++ {
++ if (!dbus_connection_get_is_connected (deferred_message->sender))
++ {
++ /* If we disconnected it, we won't bother to send it any error
++ * messages.
++ */
++ _dbus_verbose ("Not sending error to connection we disconnected\n");
++ }
++ else if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
++ {
++ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message);
++
++ /* cancel transaction due to OOM */
++ if (transaction != NULL)
++ {
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ }
++ }
++ else
++ {
++ /* Try to send the real error, if no mem to do that, send
++ * the OOM error
++ */
++ _dbus_assert (transaction != NULL);
++ if (!bus_transaction_send_error_reply (transaction, deferred_message->sender,
++ &error, deferred_message->message))
++ {
++ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message);
++
++ /* cancel transaction due to OOM */
++ if (transaction != NULL)
++ {
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ }
++ }
++ }
++ }
++
++ if (transaction != NULL)
++ {
++ bus_transaction_execute_and_free (transaction);
++ }
++
++out:
++ dbus_error_free(&error);
++
++ return result;
++}
++
++dbus_bool_t
++bus_deferred_message_replace (BusDeferredMessage *old_message, BusDeferredMessage *new_message)
++{
++ if (bus_connection_replace_deferred_message(old_message->proposed_recipient,
++ old_message, new_message))
++ {
++ new_message->response_callback = old_message->response_callback;
++ new_message->full_dispatch = old_message->full_dispatch;
++ return TRUE;
++ }
++ return FALSE;
++}
++
++dbus_bool_t
++bus_deferred_message_waits_for_check(BusDeferredMessage *deferred_message)
++{
++ return deferred_message->status != 0;
++}
++
++DBusConnection *
++bus_deferred_message_get_recipient(BusDeferredMessage *deferred_message)
++{
++ return deferred_message->proposed_recipient;
++}
++
+ BusDeferredMessageStatus
+ bus_deferred_message_get_status (BusDeferredMessage *deferred_message)
+ {
+ return deferred_message->status;
+ }
+
++BusResult
++bus_deferred_message_get_response (BusDeferredMessage *deferred_message)
++{
++ return deferred_message->response;
++}
++
+ void
+ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result)
+@@ -308,3 +614,4 @@ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ deferred_message->response_callback(deferred_message, result);
+ }
+ }
++
+diff --git a/bus/check.h b/bus/check.h
+index f381789..3c6b2a1 100644
+--- a/bus/check.h
++++ b/bus/check.h
+@@ -64,12 +64,37 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *messag
+
+ BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
++BusResult bus_deferred_message_dispatch (BusDeferredMessage *deferred_message);
++dbus_bool_t bus_deferred_message_waits_for_check (BusDeferredMessage *deferred_message);
++DBusConnection *bus_deferred_message_get_recipient (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result);
++dbus_bool_t bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ dbus_bool_t full_dispatch,
++ dbus_bool_t prepend);
++dbus_bool_t bus_deferred_message_replace (BusDeferredMessage *old_message,
++ BusDeferredMessage *new_message);
+ void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message);
++BusResult bus_deferred_message_get_response (BusDeferredMessage *deferred_message);
+
+ BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message);
+
++
++dbus_bool_t bus_deferred_message_expect_method_reply (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ DBusError *error);
++void bus_deferred_message_create_error (BusDeferredMessage *deferred_message,
++ const char *error_message,
++ DBusError *error);
++void bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message,
++ dbus_bool_t requested_reply,
++ int matched_rules,
++ const char *privilege);
++dbus_bool_t bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message,
++ DBusError *error);
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ extern dbus_bool_t (*bus_check_test_override) (DBusConnection *connection,
+ const char *privilege);
+diff --git a/bus/connection.c b/bus/connection.c
+index a6d87e5..d2ebe82 100644
+--- a/bus/connection.c
++++ b/bus/connection.c
+@@ -30,10 +30,12 @@
+ #include "signals.h"
+ #include "expirelist.h"
+ #include "selinux.h"
++#include "check.h"
+ #include <dbus/dbus-list.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-timeout.h>
+ #include <dbus/dbus-connection-internal.h>
++#include <dbus/dbus-message-internal.h>
+ #ifdef DBUS_ENABLE_CYNARA
+ #include <stdlib.h>
+ #include <cynara-session.h>
+@@ -95,6 +97,7 @@ typedef struct
+ DBusMessage *oom_message;
+ DBusPreallocatedSend *oom_preallocated;
+ BusClientPolicy *policy;
++ DBusList *deferred_messages; /**< Queue of messages deferred due to pending policy check */
+
+ char *cached_loginfo_string;
+ BusSELinuxID *selinux_id;
+@@ -256,6 +259,8 @@ bus_connection_disconnected (DBusConnection *connection)
+ bus_transaction_execute_and_free (transaction);
+ }
+
++ bus_connection_clear_deferred_messages(connection);
++
+ bus_dispatch_remove_connection (connection);
+
+ /* no more watching */
+@@ -2132,6 +2137,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ DBusMessage *message)
+ {
+ BusResult res;
++ BusDeferredMessage *deferred_message;
+ /* We have to set the sender to the driver, and have
+ * to check security policy since it was not done in
+ * dispatch.c
+@@ -2163,23 +2169,25 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ res = bus_context_check_security_policy (bus_transaction_get_context (transaction),
+ transaction,
+ NULL, connection, connection, message, NULL,
+- NULL);
++ &deferred_message);
+
+ if (res == BUS_RESULT_FALSE)
+ return TRUE;
+ else if (res == BUS_RESULT_LATER)
+ {
+- _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n");
+- return TRUE;
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE))
++ return FALSE;
++ return TRUE; /* pretend to have sent it */
+ }
+
+- return bus_transaction_send (transaction, connection, message);
++ return bus_transaction_send (transaction, connection, message, FALSE);
+ }
+
+ dbus_bool_t
+ bus_transaction_send (BusTransaction *transaction,
+ DBusConnection *connection,
+- DBusMessage *message)
++ DBusMessage *message,
++ dbus_bool_t deferred_dispatch)
+ {
+ MessageToSend *to_send;
+ BusConnectionData *d;
+@@ -2205,7 +2213,28 @@ bus_transaction_send (BusTransaction *transaction,
+
+ d = BUS_CONNECTION_DATA (connection);
+ _dbus_assert (d != NULL);
+-
++
++ if (!deferred_dispatch && d->deferred_messages != NULL)
++ {
++ BusDeferredMessage *deferred_message;
++ dbus_bool_t success;
++ /* sender and addressed recipient are not required at this point as we only need to send message
++ * to a single recipient without performing policy check. */
++ deferred_message = bus_deferred_message_new (message,
++ NULL,
++ NULL,
++ connection,
++ BUS_RESULT_TRUE);
++ if (deferred_message == NULL)
++ return FALSE;
++
++ success = bus_deferred_message_queue_at_recipient(deferred_message, transaction,
++ FALSE, FALSE);
++ bus_deferred_message_unref(deferred_message);
++
++ return success;
++ }
++
+ to_send = dbus_new (MessageToSend, 1);
+ if (to_send == NULL)
+ {
+@@ -2457,6 +2486,131 @@ bus_transaction_add_cancel_hook (BusTransaction *transaction,
+ return TRUE;
+ }
+
++void
++bus_connection_dispatch_deferred (DBusConnection *connection)
++{
++ BusDeferredMessage *message;
++
++ _dbus_return_if_fail (connection != NULL);
++
++ while ((message = bus_connection_pop_deferred_message(connection)) != NULL)
++ {
++ bus_deferred_message_dispatch(message);
++ bus_deferred_message_unref(message);
++ }
++}
++
++dbus_bool_t
++bus_connection_has_deferred_messages (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ return d->deferred_messages != NULL ? TRUE : FALSE;
++}
++
++dbus_bool_t
++bus_connection_queue_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message,
++ dbus_bool_t prepend)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ dbus_bool_t success;
++ if (prepend)
++ success = _dbus_list_prepend(&d->deferred_messages, message);
++ else
++ success = _dbus_list_append(&d->deferred_messages, message);
++
++ if (success)
++ {
++ bus_deferred_message_ref(message);
++ return TRUE;
++ }
++
++ return FALSE;
++}
++
++dbus_bool_t
++bus_connection_replace_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *oldMessage,
++ BusDeferredMessage *newMessage)
++{
++ DBusList *link;
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++
++ link = _dbus_list_find_first(&d->deferred_messages, oldMessage);
++ if (link == NULL)
++ return FALSE;
++
++ if (!_dbus_list_insert_after(&d->deferred_messages, link, newMessage))
++ return FALSE;
++
++ bus_deferred_message_ref(newMessage);
++ _dbus_list_remove_link(&d->deferred_messages, link);
++ bus_deferred_message_unref(oldMessage);
++ return TRUE;
++}
++
++BusDeferredMessage *
++bus_connection_pop_deferred_message (DBusConnection *connection)
++{
++ DBusList *link;
++ BusDeferredMessage *message;
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++
++ link =_dbus_list_get_first_link(&d->deferred_messages);
++ if (link != NULL)
++ {
++ message = link->data;
++ if (!bus_deferred_message_waits_for_check(message))
++ {
++ _dbus_list_remove_link(&d->deferred_messages, link);
++ return message;
++ }
++ }
++
++ return NULL;
++}
++
++dbus_bool_t
++bus_connection_putback_deferred_message (DBusConnection *connection, BusDeferredMessage *message)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ if (_dbus_list_prepend(&d->deferred_messages, message))
++ {
++ return TRUE;
++ }
++ return FALSE;
++}
++
++void
++bus_connection_clear_deferred_messages (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ DBusList *link;
++ DBusList *next;
++ BusDeferredMessage *message;
++
++ link =_dbus_list_get_first_link(&d->deferred_messages);
++ while (link != NULL)
++ {
++ next = _dbus_list_get_next_link (&d->deferred_messages, link);
++ message = link->data;
++
++ bus_deferred_message_unref(message);
++ _dbus_list_remove_link(&d->deferred_messages, link);
++
++ link = next;
++ }
++}
++
++void
++bus_connection_remove_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ if (_dbus_list_remove(&d->deferred_messages, message))
++ bus_deferred_message_unref(message);
++}
++
+ int
+ bus_connections_get_n_active (BusConnections *connections)
+ {
+diff --git a/bus/connection.h b/bus/connection.h
+index 7433746..8d49b25 100644
+--- a/bus/connection.h
++++ b/bus/connection.h
+@@ -82,6 +82,22 @@ dbus_bool_t bus_connection_preallocate_oom_error (DBusConnection *connection);
+ void bus_connection_send_oom_error (DBusConnection *connection,
+ DBusMessage *in_reply_to);
+
++dbus_bool_t bus_connection_has_deferred_messages (DBusConnection *connection);
++dbus_bool_t bus_connection_queue_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message,
++ dbus_bool_t prepend);
++BusDeferredMessage *bus_connection_pop_deferred_message (DBusConnection *connection);
++dbus_bool_t bus_connection_putback_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message);
++void bus_connection_remove_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message);
++dbus_bool_t bus_connection_replace_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *oldMessage,
++ BusDeferredMessage *newMessage);
++void bus_connection_dispatch_deferred (DBusConnection *connection);
++void bus_connection_clear_deferred_messages (DBusConnection *connection);
++
++
+ /* called by signals.c */
+ dbus_bool_t bus_connection_add_match_rule (DBusConnection *connection,
+ BusMatchRule *rule);
+@@ -129,7 +145,8 @@ BusTransaction* bus_transaction_new (BusContext *
+ BusContext* bus_transaction_get_context (BusTransaction *transaction);
+ dbus_bool_t bus_transaction_send (BusTransaction *transaction,
+ DBusConnection *connection,
+- DBusMessage *message);
++ DBusMessage *message,
++ dbus_bool_t deferred_dispatch);
+ dbus_bool_t bus_transaction_send_from_driver (BusTransaction *transaction,
+ DBusConnection *connection,
+ DBusMessage *message);
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index 6b0eadc..9972e76 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -33,8 +33,10 @@
+ #include "utils.h"
+ #include "bus.h"
+ #include "signals.h"
++#include "dispatch.h"
+ #include "test.h"
+ #include <dbus/dbus-internals.h>
++#include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-misc.h>
+ #include <string.h>
+
+@@ -63,16 +65,26 @@ send_one_message (DBusConnection *connection,
+ result = bus_context_check_security_policy (context, transaction, sender, addressed_recipient,
+ connection, message, NULL, &deferred_message);
+
+- if (result != BUS_RESULT_TRUE)
++ if (result == BUS_RESULT_FALSE)
+ return TRUE; /* silently don't send it */
+
+ if (dbus_message_contains_unix_fds(message) &&
+ !dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
+ return TRUE; /* silently don't send it */
+
++ if (result == BUS_RESULT_LATER)
++ {
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE))
++ {
++ BUS_SET_OOM (error);
++ return FALSE;
++ }
++ return TRUE; /* pretend to have sent it */
++ }
++
+ if (!bus_transaction_send (transaction,
+ connection,
+- message))
++ message, FALSE))
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+@@ -82,11 +94,12 @@ send_one_message (DBusConnection *connection,
+ }
+
+ BusResult
+-bus_dispatch_matches (BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusMessage *message,
+- DBusError *error)
++bus_dispatch_matches (BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusMessage *message,
++ BusDeferredMessage *dispatched_deferred_message,
++ DBusError *error)
+ {
+ DBusError tmp_error;
+ BusConnections *connections;
+@@ -110,17 +123,78 @@ bus_dispatch_matches (BusTransaction *transaction,
+ /* First, send the message to the addressed_recipient, if there is one. */
+ if (addressed_recipient != NULL)
+ {
+- BusResult res;
+- res = bus_context_check_security_policy (context, transaction,
+- sender, addressed_recipient,
+- addressed_recipient,
+- message, error,
+- &deferred_message);
+- if (res == BUS_RESULT_FALSE)
++ BusResult result;
++ /* To maintain message order message needs to be appended at the recipient if there are already
++ * deferred messages and we are not doing deferred dispatch
++ */
++ if (dispatched_deferred_message == NULL && bus_connection_has_deferred_messages(addressed_recipient))
++ {
++ deferred_message = bus_deferred_message_new(message, sender,
++ addressed_recipient, addressed_recipient, BUS_RESULT_LATER);
++
++ if (deferred_message == NULL)
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE))
++ {
++ bus_deferred_message_unref(deferred_message);
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ bus_deferred_message_unref(deferred_message);
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
++ }
++
++ if (dispatched_deferred_message != NULL)
++ {
++ result = bus_deferred_message_get_response(dispatched_deferred_message);
++ if (result == BUS_RESULT_TRUE)
++ {
++ /* if we know the result of policy check we still need to check if message limits
++ * are not exceeded. It is also required to add entry in expected replies list if
++ * this is a method call
++ */
++ if (!bus_deferred_message_check_message_limits(dispatched_deferred_message, error))
++ return BUS_RESULT_FALSE;
++
++ if (!bus_deferred_message_expect_method_reply(dispatched_deferred_message, transaction, error))
++ return BUS_RESULT_FALSE;
++ }
++ else if (result == BUS_RESULT_FALSE)
++ {
++ bus_deferred_message_create_error(dispatched_deferred_message, "Rejected message", error);
++ return BUS_RESULT_FALSE;
++ }
++ }
++ else
++ result = BUS_RESULT_LATER;
++
++ if (result == BUS_RESULT_LATER)
++ result = bus_context_check_security_policy(context, transaction,
++ sender, addressed_recipient, addressed_recipient, message, error,
++ &deferred_message);
++
++ if (result == BUS_RESULT_FALSE)
+ return BUS_RESULT_FALSE;
+- else if (res == BUS_RESULT_LATER)
++ else if (result == BUS_RESULT_LATER)
+ {
+ BusDeferredMessageStatus status;
++
++ if (dispatched_deferred_message != NULL)
++ {
++ /* for deferred dispatch prepend message at the recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, TRUE))
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
++ }
++
+ status = bus_deferred_message_get_status(deferred_message);
+
+ if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND)
+@@ -131,13 +205,18 @@ bus_dispatch_matches (BusTransaction *transaction,
+ }
+ else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE)
+ {
+- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- return BUS_RESULT_FALSE;
++ /* receive rule result not available - queue message at the recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE))
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
+ }
+ else
+ {
+- _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n");
++ _dbus_verbose("deferred message has no status field set unexpectedly\n");
+ return BUS_RESULT_FALSE;
+ }
+ }
+@@ -154,7 +233,8 @@ bus_dispatch_matches (BusTransaction *transaction,
+ }
+
+ /* Dispatch the message */
+- if (!bus_transaction_send (transaction, addressed_recipient, message))
++ if (!bus_transaction_send(transaction, addressed_recipient, message,
++ dispatched_deferred_message != NULL ? TRUE : FALSE))
+ {
+ BUS_SET_OOM (error);
+ return BUS_RESULT_FALSE;
+@@ -385,7 +465,7 @@ bus_dispatch (DBusConnection *connection,
+ * match rules.
+ */
+ if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient,
+- message, &error))
++ message, NULL, &error))
+ {
+ /* Roll back and dispatch the message once the policy result is available */
+ bus_transaction_cancel_and_free (transaction);
+diff --git a/bus/dispatch.h b/bus/dispatch.h
+index afba6a2..f6102e8 100644
+--- a/bus/dispatch.h
++++ b/bus/dispatch.h
+@@ -29,10 +29,11 @@
+
+ dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection);
+ void bus_dispatch_remove_connection (DBusConnection *connection);
+-BusResult bus_dispatch_matches (BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *recipient,
+- DBusMessage *message,
+- DBusError *error);
++BusResult bus_dispatch_matches (BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *recipient,
++ DBusMessage *message,
++ BusDeferredMessage *dispatched_deferred_message,
++ DBusError *error);
+
+ #endif /* BUS_DISPATCH_H */
+diff --git a/bus/driver.c b/bus/driver.c
+index 4dbce3d..2fb1385 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -130,7 +130,7 @@ bus_driver_send_service_owner_changed (const char *service_name,
+
+ _dbus_assert (dbus_message_has_signature (message, "sss"));
+
+- res = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ res = bus_dispatch_matches (transaction, NULL, NULL, message, NULL, error);
+ if (res == BUS_RESULT_TRUE)
+ retval = TRUE;
+ else if (res == BUS_RESULT_FALSE)
+diff --git a/bus/policy.c b/bus/policy.c
+index ec888df..448147f 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -1071,6 +1071,9 @@ bus_client_policy_check_can_send (DBusConnection *sender,
+
+ result = bus_check_privilege(check, message, sender, addressed_recipient, receiver,
+ privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message);
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply,
++ *toggles, privilege);
+ }
+ else
+ privilege = NULL;
+@@ -1305,6 +1308,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+
+ result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient,
+ privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message);
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply,
++ *toggles, privilege);
+ }
+ else
+ privilege = NULL;
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0007-Add-own-rule-result-unavailability-handling.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0007-Add-own-rule-result-unavailability-handling.patch
new file mode 100644
index 000000000..e1b1e62f1
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0007-Add-own-rule-result-unavailability-handling.patch
@@ -0,0 +1,1142 @@
+From 35ef89cd6777ea2430077fc621d21bd01df92349 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Thu, 27 Nov 2014 11:26:21 +0100
+Subject: [PATCH 7/8] Add own rule result unavailability handling
+
+Own rule result unavailability is handled like send rules - dispatching
+messages from the sender is blocked and resumed when result becomes
+available.
+
+Handler of "RequestName" method needs to return BUS_RESULT_LATER when
+policy result is not known therefore its return type is modified.
+Since bus message handlers are put into function pointer array other
+message handler function singatures are also affected.
+
+Change-Id: I4c2cbd4585e41fccd8a30f825a8f0d342ab56755
+---
+ bus/dispatch.c | 11 ++-
+ bus/driver.c | 227 ++++++++++++++++++++++++++++++---------------------------
+ bus/driver.h | 2 +-
+ bus/policy.c | 51 ++++++++++---
+ bus/policy.h | 6 +-
+ bus/services.c | 26 +++++--
+ bus/services.h | 3 +-
+ bus/stats.c | 16 ++--
+ 8 files changed, 204 insertions(+), 138 deletions(-)
+
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index 9972e76..d3b970f 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -404,8 +404,17 @@ bus_dispatch (DBusConnection *connection,
+ }
+
+ _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
+- if (!bus_driver_handle_message (connection, transaction, message, &error))
++ res = bus_driver_handle_message (connection, transaction, message, &error);
++ if (res == BUS_RESULT_FALSE)
+ goto out;
++ else if (res == BUS_RESULT_LATER)
++ {
++ /* connection has been disabled in message handler */
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
++ goto out;
++ }
+ }
+ else if (!bus_connection_is_active (connection)) /* clients must talk to bus driver first */
+ {
+diff --git a/bus/driver.c b/bus/driver.c
+index 2fb1385..9708f49 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -297,7 +297,7 @@ create_unique_client_name (BusRegistry *registry,
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_hello (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -305,7 +305,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ {
+ DBusString unique_name;
+ BusService *service;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+ BusConnections *connections;
+
+@@ -316,7 +316,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ /* We already handled an Hello message for this connection. */
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Already handled an Hello message");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /* Note that when these limits are exceeded we don't disconnect the
+@@ -330,16 +330,16 @@ bus_driver_handle_hello (DBusConnection *connection,
+ error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!_dbus_string_init (&unique_name))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ registry = bus_connection_get_registry (connection);
+
+@@ -372,7 +372,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ goto out_0;
+
+ _dbus_assert (bus_connection_is_active (connection));
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out_0:
+ _dbus_string_free (&unique_name);
+@@ -424,7 +424,7 @@ bus_driver_send_welcome_message (DBusConnection *connection,
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_services (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -446,14 +446,14 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ if (reply == NULL)
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_registry_list_services (registry, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ dbus_message_iter_init_append (reply, &iter);
+@@ -465,7 +465,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ {
+@@ -477,7 +477,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -490,7 +490,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ ++i;
+ }
+@@ -501,23 +501,23 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_transaction_send_from_driver (transaction, connection, reply))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+ {
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -539,14 +539,14 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ if (reply == NULL)
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_activation_list_services (activation, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ dbus_message_iter_init_append (reply, &iter);
+@@ -558,7 +558,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ {
+@@ -570,7 +570,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -583,7 +583,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ ++i;
+ }
+@@ -594,23 +594,23 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_transaction_send_from_driver (transaction, connection, reply))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+ {
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_acquire_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -621,7 +621,8 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ const char *name;
+ dbus_uint32_t service_reply;
+ dbus_uint32_t flags;
+- dbus_bool_t retval;
++ BusResult retval;
++ BusResult res;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -632,20 +633,24 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_UINT32, &flags,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+ reply = NULL;
+
+ _dbus_string_init_const (&service_name, name);
+
+- if (!bus_registry_acquire_service (registry, connection,
+- &service_name, flags,
+- &service_reply, transaction,
+- error))
+- goto out;
++ res = bus_registry_acquire_service (registry, connection, message,
++ &service_name, flags,
++ &service_reply, transaction,
++ error);
++ if (res != BUS_RESULT_TRUE)
++ {
++ retval = res;
++ goto out;
++ }
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+@@ -666,7 +671,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -674,7 +679,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_release_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -684,7 +689,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ DBusString service_name;
+ const char *name;
+ dbus_uint32_t service_reply;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -694,11 +699,11 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ if (!dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_verbose ("Trying to release name %s\n", name);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+ reply = NULL;
+
+ _dbus_string_init_const (&service_name, name);
+@@ -727,7 +732,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -735,7 +740,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_service_exists (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -746,7 +751,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ BusService *service;
+ dbus_bool_t service_exists;
+ const char *name;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -756,9 +761,9 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ if (!dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (strcmp (name, DBUS_SERVICE_DBUS) == 0)
+ {
+@@ -792,7 +797,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -801,7 +806,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_activate_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -809,7 +814,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ {
+ dbus_uint32_t flags;
+ const char *name;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusActivation *activation;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -823,10 +828,10 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_verbose ("No memory to get arguments to StartServiceByName\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (!bus_activation_activate_service (activation, connection, transaction, FALSE,
+ message, name, error))
+@@ -836,7 +841,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ return retval;
+@@ -872,13 +877,13 @@ send_ack_reply (DBusConnection *connection,
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+ {
+- dbus_bool_t retval;
++ BusResult retval;
+ BusActivation *activation;
+ DBusMessageIter iter;
+ DBusMessageIter dict_iter;
+@@ -939,7 +944,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+
+ dbus_message_iter_recurse (&iter, &dict_iter);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ /* Then loop through the sent dictionary, add the location of
+ * the environment keys and values to lists. The result will
+@@ -1026,7 +1031,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ message, error))
+ goto out;
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ _dbus_list_clear (&keys);
+@@ -1034,7 +1039,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_add_match (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1093,16 +1098,16 @@ bus_driver_handle_add_match (DBusConnection *connection,
+
+ bus_match_rule_unref (rule);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (rule)
+ bus_match_rule_unref (rule);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_remove_match (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1146,16 +1151,16 @@ bus_driver_handle_remove_match (DBusConnection *connection,
+
+ bus_match_rule_unref (rule);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (rule)
+ bus_match_rule_unref (rule);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_service_owner (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1225,7 +1230,7 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1234,10 +1239,10 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1328,7 +1333,7 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1341,10 +1346,10 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+ if (base_names)
+ _dbus_list_clear (&base_names);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1389,7 +1394,7 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1398,10 +1403,10 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1446,7 +1451,7 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1455,10 +1460,10 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1502,7 +1507,7 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1511,10 +1516,10 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1556,7 +1561,7 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1565,10 +1570,10 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1645,7 +1650,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1659,10 +1664,10 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ dbus_message_unref (reply);
+ }
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_reload_config (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1687,7 +1692,7 @@ bus_driver_handle_reload_config (DBusConnection *connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1696,10 +1701,10 @@ bus_driver_handle_reload_config (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_id (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1715,7 +1720,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
+ if (!_dbus_string_init (&uuid))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ reply = NULL;
+@@ -1741,7 +1746,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
+
+ _dbus_string_free (&uuid);
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -1751,7 +1756,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
+ if (reply)
+ dbus_message_unref (reply);
+ _dbus_string_free (&uuid);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ typedef struct
+@@ -1759,10 +1764,10 @@ typedef struct
+ const char *name;
+ const char *in_args;
+ const char *out_args;
+- dbus_bool_t (* handler) (DBusConnection *connection,
+- BusTransaction *transaction,
+- DBusMessage *message,
+- DBusError *error);
++ BusResult (* handler) (DBusConnection *connection,
++ BusTransaction *transaction,
++ DBusMessage *message,
++ DBusError *error);
+ } MessageHandler;
+
+ /* For speed it might be useful to sort this in order of
+@@ -1847,7 +1852,7 @@ static const MessageHandler dbus_message_handlers[] = {
+ { NULL, NULL, NULL, NULL }
+ };
+
+-static dbus_bool_t bus_driver_handle_introspect (DBusConnection *,
++static BusResult bus_driver_handle_introspect (DBusConnection *,
+ BusTransaction *, DBusMessage *, DBusError *);
+
+ static const MessageHandler introspectable_message_handlers[] = {
+@@ -1973,7 +1978,7 @@ bus_driver_generate_introspect_string (DBusString *xml)
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_introspect (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1993,13 +1998,13 @@ bus_driver_handle_introspect (DBusConnection *connection,
+ DBUS_TYPE_INVALID))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!_dbus_string_init (&xml))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_driver_generate_introspect_string (&xml))
+@@ -2022,7 +2027,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
+ dbus_message_unref (reply);
+ _dbus_string_free (&xml);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -2032,7 +2037,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
+
+ _dbus_string_free (&xml);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /*
+@@ -2067,7 +2072,7 @@ bus_driver_check_message_is_for_us (DBusMessage *message,
+ return TRUE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_driver_handle_message (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2077,6 +2082,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ const InterfaceHandler *ih;
+ const MessageHandler *mh;
+ dbus_bool_t found_interface = FALSE;
++ BusResult res;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+@@ -2085,13 +2091,13 @@ bus_driver_handle_message (DBusConnection *connection,
+ BusContext *context;
+
+ context = bus_connection_get_context (connection);
+- return dbus_activation_systemd_failure(bus_context_get_activation(context), message);
++ return dbus_activation_systemd_failure(bus_context_get_activation(context), message) == TRUE ? BUS_RESULT_TRUE : BUS_RESULT_FALSE;
+ }
+
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
+ {
+ _dbus_verbose ("Driver got a non-method-call message, ignoring\n");
+- return TRUE; /* we just ignore this */
++ return BUS_RESULT_TRUE; /* we just ignore this */
+ }
+
+ /* may be NULL, which means "any interface will do" */
+@@ -2133,20 +2139,27 @@ bus_driver_handle_message (DBusConnection *connection,
+ name, dbus_message_get_signature (message),
+ mh->in_args);
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- if ((* mh->handler) (connection, transaction, message, error))
++ res = (* mh->handler) (connection, transaction, message, error);
++ if (res == BUS_RESULT_TRUE)
+ {
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ _dbus_verbose ("Driver handler succeeded\n");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+- else
++ else if (res == BUS_RESULT_FALSE)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_verbose ("Driver handler returned failure\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
++ _dbus_verbose ("Driver handler delayed message processing due to policy check\n");
++ return BUS_RESULT_LATER;
+ }
+ }
+ }
+@@ -2158,7 +2171,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ "%s does not understand message %s",
+ DBUS_SERVICE_DBUS, name);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ void
+diff --git a/bus/driver.h b/bus/driver.h
+index 201709c..3ff4ff1 100644
+--- a/bus/driver.h
++++ b/bus/driver.h
+@@ -28,7 +28,7 @@
+ #include "connection.h"
+
+ void bus_driver_remove_connection (DBusConnection *connection);
+-dbus_bool_t bus_driver_handle_message (DBusConnection *connection,
++BusResult bus_driver_handle_message (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+diff --git a/bus/policy.c b/bus/policy.c
+index 448147f..3672ff9 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -1323,18 +1323,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+
+
+
+-static dbus_bool_t
++static BusResult
+ bus_rules_check_can_own (DBusList *rules,
+- const DBusString *service_name)
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
++ BusResult result;
++ const char *privilege;
+
+ /* rules is in the order the rules appeared
+ * in the config file, i.e. last rule that applies wins
+ */
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&rules);
+ while (link != NULL)
+ {
+@@ -1370,17 +1373,45 @@ bus_rules_check_can_own (DBusList *rules,
+ }
+
+ /* Use this rule */
+- allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
+ }
+
+- return allowed;
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(connection);
++ BusCheck *check = bus_context_get_check(context);
++ BusDeferredMessage *deferred_message;
++
++ result = bus_check_privilege(check, message, connection, NULL, NULL,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_OWN, &deferred_message);
++ if (result == BUS_RESULT_LATER)
++ {
++ bus_deferred_message_disable_sender(deferred_message);
++ }
++ }
++
++ return result;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_client_policy_check_can_own (BusClientPolicy *policy,
+- const DBusString *service_name)
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message)
+ {
+- return bus_rules_check_can_own (policy->rules, service_name);
++ return bus_rules_check_can_own (policy->rules, service_name, connection, message);
+ }
+
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+@@ -1388,7 +1419,7 @@ dbus_bool_t
+ bus_policy_check_can_own (BusPolicy *policy,
+ const DBusString *service_name)
+ {
+- return bus_rules_check_can_own (policy->default_rules, service_name);
++ return bus_rules_check_can_own (policy->default_rules, service_name, NULL, NULL);
+ }
+ #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
+
+diff --git a/bus/policy.h b/bus/policy.h
+index e9f193a..1f23431 100644
+--- a/bus/policy.h
++++ b/bus/policy.h
+@@ -170,8 +170,10 @@ BusResult bus_client_policy_check_can_receive (BusClientPolicy *polic
+ dbus_int32_t *toggles,
+ const char **privilege_param,
+ BusDeferredMessage **deferred_message);
+-dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy,
+- const DBusString *service_name);
++BusResult bus_client_policy_check_can_own (BusClientPolicy *policy,
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message);
+ dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy,
+ BusPolicyRule *rule);
+ void bus_client_policy_optimize (BusClientPolicy *policy);
+diff --git a/bus/services.c b/bus/services.c
+index 584485b..f25fdf3 100644
+--- a/bus/services.c
++++ b/bus/services.c
+@@ -374,24 +374,26 @@ bus_registry_list_services (BusRegistry *registry,
+ return FALSE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_registry_acquire_service (BusRegistry *registry,
+ DBusConnection *connection,
++ DBusMessage *message,
+ const DBusString *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+ BusTransaction *transaction,
+ DBusError *error)
+ {
+- dbus_bool_t retval;
++ BusResult retval;
+ DBusConnection *old_owner_conn;
+ BusClientPolicy *policy;
+ BusService *service;
+ BusActivation *activation;
+ BusSELinuxID *sid;
+ BusOwner *primary_owner;
++ BusResult res;
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (!_dbus_validate_bus_name (service_name, 0,
+ _dbus_string_get_length (service_name)))
+@@ -459,7 +461,8 @@ bus_registry_acquire_service (BusRegistry *registry,
+ goto out;
+ }
+
+- if (!bus_client_policy_check_can_own (policy, service_name))
++ res = bus_client_policy_check_can_own (policy, service_name, connection, message);
++ if (res == BUS_RESULT_FALSE)
+ {
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Connection \"%s\" is not allowed to own the service \"%s\" due "
+@@ -470,6 +473,11 @@ bus_registry_acquire_service (BusRegistry *registry,
+ _dbus_string_get_const_data (service_name));
+ goto out;
+ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ retval = BUS_RESULT_LATER;
++ goto out;
++ }
+
+ if (bus_connection_get_n_services_owned (connection) >=
+ bus_context_get_max_services_per_connection (registry->context))
+@@ -586,11 +594,13 @@ bus_registry_acquire_service (BusRegistry *registry,
+ }
+
+ activation = bus_context_get_activation (registry->context);
+- retval = bus_activation_send_pending_auto_activation_messages (activation,
++
++ if (bus_activation_send_pending_auto_activation_messages (activation,
+ service,
+- transaction);
+- if (!retval)
+- BUS_SET_OOM (error);
++ transaction))
++ retval = BUS_RESULT_TRUE;
++ else
++ BUS_SET_OOM (error);
+
+ out:
+ return retval;
+diff --git a/bus/services.h b/bus/services.h
+index 056dd9f..3df3dd7 100644
+--- a/bus/services.h
++++ b/bus/services.h
+@@ -50,8 +50,9 @@ void bus_registry_foreach (BusRegistry *registry
+ dbus_bool_t bus_registry_list_services (BusRegistry *registry,
+ char ***listp,
+ int *array_len);
+-dbus_bool_t bus_registry_acquire_service (BusRegistry *registry,
++BusResult bus_registry_acquire_service (BusRegistry *registry,
+ DBusConnection *connection,
++ DBusMessage *message,
+ const DBusString *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+diff --git a/bus/stats.c b/bus/stats.c
+index 20321e5..61dc428 100644
+--- a/bus/stats.c
++++ b/bus/stats.c
+@@ -35,7 +35,7 @@
+
+ #ifdef DBUS_ENABLE_STATS
+
+-dbus_bool_t
++BusResult
+ bus_stats_handle_get_stats (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -106,17 +106,17 @@ bus_stats_handle_get_stats (DBusConnection *connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -143,7 +143,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ if (! dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &bus_name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_string_init_const (&bus_name_str, bus_name);
+ service = bus_registry_lookup (registry, &bus_name_str);
+@@ -152,7 +152,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ {
+ dbus_set_error (error, DBUS_ERROR_NAME_HAS_NO_OWNER,
+ "Bus name '%s' has no owner", bus_name);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ stats_connection = bus_service_get_primary_owners_connection (service);
+@@ -214,14 +214,14 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ #endif
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/0008-Add-GetConnectionSmackContext-D-Bus-daemon-method.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0008-Add-GetConnectionSmackContext-D-Bus-daemon-method.patch
new file mode 100644
index 000000000..43a1ef658
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/0008-Add-GetConnectionSmackContext-D-Bus-daemon-method.patch
@@ -0,0 +1,99 @@
+From 6c9997fb1cdff4281166e8c2fb8276018b1025dd Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Mon, 15 Jun 2015 11:46:47 +0200
+Subject: [PATCH 8/8] Add "GetConnectionSmackContext" D-Bus daemon method
+
+This method is used to obtain smack label of given D-Bus client.
+Note that it is deprecated and is included only for compatilibity with
+existing D-Bus users. GetConnectionCredentials should be used to obtain
+client's credentials.
+
+Change-Id: Idf9648032ca5cbd9605ffab055e6384baa4eb9b4
+---
+ bus/driver.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 63 insertions(+)
+
+diff --git a/bus/driver.c b/bus/driver.c
+index 9708f49..4e76224 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -1759,6 +1759,65 @@ bus_driver_handle_get_id (DBusConnection *connection,
+ return BUS_RESULT_FALSE;
+ }
+
++static BusResult
++bus_driver_handle_get_connection_smack_context (DBusConnection *connection,
++ BusTransaction *transaction,
++ DBusMessage *message,
++ DBusError *error)
++{
++ DBusConnection *conn;
++ DBusMessage *reply = NULL;
++ char *label = NULL;
++ const char *service;
++
++ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
++
++ conn = bus_driver_get_conn_helper (connection, message, "credentials",
++ &service, error);
++ if (conn == NULL)
++ goto err;
++
++ reply = dbus_message_new_method_return (message);
++ if (reply == NULL)
++ goto oom;
++
++ if (!_dbus_connection_get_linux_security_label (conn, &label))
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED,
++ "Failed to get smack label of connection",
++ conn);
++ goto err;
++ }
++
++ if (label == NULL)
++ goto oom;
++
++ if (!dbus_message_append_args (reply,
++ DBUS_TYPE_STRING, &label,
++ DBUS_TYPE_INVALID))
++ goto oom;
++
++ if (!bus_transaction_send_from_driver (transaction, connection, reply))
++ goto oom;
++
++ dbus_message_unref (reply);
++ dbus_free(label);
++
++ return BUS_RESULT_TRUE;
++
++oom:
++ BUS_SET_OOM (error);
++
++err:
++ if (reply != NULL)
++ dbus_message_unref (reply);
++
++ dbus_free(label);
++
++ return BUS_RESULT_FALSE;
++}
++
++
+ typedef struct
+ {
+ const char *name;
+@@ -1849,6 +1908,10 @@ static const MessageHandler dbus_message_handlers[] = {
+ bus_driver_handle_get_id },
+ { "GetConnectionCredentials", "s", "a{sv}",
+ bus_driver_handle_get_connection_credentials },
++ { "GetConnectionSmackContext", /* deprecated - you should use GetConnectionCredentials instead */
++ DBUS_TYPE_STRING_AS_STRING,
++ DBUS_TYPE_STRING_AS_STRING,
++ bus_driver_handle_get_connection_smack_context },
+ { NULL, NULL, NULL, NULL }
+ };
+
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus-cynara/Perform-Cynara-runtime-policy-checks-by-default.patch b/meta-security/recipes-core/dbus-cynara/dbus-cynara/Perform-Cynara-runtime-policy-checks-by-default.patch
new file mode 100644
index 000000000..e573fb3b3
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus-cynara/Perform-Cynara-runtime-policy-checks-by-default.patch
@@ -0,0 +1,116 @@
+From e8610297cf7031e94eb314a2e8c11246f4405403 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Tue, 23 Jun 2015 11:08:48 +0200
+Subject: [PATCH] Perform Cynara runtime policy checks by default
+
+This change introduces http://tizen.org/privilege/internal/dbus privilege
+which is supposed to be available only to trusted system resources.
+Checks for this privilege are used in place of certain allow rules to
+make security policy more strict.
+
+For system bus sending and receiving signals now requires
+http://tizen.org/privilege/internal/dbus privilege. Requesting name
+ownership and sending methods is still denied by default.
+
+For session bus http://tizen.org/privilege/internal/dbus privilege
+is now required for requesting name, calling methods, sending and receiving
+signals.
+
+Services are supposed to override these default settings to implement their
+own security policy.
+
+Change-Id: Ifb4a160bf6e0638404e0295a2e4fa3077efd881c
+Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+---
+ bus/session.conf.in | 32 ++++++++++++++++++++++++++------
+ bus/system.conf.in | 22 ++++++++++++++++------
+ 2 files changed, 42 insertions(+), 12 deletions(-)
+
+diff --git a/bus/session.conf.in b/bus/session.conf.in
+index 74d9d1f..fa5c232 100644
+--- a/bus/session.conf.in
++++ b/bus/session.conf.in
+@@ -17,12 +17,32 @@
+ <standard_session_servicedirs />
+
+ <policy context="default">
+- <!-- Allow everything to be sent -->
+- <allow send_destination="*" eavesdrop="true"/>
+- <!-- Allow everything to be received -->
+- <allow eavesdrop="true"/>
+- <!-- Allow anyone to own anything -->
+- <allow own="*"/>
++ <!-- By default clients require internal/dbus privilege to communicate
++ with D-Bus services and to claim name ownership. This is internal privilege that
++ is only accessible to trusted system services -->
++ <check own="*" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check send_type="method_call" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++
++ <!-- Reply messages (method returns, errors) are allowed
++ by default -->
++ <allow send_requested_reply="true" send_type="method_return"/>
++ <allow send_requested_reply="true" send_type="error"/>
++
++ <!-- All messages but signals may be received by default -->
++ <allow receive_type="method_call"/>
++ <allow receive_type="method_return"/>
++ <allow receive_type="error"/>
++
++ <!-- Allow anyone to talk to the message bus -->
++ <allow send_destination="org.freedesktop.DBus"/>
++ <allow receive_sender="org.freedesktop.DBus"/>
++
++ <!-- But disallow some specific bus services -->
++ <deny send_destination="org.freedesktop.DBus"
++ send_interface="org.freedesktop.DBus"
++ send_member="UpdateActivationEnvironment"/>
+ </policy>
+
+ <!-- Config files are placed here that among other things,
+diff --git a/bus/system.conf.in b/bus/system.conf.in
+index 92f4cc4..dd16947 100644
+--- a/bus/system.conf.in
++++ b/bus/system.conf.in
+@@ -50,21 +50,31 @@
+ <deny own="*"/>
+ <deny send_type="method_call"/>
+
+- <!-- Signals and reply messages (method returns, errors) are allowed
++ <!-- By default clients require internal/dbus privilege to send and receive signaks.
++ This is internal privilege that is only accessible to trusted system services -->
++ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++
++ <!-- Reply messages (method returns, errors) are allowed
+ by default -->
+- <allow send_type="signal"/>
+ <allow send_requested_reply="true" send_type="method_return"/>
+ <allow send_requested_reply="true" send_type="error"/>
+
+- <!-- All messages may be received by default -->
++ <!-- All messages but signals may be received by default -->
+ <allow receive_type="method_call"/>
+ <allow receive_type="method_return"/>
+ <allow receive_type="error"/>
+- <allow receive_type="signal"/>
+
+- <!-- Allow anyone to talk to the message bus -->
++ <!-- If there is a need specific bus services could be protected by Cynara as well.
++ However, this can lead to deadlock during the boot process when such check is made and
++ Cynara is not yet activated (systemd calls protected method synchronously,
++ dbus daemon tries to consult Cynara, Cynara waits for systemd activation).
++ Therefore it is advised to allow root processes to use bus services.
++ Currently anyone is allowed to talk to the message bus -->
+ <allow send_destination="org.freedesktop.DBus"/>
+- <!-- But disallow some specific bus services -->
++ <allow receive_sender="org.freedesktop.DBus"/>
++
++ <!-- Disallow some specific bus services -->
+ <deny send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus"
+ send_member="UpdateActivationEnvironment"/>
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus/0001-Integration-of-Cynara-asynchronous-security-checks.patch b/meta-security/recipes-core/dbus-cynara/dbus/0001-Integration-of-Cynara-asynchronous-security-checks.patch
new file mode 100644
index 000000000..6a7e8a39d
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus/0001-Integration-of-Cynara-asynchronous-security-checks.patch
@@ -0,0 +1,2261 @@
+From 8f69153081140fa4c347ab1729c348ec77b309ec Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Thu, 27 Nov 2014 18:11:05 +0100
+Subject: [PATCH 1/5] Integration of Cynara asynchronous security checks
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This commit introduces basic framework for asynchronous policy
+checks and Cynara integration code. Functions for checking security
+policy can now return third value - BUS_RESULT_LATER denoting check
+result unavailability. Whenever policy checker cannot decide on the
+result of the check it is supposed to allocate DeferredMessage structure
+that will be passed to the upper layers which can decide what should be
+done in such situation.
+Proper handling of such case will be implemented in subsequent commits.
+Currently such return value results in message denial.
+
+Cherry picked from 4dcfb02f17247ff9de966b62182cd2e08f301238
+by José Bollo.
+
+Change-Id: I9bcbce34577e5dc2a3cecf6233a0a2b0e43e1108
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ bus/Makefile.am | 6 +
+ bus/bus.c | 136 +++++---
+ bus/bus.h | 32 +-
+ bus/check.c | 217 ++++++++++++
+ bus/check.h | 68 ++++
+ bus/config-parser-common.c | 6 +
+ bus/config-parser-common.h | 1 +
+ bus/config-parser.c | 71 +++-
+ bus/connection.c | 56 ++-
+ bus/connection.h | 4 +
+ bus/cynara.c | 374 +++++++++++++++++++++
+ bus/cynara.h | 37 ++
+ bus/dispatch.c | 44 ++-
+ bus/policy.c | 193 +++++++----
+ bus/policy.h | 51 ++-
+ configure.ac | 12 +
+ test/Makefile.am | 1 +
+ test/data/invalid-config-files/badcheck-1.conf | 9 +
+ test/data/invalid-config-files/badcheck-2.conf | 9 +
+ test/data/valid-config-files/check-1.conf | 9 +
+ .../valid-config-files/debug-check-some.conf.in | 18 +
+ tools/dbus-send.c | 2 +-
+ 22 files changed, 1193 insertions(+), 163 deletions(-)
+ create mode 100644 bus/check.c
+ create mode 100644 bus/check.h
+ create mode 100644 bus/cynara.c
+ create mode 100644 bus/cynara.h
+ create mode 100644 test/data/invalid-config-files/badcheck-1.conf
+ create mode 100644 test/data/invalid-config-files/badcheck-2.conf
+ create mode 100644 test/data/valid-config-files/check-1.conf
+ create mode 100644 test/data/valid-config-files/debug-check-some.conf.in
+
+diff --git a/bus/Makefile.am b/bus/Makefile.am
+index 33af09b0..3f57cc48 100644
+--- a/bus/Makefile.am
++++ b/bus/Makefile.am
+@@ -9,6 +9,7 @@ DBUS_BUS_LIBS = \
+ $(THREAD_LIBS) \
+ $(ADT_LIBS) \
+ $(NETWORK_libs) \
++ $(CYNARA_LIBS) \
+ $(NULL)
+
+ DBUS_LAUNCHER_LIBS = \
+@@ -24,6 +25,7 @@ AM_CPPFLAGS = \
+ $(APPARMOR_CFLAGS) \
+ -DDBUS_SYSTEM_CONFIG_FILE=\""$(dbusdatadir)/system.conf"\" \
+ -DDBUS_COMPILATION \
++ $(CYNARA_CFLAGS) \
+ $(NULL)
+
+ # if assertions are enabled, improve backtraces
+@@ -82,12 +84,16 @@ BUS_SOURCES= \
+ audit.h \
+ bus.c \
+ bus.h \
++ check.c \
++ check.h \
+ config-parser.c \
+ config-parser.h \
+ config-parser-common.c \
+ config-parser-common.h \
+ connection.c \
+ connection.h \
++ cynara.c \
++ cynara.h \
+ desktop-file.c \
+ desktop-file.h \
+ $(DIR_WATCH_SOURCE) \
+diff --git a/bus/bus.c b/bus/bus.c
+index fd4ab9e4..c4008505 100644
+--- a/bus/bus.c
++++ b/bus/bus.c
+@@ -37,6 +37,7 @@
+ #include "apparmor.h"
+ #include "audit.h"
+ #include "dir-watch.h"
++#include "check.h"
+ #include <dbus/dbus-list.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-credentials.h>
+@@ -65,6 +66,7 @@ struct BusContext
+ BusRegistry *registry;
+ BusPolicy *policy;
+ BusMatchmaker *matchmaker;
++ BusCheck *check;
+ BusLimits limits;
+ DBusRLimit *initial_fd_limit;
+ unsigned int fork : 1;
+@@ -988,6 +990,10 @@ bus_context_new (const DBusString *config_file,
+ parser = NULL;
+ }
+
++ context->check = bus_check_new(context, error);
++ if (context->check == NULL)
++ goto failed;
++
+ dbus_server_free_data_slot (&server_data_slot);
+
+ return context;
+@@ -1112,6 +1118,12 @@ bus_context_unref (BusContext *context)
+
+ bus_context_shutdown (context);
+
++ if (context->check)
++ {
++ bus_check_unref(context->check);
++ context->check = NULL;
++ }
++
+ if (context->connections)
+ {
+ bus_connections_unref (context->connections);
+@@ -1241,6 +1253,12 @@ bus_context_get_loop (BusContext *context)
+ return context->loop;
+ }
+
++BusCheck*
++bus_context_get_check (BusContext *context)
++{
++ return context->check;
++}
++
+ dbus_bool_t
+ bus_context_allow_unix_user (BusContext *context,
+ unsigned long uid)
+@@ -1456,6 +1474,7 @@ complain_about_message (BusContext *context,
+ DBusConnection *proposed_recipient,
+ dbus_bool_t requested_reply,
+ dbus_bool_t log,
++ const char *privilege,
+ DBusError *error)
+ {
+ DBusError stack_error = DBUS_ERROR_INIT;
+@@ -1485,7 +1504,8 @@ complain_about_message (BusContext *context,
+ dbus_set_error (&stack_error, error_name,
+ "%s, %d matched rules; type=\"%s\", sender=\"%s\" (%s) "
+ "interface=\"%s\" member=\"%s\" error name=\"%s\" "
+- "requested_reply=\"%d\" destination=\"%s\" (%s)",
++ "requested_reply=\"%d\" destination=\"%s\" (%s) "
++ "privilege=\"%s\"",
+ complaint,
+ matched_rules,
+ dbus_message_type_to_string (dbus_message_get_type (message)),
+@@ -1496,7 +1516,8 @@ complain_about_message (BusContext *context,
+ nonnull (dbus_message_get_error_name (message), "(unset)"),
+ requested_reply,
+ nonnull (dbus_message_get_destination (message), DBUS_SERVICE_DBUS),
+- proposed_recipient_loginfo);
++ proposed_recipient_loginfo,
++ nonnull (privilege, "(n/a)"));
+
+ /* If we hit OOM while setting the error, this will syslog "out of memory"
+ * which is itself an indication that something is seriously wrong */
+@@ -1520,14 +1541,15 @@ complain_about_message (BusContext *context,
+ * NULL for addressed_recipient may mean the bus driver, or may mean
+ * no destination was specified in the message (e.g. a signal).
+ */
+-dbus_bool_t
+-bus_context_check_security_policy (BusContext *context,
+- BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- DBusError *error)
++BusResult
++bus_context_check_security_policy (BusContext *context,
++ BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ DBusError *error,
++ BusDeferredMessage **deferred_message)
+ {
+ const char *src, *dest;
+ BusClientPolicy *sender_policy;
+@@ -1536,6 +1558,7 @@ bus_context_check_security_policy (BusContext *context,
+ dbus_bool_t log;
+ int type;
+ dbus_bool_t requested_reply;
++ const char *privilege;
+
+ type = dbus_message_get_type (message);
+ src = dbus_message_get_sender (message);
+@@ -1564,7 +1587,7 @@ bus_context_check_security_policy (BusContext *context,
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Message bus will not accept messages of unknown type\n");
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ requested_reply = FALSE;
+@@ -1594,7 +1617,7 @@ bus_context_check_security_policy (BusContext *context,
+ if (dbus_error_is_set (&error2))
+ {
+ dbus_move_error (&error2, error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+ }
+@@ -1621,11 +1644,11 @@ bus_context_check_security_policy (BusContext *context,
+ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+ "An SELinux policy prevents this sender from sending this "
+ "message to this recipient",
+- 0, message, sender, proposed_recipient, FALSE, FALSE, error);
++ 0, message, sender, proposed_recipient, FALSE, FALSE, NULL, error);
+ _dbus_verbose ("SELinux security check denying send to service\n");
+ }
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /* next verify AppArmor access controls. If allowed then
+@@ -1642,7 +1665,7 @@ bus_context_check_security_policy (BusContext *context,
+ dest ? dest : DBUS_SERVICE_DBUS,
+ src ? src : DBUS_SERVICE_DBUS,
+ error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ if (!bus_connection_is_active (sender))
+ {
+@@ -1656,7 +1679,7 @@ bus_context_check_security_policy (BusContext *context,
+ {
+ _dbus_verbose ("security check allowing %s message\n",
+ "Hello");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ else
+ {
+@@ -1667,7 +1690,7 @@ bus_context_check_security_policy (BusContext *context,
+ "Client tried to send a message other than %s without being registered",
+ "Hello");
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+ }
+@@ -1716,20 +1739,29 @@ bus_context_check_security_policy (BusContext *context,
+ (proposed_recipient == NULL && recipient_policy == NULL));
+
+ log = FALSE;
+- if (sender_policy &&
+- !bus_client_policy_check_can_send (sender_policy,
+- context->registry,
+- requested_reply,
+- proposed_recipient,
+- message, &toggles, &log))
+- {
+- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+- "Rejected send message", toggles,
+- message, sender, proposed_recipient, requested_reply,
+- (addressed_recipient == proposed_recipient), error);
+- _dbus_verbose ("security policy disallowing message due to sender policy\n");
+- return FALSE;
+- }
++ if (sender_policy)
++ {
++ BusResult res = bus_client_policy_check_can_send (sender,
++ sender_policy,
++ context->registry,
++ requested_reply,
++ addressed_recipient,
++ proposed_recipient,
++ message, &toggles, &log, &privilege,
++ deferred_message);
++ if (res == BUS_RESULT_FALSE)
++ {
++ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
++ "Rejected send message", toggles,
++ message, sender, proposed_recipient, requested_reply,
++ (addressed_recipient == proposed_recipient), privilege,
++ error);
++ _dbus_verbose ("security policy disallowing message due to sender policy\n");
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ return BUS_RESULT_LATER;
++ }
+
+ if (log)
+ {
+@@ -1738,23 +1770,29 @@ bus_context_check_security_policy (BusContext *context,
+ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+ "Would reject message", toggles,
+ message, sender, proposed_recipient, requested_reply,
+- TRUE, NULL);
++ TRUE, privilege, NULL);
+ }
+
+- if (recipient_policy &&
+- !bus_client_policy_check_can_receive (recipient_policy,
+- context->registry,
+- requested_reply,
+- sender,
+- addressed_recipient, proposed_recipient,
+- message, &toggles))
++ if (recipient_policy)
+ {
+- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED,
+- "Rejected receive message", toggles,
+- message, sender, proposed_recipient, requested_reply,
+- (addressed_recipient == proposed_recipient), error);
+- _dbus_verbose ("security policy disallowing message due to recipient policy\n");
+- return FALSE;
++ BusResult res;
++ res = bus_client_policy_check_can_receive (recipient_policy,
++ context->registry,
++ requested_reply,
++ sender,
++ addressed_recipient, proposed_recipient,
++ message, &toggles, &privilege, deferred_message);
++ if (res == BUS_RESULT_FALSE)
++ {
++ complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected receive message",
++ toggles, message, sender, proposed_recipient, requested_reply,
++ (addressed_recipient == proposed_recipient), privilege, error);
++ _dbus_verbose(
++ "security policy disallowing message due to recipient policy\n");
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ return BUS_RESULT_LATER;
+ }
+
+ /* See if limits on size have been exceeded */
+@@ -1764,10 +1802,10 @@ bus_context_check_security_policy (BusContext *context,
+ {
+ complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
+ "Rejected: destination has a full message queue",
+- 0, message, sender, proposed_recipient, requested_reply, TRUE,
++ 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL,
+ error);
+ _dbus_verbose ("security policy disallowing message due to full message queue\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /* Record that we will allow a reply here in the future (don't
+@@ -1784,11 +1822,11 @@ bus_context_check_security_policy (BusContext *context,
+ message, error))
+ {
+ _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ _dbus_verbose ("security policy allowing message\n");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+
+ void
+diff --git a/bus/bus.h b/bus/bus.h
+index 3fab59ff..dab7791f 100644
+--- a/bus/bus.h
++++ b/bus/bus.h
+@@ -44,6 +44,22 @@ typedef struct BusOwner BusOwner;
+ typedef struct BusTransaction BusTransaction;
+ typedef struct BusMatchmaker BusMatchmaker;
+ typedef struct BusMatchRule BusMatchRule;
++typedef struct BusCheck BusCheck;
++typedef struct BusDeferredMessage BusDeferredMessage;
++typedef struct BusCynara BusCynara;
++
++/**
++ * BusResult is defined as a pointer to a dummy structure to allow detection of type mismatches.
++ * The disadvantage of such solution is that now BusResult variables cannot be used in switch
++ * statement.
++ * Additionally, BUS_RESULT_TRUE is defined as 0 instead of 1 to help detect type mismatches
++ * at runtime.
++ */
++typedef const struct BusResultStruct { int dummy; } *BusResult;
++
++static const BusResult BUS_RESULT_TRUE = (BusResult)0x0;
++static const BusResult BUS_RESULT_FALSE = (BusResult)0x1;
++static const BusResult BUS_RESULT_LATER = (BusResult)0x2;
+
+ typedef struct
+ {
+@@ -97,6 +113,7 @@ BusConnections* bus_context_get_connections (BusContext
+ BusActivation* bus_context_get_activation (BusContext *context);
+ BusMatchmaker* bus_context_get_matchmaker (BusContext *context);
+ DBusLoop* bus_context_get_loop (BusContext *context);
++BusCheck * bus_context_get_check (BusContext *context);
+ dbus_bool_t bus_context_allow_unix_user (BusContext *context,
+ unsigned long uid);
+ dbus_bool_t bus_context_allow_windows_user (BusContext *context,
+@@ -131,13 +148,14 @@ void bus_context_log_and_set_error (BusContext
+ const char *name,
+ const char *msg,
+ ...) _DBUS_GNUC_PRINTF (5, 6);
+-dbus_bool_t bus_context_check_security_policy (BusContext *context,
+- BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- DBusError *error);
++BusResult bus_context_check_security_policy (BusContext *context,
++ BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ DBusError *error,
++ BusDeferredMessage **deferred_message);
+ void bus_context_check_all_watches (BusContext *context);
+
+ #endif /* BUS_BUS_H */
+diff --git a/bus/check.c b/bus/check.c
+new file mode 100644
+index 00000000..5b72d31c
+--- /dev/null
++++ b/bus/check.c
+@@ -0,0 +1,217 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* check.c Bus security policy runtime check
++ *
++ * Copyright (C) 2014 Intel, Inc.
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include <config.h>
++#include "check.h"
++#include "connection.h"
++#include "dispatch.h"
++#include "cynara.h"
++#include "utils.h"
++#include <dbus/dbus-connection-internal.h>
++#include <dbus/dbus-message-internal.h>
++#include <dbus/dbus-internals.h>
++
++
++typedef struct BusCheck
++{
++ int refcount;
++
++ BusContext *context;
++ BusCynara *cynara;
++} BusCheck;
++
++typedef struct BusDeferredMessage
++{
++ int refcount;
++
++ DBusMessage *message;
++ DBusConnection *sender;
++ DBusConnection *proposed_recipient;
++ DBusConnection *addressed_recipient;
++ dbus_bool_t full_dispatch;
++ BusDeferredMessageStatus status;
++ BusResult response;
++ BusCheckResponseFunc response_callback;
++} BusDeferredMessage;
++
++BusCheck *
++bus_check_new (BusContext *context, DBusError *error)
++{
++ BusCheck *check;
++
++ check = dbus_new(BusCheck, 1);
++ if (check == NULL)
++ {
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
++ check->refcount = 1;
++ check->context = context;
++ check->cynara = bus_cynara_new(check, error);
++ if (dbus_error_is_set(error))
++ {
++ dbus_free(check);
++ return NULL;
++ }
++
++ return check;
++}
++
++BusCheck *
++bus_check_ref (BusCheck *check)
++{
++ _dbus_assert (check->refcount > 0);
++ check->refcount += 1;
++
++ return check;
++}
++
++void
++bus_check_unref (BusCheck *check)
++{
++ _dbus_assert (check->refcount > 0);
++
++ check->refcount -= 1;
++
++ if (check->refcount == 0)
++ {
++ bus_cynara_unref(check->cynara);
++ dbus_free(check);
++ }
++}
++
++BusContext *
++bus_check_get_context (BusCheck *check)
++{
++ return check->context;
++}
++
++BusCynara *
++bus_check_get_cynara (BusCheck *check)
++{
++ return check->cynara;
++}
++
++BusResult
++bus_check_privilege (BusCheck *check,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message)
++{
++ BusResult result = BUS_RESULT_FALSE;
++#ifdef DBUS_ENABLE_CYNARA
++ BusCynara *cynara;
++#endif
++ DBusConnection *connection;
++
++ connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender;
++
++ if (!dbus_connection_get_is_connected(connection))
++ {
++ return BUS_RESULT_FALSE;
++ }
++
++ /* ask policy checkers */
++#ifdef DBUS_ENABLE_CYNARA
++ cynara = bus_check_get_cynara(check);
++ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
++ proposed_recipient, privilege, check_type, deferred_message);
++#endif
++
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ {
++ (*deferred_message)->status |= check_type;
++ }
++ return result;
++}
++
++BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ BusResult response)
++{
++ BusDeferredMessage *deferred_message;
++
++ deferred_message = dbus_new(BusDeferredMessage, 1);
++ if (deferred_message == NULL)
++ {
++ return NULL;
++ }
++
++ deferred_message->refcount = 1;
++ deferred_message->sender = sender != NULL ? dbus_connection_ref(sender) : NULL;
++ deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL;
++ deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL;
++ deferred_message->message = dbus_message_ref(message);
++ deferred_message->response = response;
++ deferred_message->status = 0;
++ deferred_message->full_dispatch = FALSE;
++ deferred_message->response_callback = NULL;
++
++ return deferred_message;
++}
++
++BusDeferredMessage *
++bus_deferred_message_ref (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert (deferred_message->refcount > 0);
++ deferred_message->refcount += 1;
++ return deferred_message;
++}
++
++void
++bus_deferred_message_unref (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert (deferred_message->refcount > 0);
++
++ deferred_message->refcount -= 1;
++
++ if (deferred_message->refcount == 0)
++ {
++ dbus_message_unref(deferred_message->message);
++ if (deferred_message->sender != NULL)
++ dbus_connection_unref(deferred_message->sender);
++ if (deferred_message->addressed_recipient != NULL)
++ dbus_connection_unref(deferred_message->addressed_recipient);
++ if (deferred_message->proposed_recipient != NULL)
++ dbus_connection_unref(deferred_message->proposed_recipient);
++ dbus_free(deferred_message);
++ }
++}
++
++void
++bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ if (deferred_message->response_callback != NULL)
++ {
++ deferred_message->response_callback(deferred_message, result);
++ }
++}
+diff --git a/bus/check.h b/bus/check.h
+new file mode 100644
+index 00000000..c3fcaf90
+--- /dev/null
++++ b/bus/check.h
+@@ -0,0 +1,68 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* check.h Bus security policy runtime check
++ *
++ * Copyright (C) 2014 Intel, Inc.
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#ifndef BUS_CHECK_H
++#define BUS_CHECK_H
++
++#include "bus.h"
++#include "policy.h"
++
++
++typedef void (*BusCheckResponseFunc) (BusDeferredMessage *message,
++ BusResult result);
++
++typedef enum {
++ BUS_DEFERRED_MESSAGE_CHECK_SEND = 1 << 0,
++ BUS_DEFERRED_MESSAGE_CHECK_RECEIVE = 1 << 1,
++ BUS_DEFERRED_MESSAGE_CHECK_OWN = 1 << 2,
++} BusDeferredMessageStatus;
++
++
++BusCheck *bus_check_new (BusContext *context,
++ DBusError *error);
++BusCheck *bus_check_ref (BusCheck *check);
++void bus_check_unref (BusCheck *check);
++
++BusContext *bus_check_get_context (BusCheck *check);
++BusCynara *bus_check_get_cynara (BusCheck *check);
++BusResult bus_check_privilege (BusCheck *check,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message);
++
++BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ BusResult response);
++
++BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message);
++void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
++void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
++ BusResult result);
++#endif /* BUS_CHECK_H */
+diff --git a/bus/config-parser-common.c b/bus/config-parser-common.c
+index 5db6b289..ea25f5e6 100644
+--- a/bus/config-parser-common.c
++++ b/bus/config-parser-common.c
+@@ -75,6 +75,10 @@ bus_config_parser_element_name_to_type (const char *name)
+ {
+ return ELEMENT_DENY;
+ }
++ else if (strcmp (name, "check") == 0)
++ {
++ return ELEMENT_CHECK;
++ }
+ else if (strcmp (name, "servicehelper") == 0)
+ {
+ return ELEMENT_SERVICEHELPER;
+@@ -159,6 +163,8 @@ bus_config_parser_element_type_to_name (ElementType type)
+ return "allow";
+ case ELEMENT_DENY:
+ return "deny";
++ case ELEMENT_CHECK:
++ return "check";
+ case ELEMENT_FORK:
+ return "fork";
+ case ELEMENT_PIDFILE:
+diff --git a/bus/config-parser-common.h b/bus/config-parser-common.h
+index 382a0141..9e026d10 100644
+--- a/bus/config-parser-common.h
++++ b/bus/config-parser-common.h
+@@ -36,6 +36,7 @@ typedef enum
+ ELEMENT_LIMIT,
+ ELEMENT_ALLOW,
+ ELEMENT_DENY,
++ ELEMENT_CHECK,
+ ELEMENT_FORK,
+ ELEMENT_PIDFILE,
+ ELEMENT_SERVICEDIR,
+diff --git a/bus/config-parser.c b/bus/config-parser.c
+index d9f6042c..a8c4ca5d 100644
+--- a/bus/config-parser.c
++++ b/bus/config-parser.c
+@@ -1172,7 +1172,7 @@ append_rule_from_element (BusConfigParser *parser,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+- dbus_bool_t allow,
++ BusPolicyRuleAccess access,
+ DBusError *error)
+ {
+ const char *log;
+@@ -1195,6 +1195,7 @@ append_rule_from_element (BusConfigParser *parser,
+ const char *own_prefix;
+ const char *user;
+ const char *group;
++ const char *privilege;
+
+ BusPolicyRule *rule;
+
+@@ -1222,6 +1223,7 @@ append_rule_from_element (BusConfigParser *parser,
+ "user", &user,
+ "group", &group,
+ "log", &log,
++ "privilege", &privilege,
+ NULL))
+ return FALSE;
+
+@@ -1230,6 +1232,7 @@ append_rule_from_element (BusConfigParser *parser,
+ receive_interface || receive_member || receive_error || receive_sender ||
+ receive_type || receive_path || eavesdrop ||
+ send_requested_reply || receive_requested_reply ||
++ privilege ||
+ own || own_prefix || user || group))
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+@@ -1246,7 +1249,30 @@ append_rule_from_element (BusConfigParser *parser,
+ element_name);
+ return FALSE;
+ }
+-
++
++ if (access == BUS_POLICY_RULE_ACCESS_CHECK)
++ {
++ if (privilege == NULL || !*privilege)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED,
++ "On element <%s>, you must specify the privilege to be checked.",
++ element_name);
++ return FALSE;
++ }
++ }
++ else
++ {
++ if (privilege != NULL && *privilege)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED,
++ "On element <%s>, privilege %s is used outside of a check rule.",
++ element_name, privilege);
++ return FALSE;
++ }
++ else
++ privilege = NULL; /* replace (potentially) empty string with NULL pointer, it wouldn't be used anyway */
++ }
++
+ /* Allowed combinations of elements are:
+ *
+ * base, must be all send or all receive:
+@@ -1420,7 +1446,7 @@ append_rule_from_element (BusConfigParser *parser,
+ return FALSE;
+ }
+
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1502,7 +1528,7 @@ append_rule_from_element (BusConfigParser *parser,
+ return FALSE;
+ }
+
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1532,7 +1558,7 @@ append_rule_from_element (BusConfigParser *parser,
+ }
+ else if (own || own_prefix)
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1558,7 +1584,7 @@ append_rule_from_element (BusConfigParser *parser,
+ {
+ if (IS_WILDCARD (user))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1573,7 +1599,7 @@ append_rule_from_element (BusConfigParser *parser,
+
+ if (_dbus_parse_unix_user_from_config (&username, &uid))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1590,7 +1616,7 @@ append_rule_from_element (BusConfigParser *parser,
+ {
+ if (IS_WILDCARD (group))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1605,7 +1631,7 @@ append_rule_from_element (BusConfigParser *parser,
+
+ if (_dbus_parse_unix_group_from_config (&groupname, &gid))
+ {
+- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow);
++ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access);
+ if (rule == NULL)
+ goto nomem;
+
+@@ -1629,6 +1655,10 @@ append_rule_from_element (BusConfigParser *parser,
+ _dbus_assert (pe != NULL);
+ _dbus_assert (pe->type == ELEMENT_POLICY);
+
++ rule->privilege = _dbus_strdup (privilege);
++ if (privilege && !rule->privilege)
++ goto nomem;
++
+ switch (pe->d.policy.type)
+ {
+ case POLICY_IGNORED:
+@@ -1703,7 +1733,7 @@ start_policy_child (BusConfigParser *parser,
+ {
+ if (!append_rule_from_element (parser, element_name,
+ attribute_names, attribute_values,
+- TRUE, error))
++ BUS_POLICY_RULE_ACCESS_ALLOW, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_ALLOW) == NULL)
+@@ -1718,7 +1748,7 @@ start_policy_child (BusConfigParser *parser,
+ {
+ if (!append_rule_from_element (parser, element_name,
+ attribute_names, attribute_values,
+- FALSE, error))
++ BUS_POLICY_RULE_ACCESS_DENY, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_DENY) == NULL)
+@@ -1727,6 +1757,21 @@ start_policy_child (BusConfigParser *parser,
+ return FALSE;
+ }
+
++ return TRUE;
++ }
++ else if (strcmp (element_name, "check") == 0)
++ {
++ if (!append_rule_from_element (parser, element_name,
++ attribute_names, attribute_values,
++ BUS_POLICY_RULE_ACCESS_CHECK, error))
++ return FALSE;
++
++ if (push_element (parser, ELEMENT_CHECK) == NULL)
++ {
++ BUS_SET_OOM (error);
++ return FALSE;
++ }
++
+ return TRUE;
+ }
+ else
+@@ -2088,6 +2133,7 @@ bus_config_parser_end_element (BusConfigParser *parser,
+ case ELEMENT_POLICY:
+ case ELEMENT_ALLOW:
+ case ELEMENT_DENY:
++ case ELEMENT_CHECK:
+ case ELEMENT_FORK:
+ case ELEMENT_SYSLOG:
+ case ELEMENT_KEEP_UMASK:
+@@ -2397,6 +2443,7 @@ bus_config_parser_content (BusConfigParser *parser,
+ case ELEMENT_POLICY:
+ case ELEMENT_ALLOW:
+ case ELEMENT_DENY:
++ case ELEMENT_CHECK:
+ case ELEMENT_FORK:
+ case ELEMENT_SYSLOG:
+ case ELEMENT_KEEP_UMASK:
+@@ -2862,6 +2909,8 @@ do_load (const DBusString *full_path,
+ dbus_error_init (&error);
+
+ parser = bus_config_load (full_path, TRUE, NULL, &error);
++ if (dbus_error_is_set (&error))
++ _dbus_verbose ("Failed to load file: %s\n", error.message);
+ if (parser == NULL)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (&error);
+diff --git a/bus/connection.c b/bus/connection.c
+index 02d6c220..eea50ecd 100644
+--- a/bus/connection.c
++++ b/bus/connection.c
+@@ -36,6 +36,10 @@
+ #include <dbus/dbus-timeout.h>
+ #include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-internals.h>
++#ifdef DBUS_ENABLE_CYNARA
++#include <stdlib.h>
++#include <cynara-session.h>
++#endif
+
+ /* Trim executed commands to this length; we want to keep logs readable */
+ #define MAX_LOG_COMMAND_LEN 50
+@@ -116,6 +120,9 @@ typedef struct
+
+ /** non-NULL if and only if this is a monitor */
+ DBusList *link_in_monitors;
++#ifdef DBUS_ENABLE_CYNARA
++ char *cynara_session_id;
++#endif
+ } BusConnectionData;
+
+ static dbus_bool_t bus_pending_reply_expired (BusExpireList *list,
+@@ -129,8 +136,8 @@ static dbus_bool_t expire_incomplete_timeout (void *data);
+
+ #define BUS_CONNECTION_DATA(connection) (dbus_connection_get_data ((connection), connection_data_slot))
+
+-static DBusLoop*
+-connection_get_loop (DBusConnection *connection)
++DBusLoop*
++bus_connection_get_loop (DBusConnection *connection)
+ {
+ BusConnectionData *d;
+
+@@ -354,7 +361,7 @@ add_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- return _dbus_loop_add_watch (connection_get_loop (connection), watch);
++ return _dbus_loop_add_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static void
+@@ -363,7 +370,7 @@ remove_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_remove_watch (connection_get_loop (connection), watch);
++ _dbus_loop_remove_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static void
+@@ -372,7 +379,7 @@ toggle_connection_watch (DBusWatch *watch,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_toggle_watch (connection_get_loop (connection), watch);
++ _dbus_loop_toggle_watch (bus_connection_get_loop (connection), watch);
+ }
+
+ static dbus_bool_t
+@@ -381,7 +388,7 @@ add_connection_timeout (DBusTimeout *timeout,
+ {
+ DBusConnection *connection = data;
+
+- return _dbus_loop_add_timeout (connection_get_loop (connection), timeout);
++ return _dbus_loop_add_timeout (bus_connection_get_loop (connection), timeout);
+ }
+
+ static void
+@@ -390,7 +397,7 @@ remove_connection_timeout (DBusTimeout *timeout,
+ {
+ DBusConnection *connection = data;
+
+- _dbus_loop_remove_timeout (connection_get_loop (connection), timeout);
++ _dbus_loop_remove_timeout (bus_connection_get_loop (connection), timeout);
+ }
+
+ static void
+@@ -451,6 +458,10 @@ free_connection_data (void *data)
+
+ dbus_free (d->name);
+
++#ifdef DBUS_ENABLE_CYNARA
++ free (d->cynara_session_id);
++#endif
++
+ dbus_free (d);
+ }
+
+@@ -1063,6 +1074,22 @@ bus_connection_get_policy (DBusConnection *connection)
+ return d->policy;
+ }
+
++#ifdef DBUS_ENABLE_CYNARA
++const char *bus_connection_get_cynara_session_id (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA (connection);
++ _dbus_assert (d != NULL);
++
++ if (d->cynara_session_id == NULL)
++ {
++ unsigned long pid;
++ if (dbus_connection_get_unix_process_id(connection, &pid))
++ d->cynara_session_id = cynara_session_from_pid(pid);
++ }
++ return d->cynara_session_id;
++}
++#endif
++
+ static dbus_bool_t
+ foreach_active (BusConnections *connections,
+ BusConnectionForeachFunction function,
+@@ -2289,6 +2316,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ DBusMessage *message)
+ {
+ DBusError error = DBUS_ERROR_INIT;
++ BusResult res;
+
+ /* We have to set the sender to the driver, and have
+ * to check security policy since it was not done in
+@@ -2326,9 +2354,11 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ * if we're actively capturing messages, it's nice to log that we
+ * tried to send it and did not allow ourselves to do so.
+ */
+- if (!bus_context_check_security_policy (bus_transaction_get_context (transaction),
+- transaction,
+- NULL, connection, connection, message, &error))
++ res = bus_context_check_security_policy (bus_transaction_get_context (transaction),
++ transaction,
++ NULL, connection, connection, message, &error,
++ NULL);
++ if (res == BUS_RESULT_FALSE)
+ {
+ if (!bus_transaction_capture_error_reply (transaction, &error, message))
+ {
+@@ -2342,6 +2372,12 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ dbus_error_free (&error);
+ return TRUE;
+ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n");
++ dbus_error_free (&error);
++ return TRUE;
++ }
+
+ return bus_transaction_send (transaction, connection, message);
+ }
+diff --git a/bus/connection.h b/bus/connection.h
+index 8c68d0a0..a6e5dfde 100644
+--- a/bus/connection.h
++++ b/bus/connection.h
+@@ -31,6 +31,7 @@
+ typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection,
+ void *data);
+
++DBusLoop* bus_connection_get_loop (DBusConnection *connection);
+
+ BusConnections* bus_connections_new (BusContext *context);
+ BusConnections* bus_connections_ref (BusConnections *connections);
+@@ -122,6 +123,9 @@ dbus_bool_t bus_connection_be_monitor (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusList **rules,
+ DBusError *error);
++#ifdef DBUS_ENABLE_CYNARA
++const char *bus_connection_get_cynara_session_id (DBusConnection *connection);
++#endif
+
+ /* transaction API so we can send or not send a block of messages as a whole */
+
+diff --git a/bus/cynara.c b/bus/cynara.c
+new file mode 100644
+index 00000000..57a4c45c
+--- /dev/null
++++ b/bus/cynara.c
+@@ -0,0 +1,374 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* cynara.c Cynara runtime privilege checking
++ *
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include <config.h>
++#include "cynara.h"
++#include "check.h"
++#include "utils.h"
++
++#include <stdio.h>
++
++#include <dbus/dbus.h>
++#include <dbus/dbus-watch.h>
++#include <dbus/dbus-connection-internal.h>
++#include <bus/connection.h>
++#ifdef DBUS_ENABLE_CYNARA
++#include <cynara-client-async.h>
++#endif
++
++
++#ifdef DBUS_ENABLE_CYNARA
++typedef struct BusCynara
++{
++ int refcount;
++
++ BusContext *context;
++ BusCheck *check;
++ cynara_async *cynara;
++ DBusWatch *cynara_watch;
++} BusCynara;
++
++#define USE_CYNARA_CACHE 1
++#ifdef USE_CYNARA_CACHE
++#define CYNARA_CACHE_SIZE 1000
++#endif
++
++static dbus_bool_t bus_cynara_watch_callback(DBusWatch *watch,
++ unsigned int flags,
++ void *data);
++
++static void status_callback(int old_fd,
++ int new_fd,
++ cynara_async_status status,
++ void *user_status_data);
++static void bus_cynara_check_response_callback (cynara_check_id check_id,
++ cynara_async_call_cause cause,
++ int response,
++ void *user_response_data);
++#endif
++
++
++BusCynara *
++bus_cynara_new(BusCheck *check, DBusError *error)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ BusContext *context;
++ BusCynara *cynara;
++ cynara_async_configuration *conf = NULL;
++ int ret;
++
++ cynara = dbus_new(BusCynara, 1);
++ if (cynara == NULL)
++ {
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
++ context = bus_check_get_context(check);
++
++ cynara->refcount = 1;
++ cynara->check = check;
++ cynara->context = context;
++ cynara->cynara_watch = NULL;
++
++ ret = cynara_async_configuration_create(&conf);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to create Cynara configuration");
++ goto out;
++ }
++
++#ifdef CYNARA_CACHE_SIZE
++ ret = cynara_async_configuration_set_cache_size(conf, CYNARA_CACHE_SIZE);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to Cynara cache size");
++ goto out;
++ }
++#endif
++
++ ret = cynara_async_initialize(&cynara->cynara, conf, &status_callback, cynara);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to initialize Cynara client");
++ goto out;
++ }
++
++out:
++ cynara_async_configuration_destroy(conf);
++ if (ret != CYNARA_API_SUCCESS)
++ {
++ dbus_free(cynara);
++ return NULL;
++ }
++
++ return cynara;
++#else
++ return NULL;
++#endif
++}
++
++BusCynara *
++bus_cynara_ref (BusCynara *cynara)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ _dbus_assert (cynara->refcount > 0);
++ cynara->refcount += 1;
++
++ return cynara;
++#else
++ return NULL;
++#endif
++}
++
++void
++bus_cynara_unref (BusCynara *cynara)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ _dbus_assert (cynara->refcount > 0);
++
++ cynara->refcount -= 1;
++
++ if (cynara->refcount == 0)
++ {
++ cynara_async_finish(cynara->cynara);
++ dbus_free(cynara);
++ }
++#endif
++}
++
++BusResult
++bus_cynara_check_privilege (BusCynara *cynara,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message_param)
++{
++#ifdef DBUS_ENABLE_CYNARA
++ int result;
++ unsigned long uid;
++ char *label;
++ const char *session_id;
++ char user[32];
++ cynara_check_id check_id;
++ DBusConnection *connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender;
++ BusDeferredMessage *deferred_message;
++ BusResult ret;
++
++ _dbus_assert(connection != NULL);
++
++ if (dbus_connection_get_unix_user(connection, &uid) == FALSE)
++ return BUS_RESULT_FALSE;
++
++ if (_dbus_connection_get_linux_security_label(connection, &label) == FALSE || label == NULL)
++ {
++ _dbus_warn("Failed to obtain security label for connection\n");
++ return BUS_RESULT_FALSE;
++ }
++
++ session_id = bus_connection_get_cynara_session_id (connection);
++ if (session_id == NULL)
++ {
++ ret = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ snprintf(user, sizeof(user), "%lu", uid);
++
++#if USE_CYNARA_CACHE
++ result = cynara_async_check_cache(cynara->cynara, label, session_id, user, privilege);
++#else
++ result = CYNARA_API_CACHE_MISS;
++#endif
++
++ switch (result)
++ {
++ case CYNARA_API_ACCESS_ALLOWED:
++ _dbus_verbose("Cynara: got ALLOWED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n",
++ label, session_id, user, privilege);
++ ret = BUS_RESULT_TRUE;
++ break;
++
++ case CYNARA_API_ACCESS_DENIED:
++ _dbus_verbose("Cynara: got DENIED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n",
++ label, session_id, user, privilege);
++ ret = BUS_RESULT_FALSE;
++ break;
++
++ case CYNARA_API_CACHE_MISS:
++ deferred_message = bus_deferred_message_new(message, sender, addressed_recipient,
++ proposed_recipient, BUS_RESULT_LATER);
++ if (deferred_message == NULL)
++ {
++ _dbus_verbose("Failed to allocate memory for deferred message\n");
++ ret = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ /* callback is supposed to unref deferred_message*/
++ result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id,
++ &bus_cynara_check_response_callback, deferred_message);
++ if (result == CYNARA_API_SUCCESS)
++ {
++ _dbus_verbose("Created Cynara request: client=%s session_id=%s user=%s privilege=%s check_id=%u "
++ "deferred_message=%p\n", label, session_id, user, privilege, (unsigned int)check_id, deferred_message);
++ if (deferred_message_param != NULL)
++ *deferred_message_param = deferred_message;
++ ret = BUS_RESULT_LATER;
++ }
++ else
++ {
++ _dbus_verbose("Error on cynara request create: %i\n", result);
++ bus_deferred_message_unref(deferred_message);
++ ret = BUS_RESULT_FALSE;
++ }
++ break;
++ default:
++ _dbus_verbose("Error when accessing Cynara cache: %i\n", result);
++ ret = BUS_RESULT_FALSE;
++ }
++out:
++ dbus_free(label);
++ return ret;
++
++#else
++ return BUS_RESULT_FALSE;
++#endif
++}
++
++
++
++#ifdef DBUS_ENABLE_CYNARA
++static void
++status_callback(int old_fd, int new_fd, cynara_async_status status,
++ void *user_status_data)
++{
++ BusCynara *cynara = (BusCynara *)user_status_data;
++ DBusLoop *loop = bus_context_get_loop(cynara->context);
++
++ if (cynara->cynara_watch != NULL)
++ {
++ _dbus_loop_remove_watch(loop, cynara->cynara_watch);
++ _dbus_watch_invalidate(cynara->cynara_watch);
++ _dbus_watch_unref(cynara->cynara_watch);
++ cynara->cynara_watch = NULL;
++ }
++
++ if (new_fd != -1)
++ {
++ unsigned int flags;
++ DBusWatch *watch;
++
++ switch (status)
++ {
++ case CYNARA_STATUS_FOR_READ:
++ flags = DBUS_WATCH_READABLE;
++ break;
++ case CYNARA_STATUS_FOR_RW:
++ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE;
++ break;
++ default:
++ /* Cynara passed unknown status - warn and add RW watch */
++ _dbus_verbose("Cynara passed unknown status value: 0x%08X\n", (unsigned int)status);
++ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE;
++ break;
++ }
++
++ watch = _dbus_watch_new(new_fd, flags, TRUE, &bus_cynara_watch_callback, cynara, NULL);
++ if (watch != NULL)
++ {
++ if (_dbus_loop_add_watch(loop, watch) == TRUE)
++ {
++ cynara->cynara_watch = watch;
++ return;
++ }
++
++ _dbus_watch_invalidate(watch);
++ _dbus_watch_unref(watch);
++ }
++
++ /* It seems like not much can be done at this point. Cynara events won't be processed
++ * until next Cynara function call triggering status callback */
++ _dbus_verbose("Failed to add dbus watch\n");
++ }
++}
++
++static dbus_bool_t
++bus_cynara_watch_callback(DBusWatch *watch,
++ unsigned int flags,
++ void *data)
++{
++ BusCynara *cynara = (BusCynara *)data;
++ int result = cynara_async_process(cynara->cynara);
++ if (result != CYNARA_API_SUCCESS)
++ _dbus_verbose("cynara_async_process returned %d\n", result);
++
++ return result != CYNARA_API_OUT_OF_MEMORY ? TRUE : FALSE;
++}
++
++static inline const char *
++call_cause_to_string(cynara_async_call_cause cause)
++{
++ switch (cause)
++ {
++ case CYNARA_CALL_CAUSE_ANSWER:
++ return "ANSWER";
++ case CYNARA_CALL_CAUSE_CANCEL:
++ return "CANCEL";
++ case CYNARA_CALL_CAUSE_FINISH:
++ return "FINSIH";
++ case CYNARA_CALL_CAUSE_SERVICE_NOT_AVAILABLE:
++ return "SERVICE NOT AVAILABLE";
++ default:
++ return "INVALID";
++ }
++}
++
++static void
++bus_cynara_check_response_callback (cynara_check_id check_id,
++ cynara_async_call_cause cause,
++ int response,
++ void *user_response_data)
++{
++ BusDeferredMessage *deferred_message = user_response_data;
++ BusResult result;
++
++ _dbus_verbose("Cynara callback: check_id=%u, cause=%s response=%i response_data=%p\n",
++ (unsigned int)check_id, call_cause_to_string(cause), response, user_response_data);
++
++ if (deferred_message == NULL)
++ return;
++
++ if (cause == CYNARA_CALL_CAUSE_ANSWER && response == CYNARA_API_ACCESS_ALLOWED)
++ result = BUS_RESULT_TRUE;
++ else
++ result = BUS_RESULT_FALSE;
++
++ bus_deferred_message_response_received(deferred_message, result);
++ bus_deferred_message_unref(deferred_message);
++}
++
++#endif /* DBUS_ENABLE_CYNARA */
+diff --git a/bus/cynara.h b/bus/cynara.h
+new file mode 100644
+index 00000000..c4728bb7
+--- /dev/null
++++ b/bus/cynara.h
+@@ -0,0 +1,37 @@
++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
++/* cynara.h Cynara runtime privilege checking
++ *
++ * Copyright (c) 2014 Samsung Electronics, Ltd.
++ *
++ * Licensed under the Academic Free License version 2.1
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include "bus.h"
++#include "check.h"
++
++BusCynara *bus_cynara_new (BusCheck *check, DBusError *error);
++BusCynara *bus_cynara_ref (BusCynara *cynara);
++void bus_cynara_unref (BusCynara *cynara);
++BusResult bus_cynara_check_privilege (BusCynara *cynara,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ const char *privilege,
++ BusDeferredMessageStatus check_type,
++ BusDeferredMessage **deferred_message);
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index edfa1b44..05be3bdf 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -25,6 +25,7 @@
+
+ #include <config.h>
+ #include "dispatch.h"
++#include "check.h"
+ #include "connection.h"
+ #include "driver.h"
+ #include "services.h"
+@@ -64,13 +65,17 @@ send_one_message (DBusConnection *connection,
+ DBusError *error)
+ {
+ DBusError stack_error = DBUS_ERROR_INIT;
++ BusDeferredMessage *deferred_message;
++ BusResult result;
+
+- if (!bus_context_check_security_policy (context, transaction,
++ result = bus_context_check_security_policy (context, transaction,
+ sender,
+ addressed_recipient,
+ connection,
+ message,
+- &stack_error))
++ &stack_error,
++ &deferred_message);
++ if (result != BUS_RESULT_TRUE)
+ {
+ if (!bus_transaction_capture_error_reply (transaction, &stack_error,
+ message))
+@@ -129,6 +134,7 @@ bus_dispatch_matches (BusTransaction *transaction,
+ BusMatchmaker *matchmaker;
+ DBusList *link;
+ BusContext *context;
++ BusDeferredMessage *deferred_message;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+@@ -144,11 +150,21 @@ bus_dispatch_matches (BusTransaction *transaction,
+ /* First, send the message to the addressed_recipient, if there is one. */
+ if (addressed_recipient != NULL)
+ {
+- if (!bus_context_check_security_policy (context, transaction,
+- sender, addressed_recipient,
+- addressed_recipient,
+- message, error))
++ BusResult res;
++ res = bus_context_check_security_policy (context, transaction,
++ sender, addressed_recipient,
++ addressed_recipient,
++ message, error,
++ &deferred_message);
++ if (res == BUS_RESULT_FALSE)
+ return FALSE;
++ else if (res == BUS_RESULT_LATER)
++ {
++ dbus_set_error (error,
++ DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ return FALSE;
++ }
+
+ if (dbus_message_contains_unix_fds (message) &&
+ !dbus_connection_can_send_type (addressed_recipient,
+@@ -379,12 +395,24 @@ bus_dispatch (DBusConnection *connection,
+ if (service_name &&
+ strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */
+ {
+- if (!bus_context_check_security_policy (context, transaction,
+- connection, NULL, NULL, message, &error))
++ BusDeferredMessage *deferred_message;
++ BusResult res;
++ res = bus_context_check_security_policy (context, transaction,
++ connection, NULL, NULL, message, &error,
++ &deferred_message);
++ if (res == BUS_RESULT_FALSE)
+ {
+ _dbus_verbose ("Security policy rejected message\n");
+ goto out;
+ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ dbus_set_error (&error,
++ DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ _dbus_verbose ("Security policy needs time to check policy. Dropping message\n");
++ goto out;
++ }
+
+ _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
+ if (!bus_driver_handle_message (connection, transaction, message, &error))
+diff --git a/bus/policy.c b/bus/policy.c
+index 082f3853..bcade176 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -22,6 +22,7 @@
+ */
+
+ #include <config.h>
++#include "check.h"
+ #include "policy.h"
+ #include "services.h"
+ #include "test.h"
+@@ -32,7 +33,7 @@
+
+ BusPolicyRule*
+ bus_policy_rule_new (BusPolicyRuleType type,
+- dbus_bool_t allow)
++ BusPolicyRuleAccess access)
+ {
+ BusPolicyRule *rule;
+
+@@ -42,7 +43,7 @@ bus_policy_rule_new (BusPolicyRuleType type,
+
+ rule->type = type;
+ rule->refcount = 1;
+- rule->allow = allow;
++ rule->access = access;
+
+ switch (rule->type)
+ {
+@@ -54,18 +55,19 @@ bus_policy_rule_new (BusPolicyRuleType type,
+ break;
+ case BUS_POLICY_RULE_SEND:
+ rule->d.send.message_type = DBUS_MESSAGE_TYPE_INVALID;
+-
+ /* allow rules default to TRUE (only requested replies allowed)
++ * check rules default to TRUE (only requested replies are checked)
+ * deny rules default to FALSE (only unrequested replies denied)
+ */
+- rule->d.send.requested_reply = rule->allow;
++ rule->d.send.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY;
+ break;
+ case BUS_POLICY_RULE_RECEIVE:
+ rule->d.receive.message_type = DBUS_MESSAGE_TYPE_INVALID;
+ /* allow rules default to TRUE (only requested replies allowed)
++ * check rules default to TRUE (only requested replies are checked)
+ * deny rules default to FALSE (only unrequested replies denied)
+ */
+- rule->d.receive.requested_reply = rule->allow;
++ rule->d.receive.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY;
+ break;
+ case BUS_POLICY_RULE_OWN:
+ break;
+@@ -117,7 +119,8 @@ bus_policy_rule_unref (BusPolicyRule *rule)
+ case BUS_POLICY_RULE_GROUP:
+ break;
+ }
+-
++
++ dbus_free (rule->privilege);
+ dbus_free (rule);
+ }
+ }
+@@ -427,7 +430,10 @@ list_allows_user (dbus_bool_t def,
+ else
+ continue;
+
+- allowed = rule->allow;
++ /* We don't intend to support <check user="..." /> and <check group="..." />
++ rules. They are treated like deny.
++ */
++ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
+ }
+
+ return allowed;
+@@ -862,18 +868,23 @@ bus_client_policy_append_rule (BusClientPolicy *policy,
+ return TRUE;
+ }
+
+-dbus_bool_t
+-bus_client_policy_check_can_send (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *receiver,
+- DBusMessage *message,
+- dbus_int32_t *toggles,
+- dbus_bool_t *log)
++BusResult
++bus_client_policy_check_can_send (DBusConnection *sender,
++ BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *addressed_recipient,
++ DBusConnection *receiver,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ dbus_bool_t *log,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
+-
++ BusResult result;
++ const char *privilege;
++
+ /* policy->rules is in the order the rules appeared
+ * in the config file, i.e. last rule that applies wins
+ */
+@@ -881,7 +892,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ _dbus_verbose (" (policy) checking send rules\n");
+ *toggles = 0;
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&policy->rules);
+ while (link != NULL)
+ {
+@@ -912,13 +923,14 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ /* If it's a reply, the requested_reply flag kicks in */
+ if (dbus_message_get_reply_serial (message) != 0)
+ {
+- /* for allow, requested_reply=true means the rule applies
+- * only when reply was requested. requested_reply=false means
+- * always allow.
++ /* for allow or check requested_reply=true means the rule applies
++ * only when reply was requested. requested_reply=false means the
++ * rule always applies
+ */
+- if (!requested_reply && rule->allow && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
++ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check");
+ continue;
+ }
+
+@@ -926,7 +938,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ * when the reply was not requested. requested_reply=true means the
+ * rule always applies.
+ */
+- if (requested_reply && !rule->allow && !rule->d.send.requested_reply)
++ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.send.requested_reply)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n");
+ continue;
+@@ -949,13 +961,15 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ /* The interface is optional in messages. For allow rules, if the message
+ * has no interface we want to skip the rule (and thus not allow);
+ * for deny rules, if the message has no interface we want to use the
+- * rule (and thus deny).
++ * rule (and thus deny). Check rules are meant to be used like allow
++ * rules (they can grant access, but not remove it), so we treat it like
++ * allow here.
+ */
+ dbus_bool_t no_interface;
+
+ no_interface = dbus_message_get_interface (message) == NULL;
+
+- if ((no_interface && rule->allow) ||
++ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) ||
+ (!no_interface &&
+ strcmp (dbus_message_get_interface (message),
+ rule->d.send.interface) != 0))
+@@ -1029,33 +1043,63 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
++
+ *log = rule->d.send.log;
+ (*toggles)++;
+
+- _dbus_verbose (" (policy) used rule, allow now = %d\n",
+- allowed);
++ _dbus_verbose (" (policy) used rule, result now = %d\n",
++ (int)(intptr_t)result);
+ }
+
+- return allowed;
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(sender);
++ BusCheck *check = bus_context_get_check(context);
++
++ result = bus_check_privilege(check, message, sender, addressed_recipient, receiver,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message);
++ }
++ else
++ privilege = NULL;
++
++ if (privilege_param != NULL)
++ *privilege_param = privilege;
++
++ return result;
+ }
+
+ /* See docs on what the args mean on bus_context_check_security_policy()
+ * comment
+ */
+-dbus_bool_t
+-bus_client_policy_check_can_receive (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- dbus_int32_t *toggles)
++BusResult
++bus_client_policy_check_can_receive (BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
+ dbus_bool_t eavesdropping;
++ BusResult result;
++ const char *privilege;
+
+ eavesdropping =
+ addressed_recipient != proposed_recipient &&
+@@ -1068,7 +1112,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ _dbus_verbose (" (policy) checking receive rules, eavesdropping = %d\n", eavesdropping);
+ *toggles = 0;
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&policy->rules);
+ while (link != NULL)
+ {
+@@ -1091,19 +1135,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ }
+ }
+
+- /* for allow, eavesdrop=false means the rule doesn't apply when
+- * eavesdropping. eavesdrop=true means always allow.
++
++ /* for allow or check, eavesdrop=false means the rule doesn't apply when
++ * eavesdropping. eavesdrop=true means the rule always applies
+ */
+- if (eavesdropping && rule->allow && !rule->d.receive.eavesdrop)
++ if (eavesdropping && rule->access != BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it doesn't apply to eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it doesn't apply to eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check");
+ continue;
+ }
+
+ /* for deny, eavesdrop=true means the rule applies only when
+ * eavesdropping; eavesdrop=false means always deny.
+ */
+- if (!eavesdropping && !rule->allow && rule->d.receive.eavesdrop)
++ if (!eavesdropping && rule->access == BUS_POLICY_RULE_ACCESS_DENY && rule->d.receive.eavesdrop)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to eavesdropping\n");
+ continue;
+@@ -1112,13 +1158,14 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ /* If it's a reply, the requested_reply flag kicks in */
+ if (dbus_message_get_reply_serial (message) != 0)
+ {
+- /* for allow, requested_reply=true means the rule applies
+- * only when reply was requested. requested_reply=false means
+- * always allow.
++ /* for allow or check requested_reply=true means the rule applies
++ * only when reply was requested. requested_reply=false means the
++ * rule always applies
+ */
+- if (!requested_reply && rule->allow && rule->d.receive.requested_reply && !rule->d.receive.eavesdrop)
++ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
+ {
+- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
++ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n",
++ rule->access == BUS_POLICY_RULE_ACCESS_DENY ? "allow" : "deny");
+ continue;
+ }
+
+@@ -1126,7 +1173,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ * when the reply was not requested. requested_reply=true means the
+ * rule always applies.
+ */
+- if (requested_reply && !rule->allow && !rule->d.receive.requested_reply)
++ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.requested_reply)
+ {
+ _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n");
+ continue;
+@@ -1149,13 +1196,13 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ /* The interface is optional in messages. For allow rules, if the message
+ * has no interface we want to skip the rule (and thus not allow);
+ * for deny rules, if the message has no interface we want to use the
+- * rule (and thus deny).
++ * rule (and thus deny). Check rules are treated like allow rules.
+ */
+ dbus_bool_t no_interface;
+
+ no_interface = dbus_message_get_interface (message) == NULL;
+
+- if ((no_interface && rule->allow) ||
++ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) ||
+ (!no_interface &&
+ strcmp (dbus_message_get_interface (message),
+ rule->d.receive.interface) != 0))
+@@ -1230,14 +1277,42 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
++
+ (*toggles)++;
+
+- _dbus_verbose (" (policy) used rule, allow now = %d\n",
+- allowed);
++ _dbus_verbose (" (policy) used rule, result now = %d\n",
++ (int)(intptr_t)result);
+ }
+
+- return allowed;
++
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(proposed_recipient);
++ BusCheck *check = bus_context_get_check(context);
++
++ result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message);
++ }
++ else
++ privilege = NULL;
++
++ if (privilege_param != NULL)
++ *privilege_param = privilege;
++
++ return result;
+ }
+
+
+@@ -1289,7 +1364,7 @@ bus_rules_check_can_own (DBusList *rules,
+ }
+
+ /* Use this rule */
+- allowed = rule->allow;
++ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
+ }
+
+ return allowed;
+diff --git a/bus/policy.h b/bus/policy.h
+index d1d3e72b..e9f193af 100644
+--- a/bus/policy.h
++++ b/bus/policy.h
+@@ -39,6 +39,14 @@ typedef enum
+ BUS_POLICY_RULE_GROUP
+ } BusPolicyRuleType;
+
++typedef enum
++{
++ BUS_POLICY_RULE_ACCESS_DENY,
++ BUS_POLICY_RULE_ACCESS_ALLOW,
++ /** runtime check resulting in allow or deny */
++ BUS_POLICY_RULE_ACCESS_CHECK
++} BusPolicyRuleAccess;
++
+ /** determines whether the rule affects a connection, or some global item */
+ #define BUS_POLICY_RULE_IS_PER_CLIENT(rule) (!((rule)->type == BUS_POLICY_RULE_USER || \
+ (rule)->type == BUS_POLICY_RULE_GROUP))
+@@ -49,8 +57,9 @@ struct BusPolicyRule
+
+ BusPolicyRuleType type;
+
+- unsigned int allow : 1; /**< #TRUE if this allows, #FALSE if it denies */
+-
++ unsigned int access : 2; /**< BusPolicyRuleAccess */
++ char *privilege; /**< for BUS_POLICY_RULE_ACCESS_CHECK */
++
+ union
+ {
+ struct
+@@ -106,7 +115,7 @@ struct BusPolicyRule
+ };
+
+ BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type,
+- dbus_bool_t allow);
++ BusPolicyRuleAccess access);
+ BusPolicyRule* bus_policy_rule_ref (BusPolicyRule *rule);
+ void bus_policy_rule_unref (BusPolicyRule *rule);
+
+@@ -140,21 +149,27 @@ dbus_bool_t bus_policy_merge (BusPolicy *policy,
+ BusClientPolicy* bus_client_policy_new (void);
+ BusClientPolicy* bus_client_policy_ref (BusClientPolicy *policy);
+ void bus_client_policy_unref (BusClientPolicy *policy);
+-dbus_bool_t bus_client_policy_check_can_send (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *receiver,
+- DBusMessage *message,
+- dbus_int32_t *toggles,
+- dbus_bool_t *log);
+-dbus_bool_t bus_client_policy_check_can_receive (BusClientPolicy *policy,
+- BusRegistry *registry,
+- dbus_bool_t requested_reply,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusConnection *proposed_recipient,
+- DBusMessage *message,
+- dbus_int32_t *toggles);
++BusResult bus_client_policy_check_can_send (DBusConnection *sender,
++ BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *addressed_recipient,
++ DBusConnection *receiver,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ dbus_bool_t *log,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message);
++BusResult bus_client_policy_check_can_receive (BusClientPolicy *policy,
++ BusRegistry *registry,
++ dbus_bool_t requested_reply,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusConnection *proposed_recipient,
++ DBusMessage *message,
++ dbus_int32_t *toggles,
++ const char **privilege_param,
++ BusDeferredMessage **deferred_message);
+ dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy,
+ const DBusString *service_name);
+ dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy,
+diff --git a/configure.ac b/configure.ac
+index 71e3515c..f3a2ffc1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1873,6 +1873,17 @@ AC_ARG_ENABLE([user-session],
+ AM_CONDITIONAL([DBUS_ENABLE_USER_SESSION],
+ [test "x$enable_user_session" = xyes])
+
++#enable cynara integration
++AC_ARG_ENABLE([cynara], [AS_HELP_STRING([--enable-cynara], [enable Cynara integration])], [], [enable_cynara=no])
++if test "x$enable_cynara" = xyes; then
++ PKG_CHECK_MODULES([CYNARA], [cynara-client-async >= 0.6.0 cynara-session >= 0.6.0],
++ [AC_DEFINE([DBUS_ENABLE_CYNARA], [1], [Define to enable Cynara privilege checks in dbus-daemon])],
++ [AC_MSG_ERROR([libcynara-client-async and cynara-session are required to enable Cynara integration])])
++fi
++
++AC_SUBST([CYNARA_CFLAGS])
++AC_SUBST([CYNARA_LIBS])
++
+ AC_CONFIG_FILES([
+ Doxyfile
+ dbus/Version
+@@ -1952,6 +1963,7 @@ echo "
+ Building bus stats API: ${enable_stats}
+ Building SELinux support: ${have_selinux}
+ Building AppArmor support: ${have_apparmor}
++ Building Cynara support: ${enable_cynara}
+ Building inotify support: ${have_inotify}
+ Building kqueue support: ${have_kqueue}
+ Building systemd support: ${have_systemd}
+diff --git a/test/Makefile.am b/test/Makefile.am
+index 914dd7f2..86882537 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -341,6 +341,7 @@ in_data = \
+ data/valid-config-files/debug-allow-all.conf.in \
+ data/valid-config-files/finite-timeout.conf.in \
+ data/valid-config-files/forbidding.conf.in \
++ data/valid-config-files/debug-check-some.conf.in \
+ data/valid-config-files/incoming-limit.conf.in \
+ data/valid-config-files/multi-user.conf.in \
+ data/valid-config-files/systemd-activation.conf.in \
+diff --git a/test/data/invalid-config-files/badcheck-1.conf b/test/data/invalid-config-files/badcheck-1.conf
+new file mode 100644
+index 00000000..fad9f502
+--- /dev/null
++++ b/test/data/invalid-config-files/badcheck-1.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <allow privilege="foo" send_destination="*"/> <!-- extra privilege="foo" -->
++ </policy>
++</busconfig>
+diff --git a/test/data/invalid-config-files/badcheck-2.conf b/test/data/invalid-config-files/badcheck-2.conf
+new file mode 100644
+index 00000000..63c7ef25
+--- /dev/null
++++ b/test/data/invalid-config-files/badcheck-2.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <check send_destination="*"/> <!-- missing privilege="foo" -->
++ </policy>
++</busconfig>
+diff --git a/test/data/valid-config-files/check-1.conf b/test/data/valid-config-files/check-1.conf
+new file mode 100644
+index 00000000..ad714733
+--- /dev/null
++++ b/test/data/valid-config-files/check-1.conf
+@@ -0,0 +1,9 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <user>mybususer</user>
++ <listen>unix:path=/foo/bar</listen>
++ <policy context="default">
++ <check privilege="foo" send_destination="*"/>
++ </policy>
++</busconfig>
+diff --git a/test/data/valid-config-files/debug-check-some.conf.in b/test/data/valid-config-files/debug-check-some.conf.in
+new file mode 100644
+index 00000000..47ee8548
+--- /dev/null
++++ b/test/data/valid-config-files/debug-check-some.conf.in
+@@ -0,0 +1,18 @@
++<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
++
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <listen>debug-pipe:name=test-server</listen>
++ <listen>@TEST_LISTEN@</listen>
++ <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
++ <policy context="default">
++ <allow send_interface="*"/>
++ <allow receive_interface="*"/>
++ <allow own="*"/>
++ <allow user="*"/>
++
++ <deny send_interface="org.freedesktop.TestSuite" send_member="Echo"/>
++ <check privilege="foo" send_interface="org.freedesktop.TestSuite" send_member="Echo"/>
++ </policy>
++</busconfig>
+diff --git a/tools/dbus-send.c b/tools/dbus-send.c
+index 0dc1f5b3..76ddab3f 100644
+--- a/tools/dbus-send.c
++++ b/tools/dbus-send.c
+@@ -458,7 +458,7 @@ main (int argc, char *argv[])
+ char *arg;
+ char *c;
+ int type;
+- int secondary_type;
++ int secondary_type = 0;
+ int container_type;
+ DBusMessageIter *target_iter;
+ DBusMessageIter container_iter;
+--
+2.14.3
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus/0002-Disable-message-dispatching-when-send-rule-result-is.patch b/meta-security/recipes-core/dbus-cynara/dbus/0002-Disable-message-dispatching-when-send-rule-result-is.patch
new file mode 100644
index 000000000..b1c3f3fdc
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus/0002-Disable-message-dispatching-when-send-rule-result-is.patch
@@ -0,0 +1,962 @@
+From 9bea6ec0497391b6af41daca18d7868af2656cef Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Fri, 28 Nov 2014 12:07:39 +0100
+Subject: [PATCH 2/5] Disable message dispatching when send rule result is not
+ known
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When unicast message is sent to addressed recipient and policy result
+is not available message dispatch from the sender is disabled.
+This also means that any further messages from the given connection are
+put into the incoming queue without being processed. If response is received
+message dispatching is resumed. This time answer is attached to the message
+which is now processed synchronously.
+Receive rule result unavailability is not yet handled - such messages are
+rejected. Also, if message is sent to non-addressed recipient and policy result
+is unknown, message is silently dropped.
+
+Change-Id: I57eccbf973525fd51369c7d4e58908292f44da80
+
+Cherry-picked from b1b87ad9f20b2052c28431b48e81073078a745ce
+by Jose Bollo.
+
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ bus/activation.c | 78 +++++++++++++++--
+ bus/check.c | 109 ++++++++++++++++++++++--
+ bus/check.h | 10 +++
+ bus/cynara.c | 1 -
+ bus/dispatch.c | 184 ++++++++++++++++++++++++++++++++++++----
+ bus/dispatch.h | 2 +-
+ bus/driver.c | 12 ++-
+ dbus/dbus-connection-internal.h | 15 ++++
+ dbus/dbus-connection.c | 125 +++++++++++++++++++++++++--
+ dbus/dbus-list.c | 29 +++++++
+ dbus/dbus-list.h | 3 +
+ dbus/dbus-shared.h | 3 +-
+ 12 files changed, 528 insertions(+), 43 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index 1a98af6d..343d3f22 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -31,6 +31,7 @@
+ #include "services.h"
+ #include "test.h"
+ #include "utils.h"
++#include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-internals.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-list.h>
+@@ -91,6 +92,8 @@ struct BusPendingActivationEntry
+ DBusConnection *connection;
+
+ dbus_bool_t auto_activation;
++
++ dbus_bool_t is_put_back;
+ };
+
+ typedef struct
+@@ -1180,20 +1183,23 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ BusPendingActivationEntry *entry = link->data;
+ DBusList *next = _dbus_list_get_next_link (&pending_activation->entries, link);
+
+- if (entry->auto_activation && (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection)))
++ if (entry->auto_activation && !entry->is_put_back &&
++ (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection)))
+ {
+ DBusConnection *addressed_recipient;
+ DBusError error;
++ BusResult res;
+
+ dbus_error_init (&error);
+
+ addressed_recipient = bus_service_get_primary_owners_connection (service);
+
+ /* Resume dispatching where we left off in bus_dispatch() */
+- if (!bus_dispatch_matches (transaction,
+- entry->connection,
+- addressed_recipient,
+- entry->activation_message, &error))
++ res = bus_dispatch_matches (transaction,
++ entry->connection,
++ addressed_recipient,
++ entry->activation_message, &error);
++ if (res == BUS_RESULT_FALSE)
+ {
+ /* If permission is denied, we just want to return the error
+ * to the original method invoker; in particular, we don't
+@@ -1205,9 +1211,40 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ bus_connection_send_oom_error (entry->connection,
+ entry->activation_message);
+ }
++ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ DBusList *putback_message_link = link;
++ DBusMessage *last_inserted_message = NULL;
++
++ /* NULL entry->connection implies sending pending ActivationRequest message to systemd */
++ if (entry->connection == NULL)
++ {
++ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly when sender is NULL");
++ link = next;
++ continue;
++ }
+
+- link = next;
+- continue;
++ /**
++ * Getting here means that policy check result is not yet available and dispatching
++ * messages from entry->connection has been disabled.
++ * Let's put back all messages for the given connection in the incoming queue and mark
++ * this entry as put back so they are not handled twice.
++ */
++ while (putback_message_link != NULL)
++ {
++ BusPendingActivationEntry *putback_message = putback_message_link->data;
++ if (putback_message->connection == entry->connection)
++ {
++ if (!_dbus_connection_putback_message (putback_message->connection, last_inserted_message,
++ putback_message->activation_message, &error))
++ goto error;
++ last_inserted_message = putback_message->activation_message;
++ putback_message->is_put_back = TRUE;
++ }
++
++ putback_message_link = _dbus_list_get_next_link(&pending_activation->entries, putback_message_link);
++ }
+ }
+ }
+
+@@ -1225,6 +1262,19 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ return TRUE;
+
+ error:
++ /* remove all messages that have been put to connections' incoming queues */
++ link = _dbus_list_get_first_link (&pending_activation->entries);
++ while (link != NULL)
++ {
++ BusPendingActivationEntry *entry = link->data;
++ if (entry->is_put_back)
++ {
++ _dbus_connection_remove_message(entry->connection, entry->activation_message);
++ entry->is_put_back = FALSE;
++ }
++ link = _dbus_list_get_next_link(&pending_activation->entries, link);
++ }
++
+ return FALSE;
+ }
+
+@@ -2028,13 +2078,23 @@ bus_activation_activate_service (BusActivation *activation,
+
+ if (service != NULL)
+ {
++ BusResult res;
+ bus_context_log (activation->context,
+ DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s'",
+ service_name,
+ entry->systemd_service);
+ /* Wonderful, systemd is connected, let's just send the msg */
+- retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
+- message, error);
++ res = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
++ message, error);
++
++ if (res == BUS_RESULT_TRUE)
++ retval = TRUE;
++ else
++ {
++ retval = FALSE;
++ if (res == BUS_RESULT_LATER)
++ _dbus_verbose("Unexpectedly need time to check message from bus driver to systemd - dropping the message.\n");
++ }
+ }
+ else
+ {
+diff --git a/bus/check.c b/bus/check.c
+index 5b72d31c..4b8a6994 100644
+--- a/bus/check.c
++++ b/bus/check.c
+@@ -55,6 +55,8 @@ typedef struct BusDeferredMessage
+ BusCheckResponseFunc response_callback;
+ } BusDeferredMessage;
+
++static dbus_int32_t deferred_message_data_slot = -1;
++
+ BusCheck *
+ bus_check_new (BusContext *context, DBusError *error)
+ {
+@@ -67,11 +69,19 @@ bus_check_new (BusContext *context, DBusError *error)
+ return NULL;
+ }
+
++ if (!dbus_message_allocate_data_slot(&deferred_message_data_slot))
++ {
++ dbus_free(check);
++ BUS_SET_OOM(error);
++ return NULL;
++ }
++
+ check->refcount = 1;
+ check->context = context;
+ check->cynara = bus_cynara_new(check, error);
+ if (dbus_error_is_set(error))
+ {
++ dbus_message_free_data_slot(&deferred_message_data_slot);
+ dbus_free(check);
+ return NULL;
+ }
+@@ -98,6 +108,7 @@ bus_check_unref (BusCheck *check)
+ if (check->refcount == 0)
+ {
+ bus_cynara_unref(check->cynara);
++ dbus_message_free_data_slot(&deferred_message_data_slot);
+ dbus_free(check);
+ }
+ }
+@@ -114,6 +125,45 @@ bus_check_get_cynara (BusCheck *check)
+ return check->cynara;
+ }
+
++static void
++bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ _dbus_verbose("bus_check_enable_dispatch_callback called deferred_message=%p\n", deferred_message);
++
++ deferred_message->response = result;
++ _dbus_connection_enable_dispatch(deferred_message->sender);
++}
++
++static void
++deferred_message_free_function(void *data)
++{
++ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data;
++ bus_deferred_message_unref(deferred_message);
++}
++
++void
++bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message)
++{
++ _dbus_assert(deferred_message != NULL);
++ _dbus_assert(deferred_message->sender != NULL);
++
++ if (dbus_message_get_data(deferred_message->message, deferred_message_data_slot) == NULL)
++ {
++ if (dbus_message_set_data(deferred_message->message, deferred_message_data_slot, deferred_message,
++ deferred_message_free_function))
++ bus_deferred_message_ref(deferred_message);
++ }
++
++ _dbus_connection_disable_dispatch(deferred_message->sender);
++ deferred_message->response_callback = bus_check_enable_dispatch_callback;
++}
++
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++BusResult (*bus_check_test_override) (DBusConnection *connection,
++ const char *privilege);
++#endif
++
+ BusResult
+ bus_check_privilege (BusCheck *check,
+ DBusMessage *message,
+@@ -124,6 +174,7 @@ bus_check_privilege (BusCheck *check,
+ BusDeferredMessageStatus check_type,
+ BusDeferredMessage **deferred_message)
+ {
++ BusDeferredMessage *previous_deferred_message;
+ BusResult result = BUS_RESULT_FALSE;
+ #ifdef DBUS_ENABLE_CYNARA
+ BusCynara *cynara;
+@@ -137,16 +188,54 @@ bus_check_privilege (BusCheck *check,
+ return BUS_RESULT_FALSE;
+ }
+
+- /* ask policy checkers */
+-#ifdef DBUS_ENABLE_CYNARA
+- cynara = bus_check_get_cynara(check);
+- result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
+- proposed_recipient, privilege, check_type, deferred_message);
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++ if (bus_check_test_override)
++ return bus_check_test_override (connection, privilege);
+ #endif
+
+- if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ previous_deferred_message = dbus_message_get_data(message, deferred_message_data_slot);
++ /* check if message blocked at sender's queue is being processed */
++ if (previous_deferred_message != NULL)
++ {
++ if ((check_type & BUS_DEFERRED_MESSAGE_CHECK_SEND) &&
++ !(previous_deferred_message->status & BUS_DEFERRED_MESSAGE_CHECK_SEND))
++ {
++ /**
++ * Message has been deferred due to receive or own rule which means that sending this message
++ * is allowed - it must have been checked previously.
++ * This might happen when client calls RequestName method which depending on security
++ * policy might result in both "can_send" and "can_own" Cynara checks.
++ */
++ result = BUS_RESULT_TRUE;
++ }
++ else
++ {
++ result = previous_deferred_message->response;
++ if (result == BUS_RESULT_LATER)
++ {
++ /* result is still not known - reuse deferred message object */
++ if (deferred_message != NULL)
++ *deferred_message = previous_deferred_message;
++ }
++ else
++ {
++ /* result is available - we can remove deferred message from the processed message */
++ dbus_message_set_data(message, deferred_message_data_slot, NULL, NULL);
++ }
++ }
++ }
++ else
+ {
+- (*deferred_message)->status |= check_type;
++ /* ask policy checkers */
++#ifdef DBUS_ENABLE_CYNARA
++ cynara = bus_check_get_cynara(check);
++ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient,
++ proposed_recipient, privilege, check_type, deferred_message);
++#endif
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ {
++ (*deferred_message)->status |= check_type;
++ }
+ }
+ return result;
+ }
+@@ -206,6 +295,12 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message)
+ }
+ }
+
++BusDeferredMessageStatus
++bus_deferred_message_get_status (BusDeferredMessage *deferred_message)
++{
++ return deferred_message->status;
++}
++
+ void
+ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result)
+diff --git a/bus/check.h b/bus/check.h
+index c3fcaf90..d1775497 100644
+--- a/bus/check.h
++++ b/bus/check.h
+@@ -55,6 +55,7 @@ BusResult bus_check_privilege (BusCheck *check,
+ BusDeferredMessageStatus check_type,
+ BusDeferredMessage **deferred_message);
+
++
+ BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
+ DBusConnection *sender,
+ DBusConnection *addressed_recipient,
+@@ -65,4 +66,13 @@ BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage
+ void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result);
++void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message);
++
++BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message);
++
++#ifdef DBUS_ENABLE_EMBEDDED_TESTS
++extern BusResult (*bus_check_test_override) (DBusConnection *connection,
++ const char *privilege);
++#endif
++
+ #endif /* BUS_CHECK_H */
+diff --git a/bus/cynara.c b/bus/cynara.c
+index 57a4c45c..77aed623 100644
+--- a/bus/cynara.c
++++ b/bus/cynara.c
+@@ -36,7 +36,6 @@
+ #include <cynara-client-async.h>
+ #endif
+
+-
+ #ifdef DBUS_ENABLE_CYNARA
+ typedef struct BusCynara
+ {
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index 05be3bdf..7353501b 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -35,6 +35,7 @@
+ #include "signals.h"
+ #include "test.h"
+ #include <dbus/dbus-internals.h>
++#include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-misc.h>
+ #include <string.h>
+
+@@ -121,7 +122,7 @@ send_one_message (DBusConnection *connection,
+ return TRUE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_dispatch_matches (BusTransaction *transaction,
+ DBusConnection *sender,
+ DBusConnection *addressed_recipient,
+@@ -157,13 +158,29 @@ bus_dispatch_matches (BusTransaction *transaction,
+ message, error,
+ &deferred_message);
+ if (res == BUS_RESULT_FALSE)
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ else if (res == BUS_RESULT_LATER)
+ {
+- dbus_set_error (error,
+- DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- return FALSE;
++ BusDeferredMessageStatus status;
++ status = bus_deferred_message_get_status(deferred_message);
++
++ if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND)
++ {
++ /* send rule result not available - disable dispatching messages from the sender */
++ bus_deferred_message_disable_sender(deferred_message);
++ return BUS_RESULT_LATER;
++ }
++ else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE)
++ {
++ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
++ "Rejecting message because time is needed to check security policy");
++ return BUS_RESULT_FALSE;
++ }
++ else
++ {
++ _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n");
++ return BUS_RESULT_FALSE;
++ }
+ }
+
+ if (dbus_message_contains_unix_fds (message) &&
+@@ -174,14 +191,14 @@ bus_dispatch_matches (BusTransaction *transaction,
+ DBUS_ERROR_NOT_SUPPORTED,
+ "Tried to send message with Unix file descriptors"
+ "to a client that doesn't support that.");
+- return FALSE;
+- }
++ return BUS_RESULT_FALSE;
++ }
+
+ /* Dispatch the message */
+ if (!bus_transaction_send (transaction, addressed_recipient, message))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -196,7 +213,7 @@ bus_dispatch_matches (BusTransaction *transaction,
+ &recipients))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ link = _dbus_list_get_first_link (&recipients);
+@@ -218,10 +235,10 @@ bus_dispatch_matches (BusTransaction *transaction,
+ if (dbus_error_is_set (&tmp_error))
+ {
+ dbus_move_error (&tmp_error, error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+
+ static DBusHandlerResult
+@@ -407,10 +424,12 @@ bus_dispatch (DBusConnection *connection,
+ }
+ else if (res == BUS_RESULT_LATER)
+ {
+- dbus_set_error (&error,
+- DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- _dbus_verbose ("Security policy needs time to check policy. Dropping message\n");
++ /* Disable dispatching messages from the sender,
++ * roll back and dispatch the message once the policy result is available */
++ bus_deferred_message_disable_sender(deferred_message);
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
+ goto out;
+ }
+
+@@ -475,8 +494,14 @@ bus_dispatch (DBusConnection *connection,
+ * addressed_recipient == NULL), and match it against other connections'
+ * match rules.
+ */
+- if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error))
+- goto out;
++ if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient,
++ message, &error))
++ {
++ /* Roll back and dispatch the message once the policy result is available */
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
++ }
+
+ out:
+ if (dbus_error_is_set (&error))
+@@ -5001,9 +5026,132 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir,
+ return TRUE;
+ }
+
++typedef struct {
++ DBusTimeout *timeout;
++ DBusConnection *connection;
++ dbus_bool_t timedout;
++ int check_counter;
++} BusTestCheckData;
++
++static BusTestCheckData *cdata;
++
++static dbus_bool_t
++bus_dispatch_test_check_timeout (void *data)
++{
++ _dbus_verbose ("timeout triggered - pretend that privilege check result is available\n");
++
++ /* should only happen once during the test */
++ _dbus_assert (!cdata->timedout);
++ cdata->timedout = TRUE;
++ _dbus_connection_enable_dispatch (cdata->connection);
++
++ /* don't call this again */
++ _dbus_loop_remove_timeout (bus_connection_get_loop (cdata->connection),
++ cdata->timeout);
++ dbus_connection_unref (cdata->connection);
++ cdata->connection = NULL;
++ return TRUE;
++}
++
++static BusResult
++bus_dispatch_test_check_override (DBusConnection *connection,
++ const char *privilege)
++{
++ _dbus_verbose ("overriding privilege check %s #%d\n", privilege, cdata->check_counter);
++ cdata->check_counter++;
++ if (!cdata->timedout)
++ {
++ dbus_bool_t added;
++
++ /* Should be the first privilege check for the "Echo" method. */
++ _dbus_assert (cdata->check_counter == 1);
++ cdata->timeout = _dbus_timeout_new (1, bus_dispatch_test_check_timeout,
++ NULL, NULL);
++ _dbus_assert (cdata->timeout);
++ added = _dbus_loop_add_timeout (bus_connection_get_loop (connection),
++ cdata->timeout);
++ _dbus_assert (added);
++ cdata->connection = connection;
++ dbus_connection_ref (connection);
++ _dbus_connection_disable_dispatch (connection);
++ return BUS_RESULT_LATER;
++ }
++ else
++ {
++ /* Should only be checked one more time, and this time succeeds. */
++ _dbus_assert (cdata->check_counter == 2);
++ return BUS_RESULT_TRUE;
++ }
++}
++
++static dbus_bool_t
++bus_dispatch_test_check (const DBusString *test_data_dir)
++{
++ const char *filename = "valid-config-files/debug-check-some.conf";
++ BusContext *context;
++ DBusConnection *foo;
++ DBusError error;
++ dbus_bool_t result = TRUE;
++ BusTestCheckData data;
++
++ /* save the config name for the activation helper */
++ if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename))
++ _dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG");
++
++ dbus_error_init (&error);
++
++ context = bus_context_new_test (test_data_dir, filename);
++ if (context == NULL)
++ return FALSE;
++
++ foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error);
++ if (foo == NULL)
++ _dbus_assert_not_reached ("could not alloc connection");
++
++ if (!bus_setup_debug_client (foo))
++ _dbus_assert_not_reached ("could not set up connection");
++
++ spin_connection_until_authenticated (context, foo);
++
++ if (!check_hello_message (context, foo))
++ _dbus_assert_not_reached ("hello message failed");
++
++ if (!check_double_hello_message (context, foo))
++ _dbus_assert_not_reached ("double hello message failed");
++
++ if (!check_add_match (context, foo, ""))
++ _dbus_assert_not_reached ("AddMatch message failed");
++
++ /*
++ * Cause bus_check_send_privilege() to return BUS_RESULT_LATER in the
++ * first call, then BUS_RESULT_TRUE.
++ */
++ cdata = &data;
++ memset (cdata, 0, sizeof(*cdata));
++ bus_check_test_override = bus_dispatch_test_check_override;
++
++ result = check_existent_service_auto_start (context, foo);
++
++ _dbus_assert (cdata->check_counter == 2);
++ _dbus_assert (cdata->timedout);
++ _dbus_assert (cdata->timeout);
++ _dbus_assert (!cdata->connection);
++ _dbus_timeout_unref (cdata->timeout);
++
++ kill_client_connection_unchecked (foo);
++
++ bus_context_unref (context);
++
++ return result;
++}
++
+ dbus_bool_t
+ bus_dispatch_test (const DBusString *test_data_dir)
+ {
++ _dbus_verbose ("<check> tests\n");
++ if (!bus_dispatch_test_check (test_data_dir))
++ return FALSE;
++
+ /* run normal activation tests */
+ _dbus_verbose ("Normal activation tests\n");
+ if (!bus_dispatch_test_conf (test_data_dir,
+diff --git a/bus/dispatch.h b/bus/dispatch.h
+index fb5ba7a5..afba6a24 100644
+--- a/bus/dispatch.h
++++ b/bus/dispatch.h
+@@ -29,7 +29,7 @@
+
+ dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection);
+ void bus_dispatch_remove_connection (DBusConnection *connection);
+-dbus_bool_t bus_dispatch_matches (BusTransaction *transaction,
++BusResult bus_dispatch_matches (BusTransaction *transaction,
+ DBusConnection *sender,
+ DBusConnection *recipient,
+ DBusMessage *message,
+diff --git a/bus/driver.c b/bus/driver.c
+index b7e1a0a0..a5823d4d 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -225,6 +225,7 @@ bus_driver_send_service_owner_changed (const char *service_name,
+ {
+ DBusMessage *message;
+ dbus_bool_t retval;
++ BusResult res;
+ const char *null_service;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -260,7 +261,16 @@ bus_driver_send_service_owner_changed (const char *service_name,
+ if (!bus_transaction_capture (transaction, NULL, message))
+ goto oom;
+
+- retval = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ res = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ if (res == BUS_RESULT_TRUE)
++ retval = TRUE;
++ else
++ {
++ retval = FALSE;
++ if (res == BUS_RESULT_LATER)
++ /* should never happen */
++ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly");
++ }
+ dbus_message_unref (message);
+
+ return retval;
+diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
+index 48357321..94b1c951 100644
+--- a/dbus/dbus-connection-internal.h
++++ b/dbus/dbus-connection-internal.h
+@@ -118,6 +118,21 @@ DBUS_PRIVATE_EXPORT
+ dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection,
+ char **label_p);
+
++DBUS_PRIVATE_EXPORT
++void _dbus_connection_enable_dispatch (DBusConnection *connection);
++DBUS_PRIVATE_EXPORT
++void _dbus_connection_disable_dispatch (DBusConnection *connection);
++
++DBUS_PRIVATE_EXPORT
++dbus_bool_t _dbus_connection_putback_message (DBusConnection *connection,
++ DBusMessage *after_message,
++ DBusMessage *message,
++ DBusError *error);
++
++DBUS_PRIVATE_EXPORT
++dbus_bool_t _dbus_connection_remove_message (DBusConnection *connection,
++ DBusMessage *message);
++
+ /* if DBUS_ENABLE_STATS */
+ DBUS_PRIVATE_EXPORT
+ void _dbus_connection_get_stats (DBusConnection *connection,
+diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
+index 7f5b3292..ed0be70d 100644
+--- a/dbus/dbus-connection.c
++++ b/dbus/dbus-connection.c
+@@ -311,7 +311,8 @@ struct DBusConnection
+ */
+ dbus_bool_t dispatch_acquired; /**< Someone has dispatch path (can drain incoming queue) */
+ dbus_bool_t io_path_acquired; /**< Someone has transport io path (can use the transport to read/write messages) */
+-
++
++ unsigned int dispatch_disabled : 1; /**< if true, then dispatching incoming messages is stopped until enabled again */
+ unsigned int shareable : 1; /**< #TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more than once */
+
+ unsigned int exit_on_disconnect : 1; /**< If #TRUE, exit after handling disconnect signal */
+@@ -439,6 +440,39 @@ _dbus_connection_wakeup_mainloop (DBusConnection *connection)
+ (*connection->wakeup_main_function) (connection->wakeup_main_data);
+ }
+
++static void
++_dbus_connection_set_dispatch(DBusConnection *connection,
++ dbus_bool_t disabled)
++{
++ CONNECTION_LOCK (connection);
++ if (connection->dispatch_disabled != disabled)
++ {
++ DBusDispatchStatus status;
++
++ connection->dispatch_disabled = disabled;
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++ }
++ else
++ {
++ CONNECTION_UNLOCK (connection);
++ }
++}
++
++
++void
++_dbus_connection_enable_dispatch (DBusConnection *connection)
++{
++ _dbus_connection_set_dispatch (connection, FALSE);
++}
++
++void
++ _dbus_connection_disable_dispatch (DBusConnection *connection)
++{
++ _dbus_connection_set_dispatch (connection, TRUE);
++}
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ /**
+ * Gets the locks so we can examine them
+@@ -4070,6 +4104,82 @@ _dbus_connection_putback_message_link_unlocked (DBusConnection *connection,
+ "_dbus_connection_putback_message_link_unlocked");
+ }
+
++dbus_bool_t
++_dbus_connection_putback_message (DBusConnection *connection,
++ DBusMessage *after_message,
++ DBusMessage *message,
++ DBusError *error)
++{
++ DBusDispatchStatus status;
++ DBusList *message_link = _dbus_list_alloc_link (message);
++ DBusList *after_link;
++ if (message_link == NULL)
++ {
++ _DBUS_SET_OOM (error);
++ return FALSE;
++ }
++ dbus_message_ref (message);
++
++ CONNECTION_LOCK (connection);
++ _dbus_connection_acquire_dispatch (connection);
++ HAVE_LOCK_CHECK (connection);
++
++ after_link = _dbus_list_find_first(&connection->incoming_messages, after_message);
++ _dbus_list_insert_after_link (&connection->incoming_messages, after_link, message_link);
++ connection->n_incoming += 1;
++
++ _dbus_verbose ("Message %p (%s %s %s '%s') put back into queue %p, %d incoming\n",
++ message_link->data,
++ dbus_message_type_to_string (dbus_message_get_type (message_link->data)),
++ dbus_message_get_interface (message_link->data) ?
++ dbus_message_get_interface (message_link->data) :
++ "no interface",
++ dbus_message_get_member (message_link->data) ?
++ dbus_message_get_member (message_link->data) :
++ "no member",
++ dbus_message_get_signature (message_link->data),
++ connection, connection->n_incoming);
++
++ _dbus_message_trace_ref (message_link->data, -1, -1,
++ "_dbus_connection_putback_message");
++
++ _dbus_connection_release_dispatch (connection);
++
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++
++ return TRUE;
++}
++
++dbus_bool_t
++_dbus_connection_remove_message (DBusConnection *connection,
++ DBusMessage *message)
++{
++ DBusDispatchStatus status;
++ dbus_bool_t removed;
++
++ CONNECTION_LOCK (connection);
++ _dbus_connection_acquire_dispatch (connection);
++ HAVE_LOCK_CHECK (connection);
++
++ removed = _dbus_list_remove(&connection->incoming_messages, message);
++
++ if (removed)
++ {
++ connection->n_incoming -= 1;
++ dbus_message_unref(message);
++ _dbus_verbose ("Message %p removed from incoming queue\n", message);
++ }
++ else
++ _dbus_verbose ("Message %p not found in the incoming queue\n", message);
++
++ _dbus_connection_release_dispatch (connection);
++
++ status = _dbus_connection_get_dispatch_status_unlocked (connection);
++ _dbus_connection_update_dispatch_status_and_unlock (connection, status);
++ return removed;
++}
++
+ /**
+ * Returns the first-received message from the incoming message queue,
+ * removing it from the queue. The caller owns a reference to the
+@@ -4253,8 +4363,9 @@ static DBusDispatchStatus
+ _dbus_connection_get_dispatch_status_unlocked (DBusConnection *connection)
+ {
+ HAVE_LOCK_CHECK (connection);
+-
+- if (connection->n_incoming > 0)
++ if (connection->dispatch_disabled && dbus_connection_get_is_connected(connection))
++ return DBUS_DISPATCH_COMPLETE;
++ else if (connection->n_incoming > 0)
+ return DBUS_DISPATCH_DATA_REMAINS;
+ else if (!_dbus_transport_queue_messages (connection->transport))
+ return DBUS_DISPATCH_NEED_MEMORY;
+@@ -4717,6 +4828,8 @@ dbus_connection_dispatch (DBusConnection *connection)
+
+ CONNECTION_LOCK (connection);
+
++ if (result == DBUS_HANDLER_RESULT_LATER)
++ goto out;
+ if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
+ {
+ _dbus_verbose ("No memory\n");
+@@ -4839,9 +4952,11 @@ dbus_connection_dispatch (DBusConnection *connection)
+ connection);
+
+ out:
+- if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
++ if (result == DBUS_HANDLER_RESULT_LATER ||
++ result == DBUS_HANDLER_RESULT_NEED_MEMORY)
+ {
+- _dbus_verbose ("out of memory\n");
++ if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
++ _dbus_verbose ("out of memory\n");
+
+ /* Put message back, and we'll start over.
+ * Yes this means handlers must be idempotent if they
+diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c
+index c4c1856f..f84918b1 100644
+--- a/dbus/dbus-list.c
++++ b/dbus/dbus-list.c
+@@ -458,6 +458,35 @@ _dbus_list_remove_last (DBusList **list,
+ return FALSE;
+ }
+
++/**
++ * Finds a value in the list. Returns the first link
++ * with value equal to the given data pointer.
++ * This is a linear-time operation.
++ * Returns #NULL if no value found that matches.
++ *
++ * @param list address of the list head.
++ * @param data the value to find.
++ * @returns the link if found
++ */
++DBusList*
++_dbus_list_find_first (DBusList **list,
++ void *data)
++{
++ DBusList *link;
++
++ link = _dbus_list_get_first_link (list);
++
++ while (link != NULL)
++ {
++ if (link->data == data)
++ return link;
++
++ link = _dbus_list_get_next_link (list, link);
++ }
++
++ return NULL;
++}
++
+ /**
+ * Finds a value in the list. Returns the last link
+ * with value equal to the given data pointer.
+diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h
+index 9350a0da..fee9f1bc 100644
+--- a/dbus/dbus-list.h
++++ b/dbus/dbus-list.h
+@@ -68,6 +68,9 @@ DBUS_PRIVATE_EXPORT
+ void _dbus_list_remove_link (DBusList **list,
+ DBusList *link);
+ DBUS_PRIVATE_EXPORT
++DBusList* _dbus_list_find_first (DBusList **list,
++ void *data);
++DBUS_PRIVATE_EXPORT
+ DBusList* _dbus_list_find_last (DBusList **list,
+ void *data);
+ DBUS_PRIVATE_EXPORT
+diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h
+index 7ab91035..e5bfbed6 100644
+--- a/dbus/dbus-shared.h
++++ b/dbus/dbus-shared.h
+@@ -67,7 +67,8 @@ typedef enum
+ {
+ DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
+- DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
++ DBUS_HANDLER_RESULT_NEED_MEMORY, /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
++ DBUS_HANDLER_RESULT_LATER /**< Message dispatch deferred due to pending policy check */
+ } DBusHandlerResult;
+
+ /* Bus names */
+--
+2.14.3
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus/0003-Handle-unavailability-of-policy-results-for-broadcas.patch b/meta-security/recipes-core/dbus-cynara/dbus/0003-Handle-unavailability-of-policy-results-for-broadcas.patch
new file mode 100644
index 000000000..b797064ec
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus/0003-Handle-unavailability-of-policy-results-for-broadcas.patch
@@ -0,0 +1,1090 @@
+From 8c5fd05f7b2f14ac0f4423cae300f60c6bb51c74 Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Fri, 28 Nov 2014 12:39:33 +0100
+Subject: [PATCH 3/5] Handle unavailability of policy results for broadcasts
+ and receive rules
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When message is sent to the addressed recipient and receive rule
+result is unavailable we don't want to block the sender
+as it most likely will be the privileged service, so instead we queue
+it at the recipient. Any further messages sent to it will be queued to
+maintain message order. Once the answer from Cynara arrives messages are
+dispatched from the recipient queue. In such case full dispatch is
+performed - messages are sent to addressed recipient and other
+interested connections.
+Messages sent to non-addressed recipients (eavesdroppers or broadcast
+message recipients) are handled in a similar way. The difference is
+that it is not full dispatch meaning message is sent to a single recipient.
+
+Change-Id: Iecd5395f75a4c7811fa97247a37d8fc4d42e8814
+
+Cherry picked from 1e231194610892dd4360224998d91336097b05a1 by Jose Bollo
+
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ bus/activation.c | 4 +-
+ bus/bus.c | 50 +++++++--
+ bus/bus.h | 19 ++++
+ bus/check.c | 307 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ bus/check.h | 25 +++++
+ bus/connection.c | 169 ++++++++++++++++++++++++++++--
+ bus/connection.h | 19 +++-
+ bus/dispatch.c | 121 ++++++++++++++++++----
+ bus/dispatch.h | 11 +-
+ bus/driver.c | 2 +-
+ bus/policy.c | 6 ++
+ 11 files changed, 686 insertions(+), 47 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index 343d3f22..11bd8386 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -1198,7 +1198,7 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation
+ res = bus_dispatch_matches (transaction,
+ entry->connection,
+ addressed_recipient,
+- entry->activation_message, &error);
++ entry->activation_message, NULL, &error);
+ if (res == BUS_RESULT_FALSE)
+ {
+ /* If permission is denied, we just want to return the error
+@@ -2085,7 +2085,7 @@ bus_activation_activate_service (BusActivation *activation,
+ entry->systemd_service);
+ /* Wonderful, systemd is connected, let's just send the msg */
+ res = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
+- message, error);
++ message, NULL, error);
+
+ if (res == BUS_RESULT_TRUE)
+ retval = TRUE;
+diff --git a/bus/bus.c b/bus/bus.c
+index c4008505..911e2340 100644
+--- a/bus/bus.c
++++ b/bus/bus.c
+@@ -1796,17 +1796,9 @@ bus_context_check_security_policy (BusContext *context,
+ }
+
+ /* See if limits on size have been exceeded */
+- if (proposed_recipient &&
+- ((dbus_connection_get_outgoing_size (proposed_recipient) > context->limits.max_outgoing_bytes) ||
+- (dbus_connection_get_outgoing_unix_fds (proposed_recipient) > context->limits.max_outgoing_unix_fds)))
+- {
+- complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
+- "Rejected: destination has a full message queue",
+- 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL,
+- error);
+- _dbus_verbose ("security policy disallowing message due to full message queue\n");
++ if (!bus_context_check_recipient_message_limits(context, proposed_recipient, sender, message,
++ requested_reply, error))
+ return BUS_RESULT_FALSE;
+- }
+
+ /* Record that we will allow a reply here in the future (don't
+ * bother if the recipient is the bus or this is an eavesdropping
+@@ -1861,3 +1853,41 @@ bus_context_check_all_watches (BusContext *context)
+ _dbus_server_toggle_all_watches (server, enabled);
+ }
+ }
++
++void
++bus_context_complain_about_message (BusContext *context,
++ const char *error_name,
++ const char *complaint,
++ int matched_rules,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *proposed_recipient,
++ dbus_bool_t requested_reply,
++ dbus_bool_t log,
++ const char *privilege,
++ DBusError *error)
++{
++ complain_about_message(context, error_name, complaint, matched_rules, message, sender,
++ proposed_recipient, requested_reply, log, privilege, error);
++}
++
++dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context,
++ DBusConnection *recipient,
++ DBusConnection *sender,
++ DBusMessage *message,
++ dbus_bool_t requested_reply,
++ DBusError *error)
++{
++ if (recipient &&
++ ((dbus_connection_get_outgoing_size (recipient) > context->limits.max_outgoing_bytes) ||
++ (dbus_connection_get_outgoing_unix_fds (recipient) > context->limits.max_outgoing_unix_fds)))
++ {
++ complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED,
++ "Rejected: destination has a full message queue",
++ 0, message, sender, recipient, requested_reply, TRUE, NULL,
++ error);
++ _dbus_verbose ("security policy disallowing message due to full message queue\n");
++ return FALSE;
++ }
++ return TRUE;
++}
+diff --git a/bus/bus.h b/bus/bus.h
+index dab7791f..445165c9 100644
+--- a/bus/bus.h
++++ b/bus/bus.h
+@@ -158,4 +158,23 @@ BusResult bus_context_check_security_policy (BusContext
+ BusDeferredMessage **deferred_message);
+ void bus_context_check_all_watches (BusContext *context);
+
++dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context,
++ DBusConnection *recipient,
++ DBusConnection *sender,
++ DBusMessage *message,
++ dbus_bool_t requested_reply,
++ DBusError *error);
++void bus_context_complain_about_message (BusContext *context,
++ const char *error_name,
++ const char *complaint,
++ int matched_rules,
++ DBusMessage *message,
++ DBusConnection *sender,
++ DBusConnection *proposed_recipient,
++ dbus_bool_t requested_reply,
++ dbus_bool_t log,
++ const char *privilege,
++ DBusError *error);
++
++
+ #endif /* BUS_BUS_H */
+diff --git a/bus/check.c b/bus/check.c
+index 4b8a6994..b8833349 100644
+--- a/bus/check.c
++++ b/bus/check.c
+@@ -49,6 +49,9 @@ typedef struct BusDeferredMessage
+ DBusConnection *sender;
+ DBusConnection *proposed_recipient;
+ DBusConnection *addressed_recipient;
++ dbus_bool_t requested_reply;
++ int matched_rules;
++ const char *privilege;
+ dbus_bool_t full_dispatch;
+ BusDeferredMessageStatus status;
+ BusResult response;
+@@ -135,6 +138,89 @@ bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message,
+ _dbus_connection_enable_dispatch(deferred_message->sender);
+ }
+
++static void
++bus_check_queued_message_reply_callback (BusDeferredMessage *deferred_message,
++ BusResult result)
++{
++ int status;
++
++ _dbus_verbose("bus_check_queued_message_reply_callback called message=%p\n", deferred_message);
++
++ if (!bus_connection_is_active(deferred_message->proposed_recipient))
++ return;
++
++ status = deferred_message->status;
++
++ deferred_message->status = 0; /* mark message as not waiting for response */
++ deferred_message->response = result;
++
++ /*
++ * If send rule allows us to send message we still need to check receive rules.
++ */
++ if ((status & BUS_DEFERRED_MESSAGE_CHECK_SEND) && (result == BUS_RESULT_TRUE))
++ {
++ int toggles;
++ BusContext *context;
++ BusRegistry *registry;
++ BusClientPolicy *recipient_policy;
++ BusDeferredMessage *deferred_message_receive;
++
++ context = bus_connection_get_context(deferred_message->proposed_recipient);
++ registry = bus_context_get_registry(context);
++ recipient_policy = bus_connection_get_policy(deferred_message->proposed_recipient);
++
++ deferred_message->response = bus_client_policy_check_can_receive(recipient_policy, registry,
++ deferred_message->requested_reply, deferred_message->sender,
++ deferred_message->addressed_recipient, deferred_message->proposed_recipient, deferred_message->message,
++ &toggles, NULL, &deferred_message_receive);
++ if (deferred_message->response == BUS_RESULT_LATER)
++ {
++ /* replace deferred message associated with send check with the one associated with
++ * receive check */
++ if (!bus_deferred_message_replace(deferred_message, deferred_message_receive))
++ {
++ /* failed to replace deferred message (due to oom). Set it to rejected */
++ deferred_message->response = BUS_RESULT_FALSE;
++ }
++ }
++ }
++
++ bus_connection_dispatch_deferred(deferred_message->proposed_recipient);
++}
++
++static void
++queue_deferred_message_cancel_transaction_hook (void *data)
++{
++ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data;
++ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message);
++}
++
++
++dbus_bool_t
++bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ dbus_bool_t full_dispatch,
++ dbus_bool_t prepend)
++{
++ _dbus_assert(deferred_message != NULL);
++ _dbus_assert(deferred_message->proposed_recipient != NULL);
++
++ if (!bus_connection_queue_deferred_message(deferred_message->proposed_recipient,
++ deferred_message, prepend))
++ return FALSE;
++
++ if (!bus_transaction_add_cancel_hook(transaction, queue_deferred_message_cancel_transaction_hook,
++ deferred_message, NULL))
++ {
++ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message);
++ return FALSE;
++ }
++ deferred_message->response_callback = bus_check_queued_message_reply_callback;
++ deferred_message->full_dispatch = full_dispatch;
++
++ return TRUE;
++}
++
+ static void
+ deferred_message_free_function(void *data)
+ {
+@@ -159,6 +245,20 @@ bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message)
+ deferred_message->response_callback = bus_check_enable_dispatch_callback;
+ }
+
++void
++bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message,
++ dbus_bool_t requested_reply,
++ int matched_rules,
++ const char *privilege)
++{
++ _dbus_assert(deferred_message != NULL);
++
++ deferred_message->requested_reply = requested_reply;
++ deferred_message->matched_rules = matched_rules;
++ deferred_message->privilege = privilege;
++}
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ BusResult (*bus_check_test_override) (DBusConnection *connection,
+ const char *privilege);
+@@ -259,6 +359,9 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *message,
+ deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL;
+ deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL;
+ deferred_message->message = dbus_message_ref(message);
++ deferred_message->requested_reply = FALSE;
++ deferred_message->matched_rules = 0;
++ deferred_message->privilege = NULL;
+ deferred_message->response = response;
+ deferred_message->status = 0;
+ deferred_message->full_dispatch = FALSE;
+@@ -295,12 +398,215 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message)
+ }
+ }
+
++dbus_bool_t
++bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message, DBusError *error)
++{
++ BusContext *context = bus_connection_get_context(deferred_message->proposed_recipient);
++
++ return bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient,
++ deferred_message->sender, deferred_message->message, deferred_message->requested_reply,
++ error);
++}
++
++dbus_bool_t
++bus_deferred_message_expect_method_reply(BusDeferredMessage *deferred_message, BusTransaction *transaction, DBusError *error)
++{
++ int type = dbus_message_get_type(deferred_message->message);
++ if (type == DBUS_MESSAGE_TYPE_METHOD_CALL &&
++ deferred_message->sender &&
++ deferred_message->addressed_recipient &&
++ deferred_message->addressed_recipient == deferred_message->proposed_recipient && /* not eavesdropping */
++ !bus_connections_expect_reply (bus_connection_get_connections (deferred_message->sender),
++ transaction,
++ deferred_message->sender, deferred_message->addressed_recipient,
++ deferred_message->message, error))
++ {
++ _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n");
++ return FALSE;
++ }
++ return TRUE;
++}
++
++void
++bus_deferred_message_create_error(BusDeferredMessage *deferred_message,
++ const char *error_message, DBusError *error)
++{
++ BusContext *context;
++ _dbus_assert (deferred_message->status == 0 && deferred_message->response == BUS_RESULT_FALSE);
++
++ if (deferred_message->sender == NULL)
++ return; /* error won't be sent to bus driver anyway */
++
++ context = bus_connection_get_context(deferred_message->sender);
++ bus_context_complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected message",
++ deferred_message->matched_rules, deferred_message->message, deferred_message->sender,
++ deferred_message->proposed_recipient, deferred_message->requested_reply, FALSE,
++ deferred_message->privilege, error);
++}
++
++BusResult
++bus_deferred_message_dispatch (BusDeferredMessage *deferred_message)
++{
++ BusContext *context = bus_connection_get_context (deferred_message->proposed_recipient);
++ BusTransaction *transaction = bus_transaction_new (context);
++ BusResult result = BUS_RESULT_TRUE;
++ DBusError error;
++
++ if (transaction == NULL)
++ {
++ return BUS_RESULT_FALSE;
++ }
++
++ dbus_error_init(&error);
++
++ if (!deferred_message->full_dispatch)
++ {
++ result = deferred_message->response;
++ if (result == BUS_RESULT_TRUE)
++ {
++ if (!bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient,
++ deferred_message->sender, deferred_message->message, deferred_message->requested_reply, &error))
++ result = BUS_RESULT_FALSE;
++ }
++ else if (result == BUS_RESULT_LATER)
++ {
++ BusDeferredMessage *deferred_message2;
++ result = bus_context_check_security_policy (context, transaction,
++ deferred_message->sender,
++ deferred_message->addressed_recipient,
++ deferred_message->proposed_recipient,
++ deferred_message->message, NULL,
++ &deferred_message2);
++
++ if (result == BUS_RESULT_LATER)
++ {
++ /* prepend at recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message2, transaction,
++ FALSE, TRUE))
++ result = BUS_RESULT_FALSE;
++ }
++ }
++
++ /* silently drop messages on access denial */
++ if (result == BUS_RESULT_TRUE)
++ {
++ if (!bus_transaction_send (transaction, deferred_message->proposed_recipient, deferred_message->message, TRUE))
++ result = BUS_RESULT_FALSE;
++ }
++
++ bus_transaction_execute_and_free(transaction);
++
++ goto out;
++ }
++
++ /* do not attempt to send message if sender has disconnected */
++ if (deferred_message->sender != NULL && !bus_connection_is_active(deferred_message->sender))
++ {
++ bus_transaction_cancel_and_free(transaction);
++ result = BUS_RESULT_FALSE;
++ goto out;
++ }
++
++ result = bus_dispatch_matches(transaction, deferred_message->sender,
++ deferred_message->addressed_recipient, deferred_message->message, deferred_message, &error);
++
++ if (result == BUS_RESULT_LATER)
++ {
++ /* Message deferring was already done in bus_dispatch_matches */
++ bus_transaction_cancel_and_free(transaction);
++ goto out;
++ }
++
++ /* this part is a copy & paste from bus_dispatch function. Probably can be moved to a function */
++ if (dbus_error_is_set (&error))
++ {
++ if (!dbus_connection_get_is_connected (deferred_message->sender))
++ {
++ /* If we disconnected it, we won't bother to send it any error
++ * messages.
++ */
++ _dbus_verbose ("Not sending error to connection we disconnected\n");
++ }
++ else if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
++ {
++ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message);
++
++ /* cancel transaction due to OOM */
++ if (transaction != NULL)
++ {
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ }
++ }
++ else
++ {
++ /* Try to send the real error, if no mem to do that, send
++ * the OOM error
++ */
++ _dbus_assert (transaction != NULL);
++ if (!bus_transaction_send_error_reply (transaction, deferred_message->sender,
++ &error, deferred_message->message))
++ {
++ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message);
++
++ /* cancel transaction due to OOM */
++ if (transaction != NULL)
++ {
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ }
++ }
++ }
++ }
++
++ if (transaction != NULL)
++ {
++ bus_transaction_execute_and_free (transaction);
++ }
++
++out:
++ dbus_error_free(&error);
++
++ return result;
++}
++
++dbus_bool_t
++bus_deferred_message_replace (BusDeferredMessage *old_message, BusDeferredMessage *new_message)
++{
++ if (bus_connection_replace_deferred_message(old_message->proposed_recipient,
++ old_message, new_message))
++ {
++ new_message->response_callback = old_message->response_callback;
++ new_message->full_dispatch = old_message->full_dispatch;
++ return TRUE;
++ }
++ return FALSE;
++}
++
++dbus_bool_t
++bus_deferred_message_waits_for_check(BusDeferredMessage *deferred_message)
++{
++ return deferred_message->status != 0;
++}
++
++DBusConnection *
++bus_deferred_message_get_recipient(BusDeferredMessage *deferred_message)
++{
++ return deferred_message->proposed_recipient;
++}
++
+ BusDeferredMessageStatus
+ bus_deferred_message_get_status (BusDeferredMessage *deferred_message)
+ {
+ return deferred_message->status;
+ }
+
++BusResult
++bus_deferred_message_get_response (BusDeferredMessage *deferred_message)
++{
++ return deferred_message->response;
++}
++
+ void
+ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result)
+@@ -310,3 +616,4 @@ bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ deferred_message->response_callback(deferred_message, result);
+ }
+ }
++
+diff --git a/bus/check.h b/bus/check.h
+index d1775497..9c13c184 100644
+--- a/bus/check.h
++++ b/bus/check.h
+@@ -64,12 +64,37 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *messag
+
+ BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_unref (BusDeferredMessage *deferred_message);
++BusResult bus_deferred_message_dispatch (BusDeferredMessage *deferred_message);
++dbus_bool_t bus_deferred_message_waits_for_check (BusDeferredMessage *deferred_message);
++DBusConnection *bus_deferred_message_get_recipient (BusDeferredMessage *deferred_message);
+ void bus_deferred_message_response_received (BusDeferredMessage *deferred_message,
+ BusResult result);
++dbus_bool_t bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ dbus_bool_t full_dispatch,
++ dbus_bool_t prepend);
++dbus_bool_t bus_deferred_message_replace (BusDeferredMessage *old_message,
++ BusDeferredMessage *new_message);
+ void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message);
++BusResult bus_deferred_message_get_response (BusDeferredMessage *deferred_message);
+
+ BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message);
+
++
++dbus_bool_t bus_deferred_message_expect_method_reply (BusDeferredMessage *deferred_message,
++ BusTransaction *transaction,
++ DBusError *error);
++void bus_deferred_message_create_error (BusDeferredMessage *deferred_message,
++ const char *error_message,
++ DBusError *error);
++void bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message,
++ dbus_bool_t requested_reply,
++ int matched_rules,
++ const char *privilege);
++dbus_bool_t bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message,
++ DBusError *error);
++
++
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+ extern BusResult (*bus_check_test_override) (DBusConnection *connection,
+ const char *privilege);
+diff --git a/bus/connection.c b/bus/connection.c
+index eea50ecd..1c0bdffb 100644
+--- a/bus/connection.c
++++ b/bus/connection.c
+@@ -31,11 +31,13 @@
+ #include "expirelist.h"
+ #include "selinux.h"
+ #include "apparmor.h"
++#include "check.h"
+ #include <dbus/dbus-list.h>
+ #include <dbus/dbus-hash.h>
+ #include <dbus/dbus-timeout.h>
+ #include <dbus/dbus-connection-internal.h>
+ #include <dbus/dbus-internals.h>
++#include <dbus/dbus-message-internal.h>
+ #ifdef DBUS_ENABLE_CYNARA
+ #include <stdlib.h>
+ #include <cynara-session.h>
+@@ -102,6 +104,7 @@ typedef struct
+ DBusMessage *oom_message;
+ DBusPreallocatedSend *oom_preallocated;
+ BusClientPolicy *policy;
++ DBusList *deferred_messages; /**< Queue of messages deferred due to pending policy check */
+
+ char *cached_loginfo_string;
+ BusSELinuxID *selinux_id;
+@@ -268,6 +271,8 @@ bus_connection_disconnected (DBusConnection *connection)
+ bus_transaction_execute_and_free (transaction);
+ }
+
++ bus_connection_clear_deferred_messages(connection);
++
+ bus_dispatch_remove_connection (connection);
+
+ /* no more watching */
+@@ -2264,7 +2269,7 @@ bus_transaction_capture (BusTransaction *transaction,
+ {
+ DBusConnection *recipient = link->data;
+
+- if (!bus_transaction_send (transaction, recipient, message))
++ if (!bus_transaction_send (transaction, recipient, message, FALSE))
+ goto out;
+ }
+
+@@ -2317,6 +2322,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ {
+ DBusError error = DBUS_ERROR_INIT;
+ BusResult res;
++ BusDeferredMessage *deferred_message;
+
+ /* We have to set the sender to the driver, and have
+ * to check security policy since it was not done in
+@@ -2357,7 +2363,8 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ res = bus_context_check_security_policy (bus_transaction_get_context (transaction),
+ transaction,
+ NULL, connection, connection, message, &error,
+- NULL);
++ &deferred_message);
++
+ if (res == BUS_RESULT_FALSE)
+ {
+ if (!bus_transaction_capture_error_reply (transaction, &error, message))
+@@ -2374,18 +2381,20 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
+ }
+ else if (res == BUS_RESULT_LATER)
+ {
+- _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n");
+ dbus_error_free (&error);
+- return TRUE;
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE))
++ return FALSE;
++ return TRUE; /* pretend to have sent it */
+ }
+
+- return bus_transaction_send (transaction, connection, message);
++ return bus_transaction_send (transaction, connection, message, FALSE);
+ }
+
+ dbus_bool_t
+ bus_transaction_send (BusTransaction *transaction,
+ DBusConnection *connection,
+- DBusMessage *message)
++ DBusMessage *message,
++ dbus_bool_t deferred_dispatch)
+ {
+ MessageToSend *to_send;
+ BusConnectionData *d;
+@@ -2411,7 +2420,28 @@ bus_transaction_send (BusTransaction *transaction,
+
+ d = BUS_CONNECTION_DATA (connection);
+ _dbus_assert (d != NULL);
+-
++
++ if (!deferred_dispatch && d->deferred_messages != NULL)
++ {
++ BusDeferredMessage *deferred_message;
++ dbus_bool_t success;
++ /* sender and addressed recipient are not required at this point as we only need to send message
++ * to a single recipient without performing policy check. */
++ deferred_message = bus_deferred_message_new (message,
++ NULL,
++ NULL,
++ connection,
++ BUS_RESULT_TRUE);
++ if (deferred_message == NULL)
++ return FALSE;
++
++ success = bus_deferred_message_queue_at_recipient(deferred_message, transaction,
++ FALSE, FALSE);
++ bus_deferred_message_unref(deferred_message);
++
++ return success;
++ }
++
+ to_send = dbus_new (MessageToSend, 1);
+ if (to_send == NULL)
+ {
+@@ -2663,6 +2693,131 @@ bus_transaction_add_cancel_hook (BusTransaction *transaction,
+ return TRUE;
+ }
+
++void
++bus_connection_dispatch_deferred (DBusConnection *connection)
++{
++ BusDeferredMessage *message;
++
++ _dbus_return_if_fail (connection != NULL);
++
++ while ((message = bus_connection_pop_deferred_message(connection)) != NULL)
++ {
++ bus_deferred_message_dispatch(message);
++ bus_deferred_message_unref(message);
++ }
++}
++
++dbus_bool_t
++bus_connection_has_deferred_messages (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ return d->deferred_messages != NULL ? TRUE : FALSE;
++}
++
++dbus_bool_t
++bus_connection_queue_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message,
++ dbus_bool_t prepend)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ dbus_bool_t success;
++ if (prepend)
++ success = _dbus_list_prepend(&d->deferred_messages, message);
++ else
++ success = _dbus_list_append(&d->deferred_messages, message);
++
++ if (success)
++ {
++ bus_deferred_message_ref(message);
++ return TRUE;
++ }
++
++ return FALSE;
++}
++
++dbus_bool_t
++bus_connection_replace_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *oldMessage,
++ BusDeferredMessage *newMessage)
++{
++ DBusList *link;
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++
++ link = _dbus_list_find_first(&d->deferred_messages, oldMessage);
++ if (link == NULL)
++ return FALSE;
++
++ if (!_dbus_list_insert_after(&d->deferred_messages, link, newMessage))
++ return FALSE;
++
++ bus_deferred_message_ref(newMessage);
++ _dbus_list_remove_link(&d->deferred_messages, link);
++ bus_deferred_message_unref(oldMessage);
++ return TRUE;
++}
++
++BusDeferredMessage *
++bus_connection_pop_deferred_message (DBusConnection *connection)
++{
++ DBusList *link;
++ BusDeferredMessage *message;
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++
++ link =_dbus_list_get_first_link(&d->deferred_messages);
++ if (link != NULL)
++ {
++ message = link->data;
++ if (!bus_deferred_message_waits_for_check(message))
++ {
++ _dbus_list_remove_link(&d->deferred_messages, link);
++ return message;
++ }
++ }
++
++ return NULL;
++}
++
++dbus_bool_t
++bus_connection_putback_deferred_message (DBusConnection *connection, BusDeferredMessage *message)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ if (_dbus_list_prepend(&d->deferred_messages, message))
++ {
++ return TRUE;
++ }
++ return FALSE;
++}
++
++void
++bus_connection_clear_deferred_messages (DBusConnection *connection)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ DBusList *link;
++ DBusList *next;
++ BusDeferredMessage *message;
++
++ link =_dbus_list_get_first_link(&d->deferred_messages);
++ while (link != NULL)
++ {
++ next = _dbus_list_get_next_link (&d->deferred_messages, link);
++ message = link->data;
++
++ bus_deferred_message_unref(message);
++ _dbus_list_remove_link(&d->deferred_messages, link);
++
++ link = next;
++ }
++}
++
++void
++bus_connection_remove_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message)
++{
++ BusConnectionData *d = BUS_CONNECTION_DATA(connection);
++ if (_dbus_list_remove(&d->deferred_messages, message))
++ bus_deferred_message_unref(message);
++}
++
+ int
+ bus_connections_get_n_active (BusConnections *connections)
+ {
+diff --git a/bus/connection.h b/bus/connection.h
+index a6e5dfde..46e883e6 100644
+--- a/bus/connection.h
++++ b/bus/connection.h
+@@ -83,6 +83,22 @@ dbus_bool_t bus_connection_preallocate_oom_error (DBusConnection *connection);
+ void bus_connection_send_oom_error (DBusConnection *connection,
+ DBusMessage *in_reply_to);
+
++dbus_bool_t bus_connection_has_deferred_messages (DBusConnection *connection);
++dbus_bool_t bus_connection_queue_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message,
++ dbus_bool_t prepend);
++BusDeferredMessage *bus_connection_pop_deferred_message (DBusConnection *connection);
++dbus_bool_t bus_connection_putback_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message);
++void bus_connection_remove_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *message);
++dbus_bool_t bus_connection_replace_deferred_message (DBusConnection *connection,
++ BusDeferredMessage *oldMessage,
++ BusDeferredMessage *newMessage);
++void bus_connection_dispatch_deferred (DBusConnection *connection);
++void bus_connection_clear_deferred_messages (DBusConnection *connection);
++
++
+ /* called by signals.c */
+ dbus_bool_t bus_connection_add_match_rule (DBusConnection *connection,
+ BusMatchRule *rule);
+@@ -135,7 +151,8 @@ BusTransaction* bus_transaction_new (BusContext *
+ BusContext* bus_transaction_get_context (BusTransaction *transaction);
+ dbus_bool_t bus_transaction_send (BusTransaction *transaction,
+ DBusConnection *connection,
+- DBusMessage *message);
++ DBusMessage *message,
++ dbus_bool_t deferred_dispatch);
+ dbus_bool_t bus_transaction_capture (BusTransaction *transaction,
+ DBusConnection *connection,
+ DBusMessage *message);
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index 7353501b..e32c9263 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -33,6 +33,7 @@
+ #include "utils.h"
+ #include "bus.h"
+ #include "signals.h"
++#include "dispatch.h"
+ #include "test.h"
+ #include <dbus/dbus-internals.h>
+ #include <dbus/dbus-connection-internal.h>
+@@ -76,7 +77,7 @@ send_one_message (DBusConnection *connection,
+ message,
+ &stack_error,
+ &deferred_message);
+- if (result != BUS_RESULT_TRUE)
++ if (result == BUS_RESULT_FALSE)
+ {
+ if (!bus_transaction_capture_error_reply (transaction, &stack_error,
+ message))
+@@ -111,9 +112,19 @@ send_one_message (DBusConnection *connection,
+ return TRUE; /* don't send it but don't return an error either */
+ }
+
++ if (result == BUS_RESULT_LATER)
++ {
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE))
++ {
++ BUS_SET_OOM (error);
++ return FALSE;
++ }
++ return TRUE; /* pretend to have sent it */
++ }
++
+ if (!bus_transaction_send (transaction,
+ connection,
+- message))
++ message, FALSE))
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+@@ -123,11 +134,12 @@ send_one_message (DBusConnection *connection,
+ }
+
+ BusResult
+-bus_dispatch_matches (BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *addressed_recipient,
+- DBusMessage *message,
+- DBusError *error)
++bus_dispatch_matches (BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *addressed_recipient,
++ DBusMessage *message,
++ BusDeferredMessage *dispatched_deferred_message,
++ DBusError *error)
+ {
+ DBusError tmp_error;
+ BusConnections *connections;
+@@ -151,17 +163,78 @@ bus_dispatch_matches (BusTransaction *transaction,
+ /* First, send the message to the addressed_recipient, if there is one. */
+ if (addressed_recipient != NULL)
+ {
+- BusResult res;
+- res = bus_context_check_security_policy (context, transaction,
+- sender, addressed_recipient,
+- addressed_recipient,
+- message, error,
+- &deferred_message);
+- if (res == BUS_RESULT_FALSE)
++ BusResult result;
++ /* To maintain message order message needs to be appended at the recipient if there are already
++ * deferred messages and we are not doing deferred dispatch
++ */
++ if (dispatched_deferred_message == NULL && bus_connection_has_deferred_messages(addressed_recipient))
++ {
++ deferred_message = bus_deferred_message_new(message, sender,
++ addressed_recipient, addressed_recipient, BUS_RESULT_LATER);
++
++ if (deferred_message == NULL)
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE))
++ {
++ bus_deferred_message_unref(deferred_message);
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ bus_deferred_message_unref(deferred_message);
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
++ }
++
++ if (dispatched_deferred_message != NULL)
++ {
++ result = bus_deferred_message_get_response(dispatched_deferred_message);
++ if (result == BUS_RESULT_TRUE)
++ {
++ /* if we know the result of policy check we still need to check if message limits
++ * are not exceeded. It is also required to add entry in expected replies list if
++ * this is a method call
++ */
++ if (!bus_deferred_message_check_message_limits(dispatched_deferred_message, error))
++ return BUS_RESULT_FALSE;
++
++ if (!bus_deferred_message_expect_method_reply(dispatched_deferred_message, transaction, error))
++ return BUS_RESULT_FALSE;
++ }
++ else if (result == BUS_RESULT_FALSE)
++ {
++ bus_deferred_message_create_error(dispatched_deferred_message, "Rejected message", error);
++ return BUS_RESULT_FALSE;
++ }
++ }
++ else
++ result = BUS_RESULT_LATER;
++
++ if (result == BUS_RESULT_LATER)
++ result = bus_context_check_security_policy(context, transaction,
++ sender, addressed_recipient, addressed_recipient, message, error,
++ &deferred_message);
++
++ if (result == BUS_RESULT_FALSE)
+ return BUS_RESULT_FALSE;
+- else if (res == BUS_RESULT_LATER)
++ else if (result == BUS_RESULT_LATER)
+ {
+ BusDeferredMessageStatus status;
++
++ if (dispatched_deferred_message != NULL)
++ {
++ /* for deferred dispatch prepend message at the recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, TRUE))
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
++ }
++
+ status = bus_deferred_message_get_status(deferred_message);
+
+ if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND)
+@@ -172,13 +245,18 @@ bus_dispatch_matches (BusTransaction *transaction,
+ }
+ else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE)
+ {
+- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+- "Rejecting message because time is needed to check security policy");
+- return BUS_RESULT_FALSE;
++ /* receive rule result not available - queue message at the recipient */
++ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE))
++ {
++ BUS_SET_OOM(error);
++ return BUS_RESULT_FALSE;
++ }
++
++ return BUS_RESULT_TRUE; /* pretend to have sent it */
+ }
+ else
+ {
+- _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n");
++ _dbus_verbose("deferred message has no status field set unexpectedly\n");
+ return BUS_RESULT_FALSE;
+ }
+ }
+@@ -195,7 +273,8 @@ bus_dispatch_matches (BusTransaction *transaction,
+ }
+
+ /* Dispatch the message */
+- if (!bus_transaction_send (transaction, addressed_recipient, message))
++ if (!bus_transaction_send(transaction, addressed_recipient, message,
++ dispatched_deferred_message != NULL ? TRUE : FALSE))
+ {
+ BUS_SET_OOM (error);
+ return BUS_RESULT_FALSE;
+@@ -495,7 +574,7 @@ bus_dispatch (DBusConnection *connection,
+ * match rules.
+ */
+ if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient,
+- message, &error))
++ message, NULL, &error))
+ {
+ /* Roll back and dispatch the message once the policy result is available */
+ bus_transaction_cancel_and_free (transaction);
+diff --git a/bus/dispatch.h b/bus/dispatch.h
+index afba6a24..f6102e80 100644
+--- a/bus/dispatch.h
++++ b/bus/dispatch.h
+@@ -29,10 +29,11 @@
+
+ dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection);
+ void bus_dispatch_remove_connection (DBusConnection *connection);
+-BusResult bus_dispatch_matches (BusTransaction *transaction,
+- DBusConnection *sender,
+- DBusConnection *recipient,
+- DBusMessage *message,
+- DBusError *error);
++BusResult bus_dispatch_matches (BusTransaction *transaction,
++ DBusConnection *sender,
++ DBusConnection *recipient,
++ DBusMessage *message,
++ BusDeferredMessage *dispatched_deferred_message,
++ DBusError *error);
+
+ #endif /* BUS_DISPATCH_H */
+diff --git a/bus/driver.c b/bus/driver.c
+index a5823d4d..5acdd62a 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -261,7 +261,7 @@ bus_driver_send_service_owner_changed (const char *service_name,
+ if (!bus_transaction_capture (transaction, NULL, message))
+ goto oom;
+
+- res = bus_dispatch_matches (transaction, NULL, NULL, message, error);
++ res = bus_dispatch_matches (transaction, NULL, NULL, message, NULL, error);
+ if (res == BUS_RESULT_TRUE)
+ retval = TRUE;
+ else
+diff --git a/bus/policy.c b/bus/policy.c
+index bcade176..47bd1a24 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -1071,6 +1071,9 @@ bus_client_policy_check_can_send (DBusConnection *sender,
+
+ result = bus_check_privilege(check, message, sender, addressed_recipient, receiver,
+ privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message);
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply,
++ *toggles, privilege);
+ }
+ else
+ privilege = NULL;
+@@ -1305,6 +1308,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+
+ result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient,
+ privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message);
++ if (result == BUS_RESULT_LATER && deferred_message != NULL)
++ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply,
++ *toggles, privilege);
+ }
+ else
+ privilege = NULL;
+--
+2.14.3
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus/0004-Add-own-rule-result-unavailability-handling.patch b/meta-security/recipes-core/dbus-cynara/dbus/0004-Add-own-rule-result-unavailability-handling.patch
new file mode 100644
index 000000000..1086f5b12
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus/0004-Add-own-rule-result-unavailability-handling.patch
@@ -0,0 +1,1345 @@
+From 5bf7f759a738a451ea70732731d9a1b3e064353b Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Thu, 27 Nov 2014 11:26:21 +0100
+Subject: [PATCH 4/5] Add own rule result unavailability handling
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Own rule result unavailability is handled like send rules - dispatching
+messages from the sender is blocked and resumed when result becomes
+available.
+
+Handler of "RequestName" method needs to return BUS_RESULT_LATER when
+policy result is not known therefore its return type is modified.
+Since bus message handlers are put into function pointer array other
+message handler function singatures are also affected.
+
+Change-Id: I4c2cbd4585e41fccd8a30f825a8f0d342ab56755
+
+Cherry-picked from 35ef89cd6777ea2430077fc621d21bd01df92349 by Jose.bollo
+
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ bus/dispatch.c | 11 ++-
+ bus/driver.c | 259 ++++++++++++++++++++++++++++++---------------------------
+ bus/driver.h | 2 +-
+ bus/policy.c | 51 +++++++++---
+ bus/policy.h | 6 +-
+ bus/services.c | 26 ++++--
+ bus/services.h | 3 +-
+ bus/stats.c | 28 +++----
+ bus/stats.h | 6 +-
+ 9 files changed, 229 insertions(+), 163 deletions(-)
+
+diff --git a/bus/dispatch.c b/bus/dispatch.c
+index e32c9263..4d57c556 100644
+--- a/bus/dispatch.c
++++ b/bus/dispatch.c
+@@ -513,8 +513,17 @@ bus_dispatch (DBusConnection *connection,
+ }
+
+ _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
+- if (!bus_driver_handle_message (connection, transaction, message, &error))
++ res = bus_driver_handle_message (connection, transaction, message, &error);
++ if (res == BUS_RESULT_FALSE)
+ goto out;
++ else if (res == BUS_RESULT_LATER)
++ {
++ /* connection has been disabled in message handler */
++ bus_transaction_cancel_and_free (transaction);
++ transaction = NULL;
++ result = DBUS_HANDLER_RESULT_LATER;
++ goto out;
++ }
+ }
+ else if (!bus_connection_is_active (connection)) /* clients must talk to bus driver first */
+ {
+diff --git a/bus/driver.c b/bus/driver.c
+index 5acdd62a..bc4ce0b5 100644
+--- a/bus/driver.c
++++ b/bus/driver.c
+@@ -427,7 +427,7 @@ create_unique_client_name (BusRegistry *registry,
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_hello (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -435,7 +435,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ {
+ DBusString unique_name;
+ BusService *service;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+ BusConnections *connections;
+
+@@ -446,7 +446,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ /* We already handled an Hello message for this connection. */
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Already handled an Hello message");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /* Note that when these limits are exceeded we don't disconnect the
+@@ -460,16 +460,16 @@ bus_driver_handle_hello (DBusConnection *connection,
+ error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!_dbus_string_init (&unique_name))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ registry = bus_connection_get_registry (connection);
+
+@@ -502,7 +502,7 @@ bus_driver_handle_hello (DBusConnection *connection,
+ goto out_0;
+
+ _dbus_assert (bus_connection_is_active (connection));
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out_0:
+ _dbus_string_free (&unique_name);
+@@ -554,7 +554,7 @@ bus_driver_send_welcome_message (DBusConnection *connection,
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_services (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -576,14 +576,14 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ if (reply == NULL)
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_registry_list_services (registry, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ dbus_message_iter_init_append (reply, &iter);
+@@ -595,7 +595,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ {
+@@ -607,7 +607,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -620,7 +620,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ ++i;
+ }
+@@ -631,23 +631,23 @@ bus_driver_handle_list_services (DBusConnection *connection,
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_transaction_send_from_driver (transaction, connection, reply))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+ {
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -669,14 +669,14 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ if (reply == NULL)
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_activation_list_services (activation, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ dbus_message_iter_init_append (reply, &iter);
+@@ -688,7 +688,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ {
+@@ -700,7 +700,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ }
+
+@@ -713,7 +713,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ ++i;
+ }
+@@ -724,23 +724,23 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_transaction_send_from_driver (transaction, connection, reply))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ else
+ {
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_acquire_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -751,7 +751,8 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ const char *name;
+ dbus_uint32_t service_reply;
+ dbus_uint32_t flags;
+- dbus_bool_t retval;
++ BusResult retval;
++ BusResult res;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -762,20 +763,24 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_UINT32, &flags,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+ reply = NULL;
+
+ _dbus_string_init_const (&service_name, name);
+
+- if (!bus_registry_acquire_service (registry, connection,
+- &service_name, flags,
+- &service_reply, transaction,
+- error))
+- goto out;
++ res = bus_registry_acquire_service (registry, connection, message,
++ &service_name, flags,
++ &service_reply, transaction,
++ error);
++ if (res != BUS_RESULT_TRUE)
++ {
++ retval = res;
++ goto out;
++ }
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+@@ -796,7 +801,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -804,7 +809,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_release_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -814,7 +819,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ DBusString service_name;
+ const char *name;
+ dbus_uint32_t service_reply;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -824,11 +829,11 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ if (!dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_verbose ("Trying to release name %s\n", name);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+ reply = NULL;
+
+ _dbus_string_init_const (&service_name, name);
+@@ -857,7 +862,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -865,7 +870,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_service_exists (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -876,7 +881,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ BusService *service;
+ dbus_bool_t service_exists;
+ const char *name;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusRegistry *registry;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -886,9 +891,9 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ if (!dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (strcmp (name, DBUS_SERVICE_DBUS) == 0)
+ {
+@@ -922,7 +927,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (reply)
+@@ -931,7 +936,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_activate_service (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -939,7 +944,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ {
+ dbus_uint32_t flags;
+ const char *name;
+- dbus_bool_t retval;
++ BusResult retval;
+ BusActivation *activation;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -953,10 +958,10 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_verbose ("No memory to get arguments to StartServiceByName\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (!bus_activation_activate_service (activation, connection, transaction, FALSE,
+ message, name, error))
+@@ -966,7 +971,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
+ goto out;
+ }
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ return retval;
+@@ -1068,13 +1073,13 @@ bus_driver_send_or_activate (BusTransaction *transaction,
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+ {
+- dbus_bool_t retval;
++ BusResult retval;
+ BusActivation *activation;
+ BusContext *context;
+ DBusMessageIter iter;
+@@ -1090,7 +1095,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (!bus_driver_check_message_is_for_us (message, error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ #ifdef DBUS_UNIX
+ {
+@@ -1100,7 +1105,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ */
+ if (!bus_driver_check_caller_is_privileged (connection, transaction,
+ message, error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ #endif
+
+@@ -1111,7 +1116,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Cannot change activation environment "
+ "on a system bus.");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ activation = bus_connection_get_activation (connection);
+@@ -1125,7 +1130,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+
+ dbus_message_iter_recurse (&iter, &dict_iter);
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+ systemd_message = NULL;
+
+ /* Then loop through the sent dictionary, add the location of
+@@ -1291,7 +1296,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ message, error))
+ goto out;
+
+- retval = TRUE;
++ retval = BUS_RESULT_TRUE;
+
+ out:
+ if (systemd_message != NULL)
+@@ -1301,7 +1306,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ return retval;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_add_match (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1367,16 +1372,16 @@ bus_driver_handle_add_match (DBusConnection *connection,
+
+ bus_match_rule_unref (rule);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (rule)
+ bus_match_rule_unref (rule);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_remove_match (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1420,16 +1425,16 @@ bus_driver_handle_remove_match (DBusConnection *connection,
+
+ bus_match_rule_unref (rule);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (rule)
+ bus_match_rule_unref (rule);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_service_owner (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1499,7 +1504,7 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1508,10 +1513,10 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1602,7 +1607,7 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1615,10 +1620,10 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
+ if (base_names)
+ _dbus_list_clear (&base_names);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1673,7 +1678,7 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1682,10 +1687,10 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1740,7 +1745,7 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1749,10 +1754,10 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1803,7 +1808,7 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1812,10 +1817,10 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1863,7 +1868,7 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -1872,10 +1877,10 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -1987,7 +1992,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+
+ dbus_message_unref (reply);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -2001,10 +2006,10 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
+ dbus_message_unref (reply);
+ }
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_reload_config (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2029,7 +2034,7 @@ bus_driver_handle_reload_config (DBusConnection *connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -2038,11 +2043,11 @@ bus_driver_handle_reload_config (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ #ifdef DBUS_ENABLE_VERBOSE_MODE
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_enable_verbose (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2062,7 +2067,7 @@ bus_driver_handle_enable_verbose (DBusConnection *connection,
+ _dbus_set_verbose(TRUE);
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -2071,10 +2076,10 @@ bus_driver_handle_enable_verbose (DBusConnection *connection,
+
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_disable_verbose (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2094,7 +2099,7 @@ bus_driver_handle_disable_verbose (DBusConnection *connection,
+ _dbus_set_verbose(FALSE);
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -2103,11 +2108,11 @@ bus_driver_handle_disable_verbose (DBusConnection *connection,
+
+ if (reply)
+ dbus_message_unref (reply);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+ #endif
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_get_id (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2123,7 +2128,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
+ if (!_dbus_string_init (&uuid))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ reply = NULL;
+@@ -2149,7 +2154,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
+
+ _dbus_string_free (&uuid);
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+@@ -2159,10 +2164,10 @@ bus_driver_handle_get_id (DBusConnection *connection,
+ if (reply)
+ dbus_message_unref (reply);
+ _dbus_string_free (&uuid);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_become_monitor (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2178,7 +2183,7 @@ bus_driver_handle_become_monitor (DBusConnection *connection,
+ int i;
+ int n_match_rules;
+ dbus_uint32_t flags;
+- dbus_bool_t ret = FALSE;
++ BusResult ret = BUS_RESULT_FALSE;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+@@ -2258,10 +2263,10 @@ bus_driver_handle_become_monitor (DBusConnection *connection,
+ if (!bus_connection_be_monitor (connection, transaction, &rules, error))
+ goto out;
+
+- ret = TRUE;
++ ret = BUS_RESULT_TRUE;
+
+ out:
+- if (ret)
++ if (ret == BUS_RESULT_TRUE)
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ else
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+@@ -2282,10 +2287,10 @@ typedef struct
+ const char *name;
+ const char *in_args;
+ const char *out_args;
+- dbus_bool_t (* handler) (DBusConnection *connection,
+- BusTransaction *transaction,
+- DBusMessage *message,
+- DBusError *error);
++ BusResult (* handler) (DBusConnection *connection,
++ BusTransaction *transaction,
++ DBusMessage *message,
++ DBusError *error);
+ } MessageHandler;
+
+ /* For speed it might be useful to sort this in order of
+@@ -2370,7 +2375,7 @@ static const MessageHandler dbus_message_handlers[] = {
+ { NULL, NULL, NULL, NULL }
+ };
+
+-static dbus_bool_t bus_driver_handle_introspect (DBusConnection *,
++static BusResult bus_driver_handle_introspect (DBusConnection *,
+ BusTransaction *, DBusMessage *, DBusError *);
+
+ static const MessageHandler introspectable_message_handlers[] = {
+@@ -2514,7 +2519,7 @@ bus_driver_generate_introspect_string (DBusString *xml)
+ return TRUE;
+ }
+
+-static dbus_bool_t
++static BusResult
+ bus_driver_handle_introspect (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2534,13 +2539,13 @@ bus_driver_handle_introspect (DBusConnection *connection,
+ DBUS_TYPE_INVALID))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!_dbus_string_init (&xml))
+ {
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ if (!bus_driver_generate_introspect_string (&xml))
+@@ -2563,7 +2568,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
+ dbus_message_unref (reply);
+ _dbus_string_free (&xml);
+
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+@@ -2573,7 +2578,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
+
+ _dbus_string_free (&xml);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ /*
+@@ -2608,7 +2613,7 @@ bus_driver_check_message_is_for_us (DBusMessage *message,
+ return TRUE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_driver_handle_message (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -2618,6 +2623,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ const InterfaceHandler *ih;
+ const MessageHandler *mh;
+ dbus_bool_t found_interface = FALSE;
++ BusResult res;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+@@ -2633,7 +2639,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ transaction,
+ message,
+ error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ context = bus_connection_get_context (connection);
+ systemd = bus_driver_get_owner_of_name (connection,
+@@ -2650,7 +2656,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ attacker ? attacker : "(unauthenticated)",
+ bus_connection_get_loginfo (connection));
+ /* ignore it */
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+
+ if (!bus_context_get_systemd_activation (context))
+@@ -2658,16 +2664,16 @@ bus_driver_handle_message (DBusConnection *connection,
+ bus_context_log (context, DBUS_SYSTEM_LOG_WARNING,
+ "Ignoring unexpected ActivationFailure message "
+ "while not using systemd activation");
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- return dbus_activation_systemd_failure(bus_context_get_activation(context), message);
++ return dbus_activation_systemd_failure(bus_context_get_activation(context), message) == TRUE ? BUS_RESULT_TRUE : BUS_RESULT_FALSE;
+ }
+
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
+ {
+ _dbus_verbose ("Driver got a non-method-call message, ignoring\n");
+- return TRUE; /* we just ignore this */
++ return BUS_RESULT_TRUE; /* we just ignore this */
+ }
+
+ /* may be NULL, which means "any interface will do" */
+@@ -2709,20 +2715,27 @@ bus_driver_handle_message (DBusConnection *connection,
+ name, dbus_message_get_signature (message),
+ mh->in_args);
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+- if ((* mh->handler) (connection, transaction, message, error))
++ res = (* mh->handler) (connection, transaction, message, error);
++ if (res == BUS_RESULT_TRUE)
+ {
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ _dbus_verbose ("Driver handler succeeded\n");
+- return TRUE;
++ return BUS_RESULT_TRUE;
+ }
+- else
++ else if (res == BUS_RESULT_FALSE)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_verbose ("Driver handler returned failure\n");
+- return FALSE;
++ return BUS_RESULT_FALSE;
++ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
++ _dbus_verbose ("Driver handler delayed message processing due to policy check\n");
++ return BUS_RESULT_LATER;
+ }
+ }
+ }
+@@ -2734,7 +2747,7 @@ bus_driver_handle_message (DBusConnection *connection,
+ "%s does not understand message %s",
+ DBUS_SERVICE_DBUS, name);
+
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ void
+diff --git a/bus/driver.h b/bus/driver.h
+index 201709c4..3ff4ff15 100644
+--- a/bus/driver.h
++++ b/bus/driver.h
+@@ -28,7 +28,7 @@
+ #include "connection.h"
+
+ void bus_driver_remove_connection (DBusConnection *connection);
+-dbus_bool_t bus_driver_handle_message (DBusConnection *connection,
++BusResult bus_driver_handle_message (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+diff --git a/bus/policy.c b/bus/policy.c
+index 47bd1a24..7244a46f 100644
+--- a/bus/policy.c
++++ b/bus/policy.c
+@@ -1323,18 +1323,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
+
+
+
+-static dbus_bool_t
++static BusResult
+ bus_rules_check_can_own (DBusList *rules,
+- const DBusString *service_name)
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message)
+ {
+ DBusList *link;
+- dbus_bool_t allowed;
++ BusResult result;
++ const char *privilege;
+
+ /* rules is in the order the rules appeared
+ * in the config file, i.e. last rule that applies wins
+ */
+
+- allowed = FALSE;
++ result = BUS_RESULT_FALSE;
+ link = _dbus_list_get_first_link (&rules);
+ while (link != NULL)
+ {
+@@ -1370,17 +1373,45 @@ bus_rules_check_can_own (DBusList *rules,
+ }
+
+ /* Use this rule */
+- allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
++ switch (rule->access)
++ {
++ case BUS_POLICY_RULE_ACCESS_ALLOW:
++ result = BUS_RESULT_TRUE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_DENY:
++ result = BUS_RESULT_FALSE;
++ break;
++ case BUS_POLICY_RULE_ACCESS_CHECK:
++ result = BUS_RESULT_LATER;
++ privilege = rule->privilege;
++ break;
++ }
+ }
+
+- return allowed;
++ if (result == BUS_RESULT_LATER)
++ {
++ BusContext *context = bus_connection_get_context(connection);
++ BusCheck *check = bus_context_get_check(context);
++ BusDeferredMessage *deferred_message;
++
++ result = bus_check_privilege(check, message, connection, NULL, NULL,
++ privilege, BUS_DEFERRED_MESSAGE_CHECK_OWN, &deferred_message);
++ if (result == BUS_RESULT_LATER)
++ {
++ bus_deferred_message_disable_sender(deferred_message);
++ }
++ }
++
++ return result;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_client_policy_check_can_own (BusClientPolicy *policy,
+- const DBusString *service_name)
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message)
+ {
+- return bus_rules_check_can_own (policy->rules, service_name);
++ return bus_rules_check_can_own (policy->rules, service_name, connection, message);
+ }
+
+ #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+@@ -1388,7 +1419,7 @@ dbus_bool_t
+ bus_policy_check_can_own (BusPolicy *policy,
+ const DBusString *service_name)
+ {
+- return bus_rules_check_can_own (policy->default_rules, service_name);
++ return bus_rules_check_can_own (policy->default_rules, service_name, NULL, NULL) == BUS_RESULT_TRUE;
+ }
+ #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
+
+diff --git a/bus/policy.h b/bus/policy.h
+index e9f193af..1f234310 100644
+--- a/bus/policy.h
++++ b/bus/policy.h
+@@ -170,8 +170,10 @@ BusResult bus_client_policy_check_can_receive (BusClientPolicy *polic
+ dbus_int32_t *toggles,
+ const char **privilege_param,
+ BusDeferredMessage **deferred_message);
+-dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy,
+- const DBusString *service_name);
++BusResult bus_client_policy_check_can_own (BusClientPolicy *policy,
++ const DBusString *service_name,
++ DBusConnection *connection,
++ DBusMessage *message);
+ dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy,
+ BusPolicyRule *rule);
+ void bus_client_policy_optimize (BusClientPolicy *policy);
+diff --git a/bus/services.c b/bus/services.c
+index 6a4c8848..fcc2d261 100644
+--- a/bus/services.c
++++ b/bus/services.c
+@@ -376,24 +376,26 @@ bus_registry_list_services (BusRegistry *registry,
+ return FALSE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_registry_acquire_service (BusRegistry *registry,
+ DBusConnection *connection,
++ DBusMessage *message,
+ const DBusString *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+ BusTransaction *transaction,
+ DBusError *error)
+ {
+- dbus_bool_t retval;
++ BusResult retval;
+ DBusConnection *old_owner_conn;
+ BusClientPolicy *policy;
+ BusService *service;
+ BusActivation *activation;
+ BusSELinuxID *sid;
+ BusOwner *primary_owner;
++ BusResult res;
+
+- retval = FALSE;
++ retval = BUS_RESULT_FALSE;
+
+ if (!_dbus_validate_bus_name (service_name, 0,
+ _dbus_string_get_length (service_name)))
+@@ -466,7 +468,8 @@ bus_registry_acquire_service (BusRegistry *registry,
+ _dbus_string_get_const_data (service_name), error))
+ goto out;
+
+- if (!bus_client_policy_check_can_own (policy, service_name))
++ res = bus_client_policy_check_can_own (policy, service_name, connection, message);
++ if (res == BUS_RESULT_FALSE)
+ {
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Connection \"%s\" is not allowed to own the service \"%s\" due "
+@@ -477,6 +480,11 @@ bus_registry_acquire_service (BusRegistry *registry,
+ _dbus_string_get_const_data (service_name));
+ goto out;
+ }
++ else if (res == BUS_RESULT_LATER)
++ {
++ retval = BUS_RESULT_LATER;
++ goto out;
++ }
+
+ if (bus_connection_get_n_services_owned (connection) >=
+ bus_context_get_max_services_per_connection (registry->context))
+@@ -593,11 +601,13 @@ bus_registry_acquire_service (BusRegistry *registry,
+ }
+
+ activation = bus_context_get_activation (registry->context);
+- retval = bus_activation_send_pending_auto_activation_messages (activation,
++
++ if (bus_activation_send_pending_auto_activation_messages (activation,
+ service,
+- transaction);
+- if (!retval)
+- BUS_SET_OOM (error);
++ transaction))
++ retval = BUS_RESULT_TRUE;
++ else
++ BUS_SET_OOM (error);
+
+ out:
+ return retval;
+diff --git a/bus/services.h b/bus/services.h
+index 056dd9fa..3df3dd7d 100644
+--- a/bus/services.h
++++ b/bus/services.h
+@@ -50,8 +50,9 @@ void bus_registry_foreach (BusRegistry *registry
+ dbus_bool_t bus_registry_list_services (BusRegistry *registry,
+ char ***listp,
+ int *array_len);
+-dbus_bool_t bus_registry_acquire_service (BusRegistry *registry,
++BusResult bus_registry_acquire_service (BusRegistry *registry,
+ DBusConnection *connection,
++ DBusMessage *message,
+ const DBusString *service_name,
+ dbus_uint32_t flags,
+ dbus_uint32_t *result,
+diff --git a/bus/stats.c b/bus/stats.c
+index dace0e29..aab0e5c9 100644
+--- a/bus/stats.c
++++ b/bus/stats.c
+@@ -36,7 +36,7 @@
+
+ #ifdef DBUS_ENABLE_STATS
+
+-dbus_bool_t
++BusResult
+ bus_stats_handle_get_stats (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -52,7 +52,7 @@ bus_stats_handle_get_stats (DBusConnection *connection,
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (!bus_driver_check_message_is_for_us (message, error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ context = bus_transaction_get_context (transaction);
+ connections = bus_context_get_connections (context);
+@@ -107,17 +107,17 @@ bus_stats_handle_get_stats (DBusConnection *connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+-dbus_bool_t
++BusResult
+ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -137,14 +137,14 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (!bus_driver_check_message_is_for_us (message, error))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ registry = bus_connection_get_registry (caller_connection);
+
+ if (! dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &bus_name,
+ DBUS_TYPE_INVALID))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ _dbus_string_init_const (&bus_name_str, bus_name);
+ service = bus_registry_lookup (registry, &bus_name_str);
+@@ -153,7 +153,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ {
+ dbus_set_error (error, DBUS_ERROR_NAME_HAS_NO_OWNER,
+ "Bus name '%s' has no owner", bus_name);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ stats_connection = bus_service_get_primary_owners_connection (service);
+@@ -215,18 +215,18 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
+ goto oom;
+
+ dbus_message_unref (reply);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ if (reply != NULL)
+ dbus_message_unref (reply);
+
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+
+-dbus_bool_t
++BusResult
+ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+@@ -250,7 +250,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+ matchmaker = bus_context_get_matchmaker (context);
+
+ if (!bus_registry_list_services (registry, &services, &services_len))
+- return FALSE;
++ return BUS_RESULT_FALSE;
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+@@ -329,7 +329,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+
+ dbus_message_unref (reply);
+ dbus_free_string_array (services);
+- return TRUE;
++ return BUS_RESULT_TRUE;
+
+ oom:
+ if (reply != NULL)
+@@ -338,7 +338,7 @@ oom:
+ dbus_free_string_array (services);
+
+ BUS_SET_OOM (error);
+- return FALSE;
++ return BUS_RESULT_FALSE;
+ }
+
+ #endif
+diff --git a/bus/stats.h b/bus/stats.h
+index dcb022c4..683fa175 100644
+--- a/bus/stats.h
++++ b/bus/stats.h
+@@ -25,17 +25,17 @@
+
+ #define BUS_INTERFACE_STATS "org.freedesktop.DBus.Debug.Stats"
+
+-dbus_bool_t bus_stats_handle_get_stats (DBusConnection *connection,
++BusResult bus_stats_handle_get_stats (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+
+-dbus_bool_t bus_stats_handle_get_connection_stats (DBusConnection *connection,
++BusResult bus_stats_handle_get_connection_stats (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+
+-dbus_bool_t bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
++BusResult bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+--
+2.14.3
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus/0005-Perform-Cynara-runtime-policy-checks-by-default.patch b/meta-security/recipes-core/dbus-cynara/dbus/0005-Perform-Cynara-runtime-policy-checks-by-default.patch
new file mode 100644
index 000000000..d30b2dbf8
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus/0005-Perform-Cynara-runtime-policy-checks-by-default.patch
@@ -0,0 +1,123 @@
+From 92a373a6dbb1c7cd7c9824167aac232f3e0daebd Mon Sep 17 00:00:00 2001
+From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+Date: Tue, 23 Jun 2015 11:08:48 +0200
+Subject: [PATCH 5/5] Perform Cynara runtime policy checks by default
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This change introduces http://tizen.org/privilege/internal/dbus privilege
+which is supposed to be available only to trusted system resources.
+Checks for this privilege are used in place of certain allow rules to
+make security policy more strict.
+
+For system bus sending and receiving signals now requires
+http://tizen.org/privilege/internal/dbus privilege. Requesting name
+ownership and sending methods is still denied by default.
+
+For session bus http://tizen.org/privilege/internal/dbus privilege
+is now required for requesting name, calling methods, sending and receiving
+signals.
+
+Services are supposed to override these default settings to implement their
+own security policy.
+
+Change-Id: Ifb4a160bf6e0638404e0295a2e4fa3077efd881c
+Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
+
+Cherry picked from e8610297cf7031e94eb314a2e8c11246f4405403 by Jose Bollo
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ bus/session.conf.in | 32 ++++++++++++++++++++++++++------
+ bus/system.conf.in | 19 +++++++++++++++----
+ 2 files changed, 41 insertions(+), 10 deletions(-)
+
+diff --git a/bus/session.conf.in b/bus/session.conf.in
+index affa7f1d..157dfb4d 100644
+--- a/bus/session.conf.in
++++ b/bus/session.conf.in
+@@ -27,12 +27,32 @@
+ <standard_session_servicedirs />
+
+ <policy context="default">
+- <!-- Allow everything to be sent -->
+- <allow send_destination="*" eavesdrop="true"/>
+- <!-- Allow everything to be received -->
+- <allow eavesdrop="true"/>
+- <!-- Allow anyone to own anything -->
+- <allow own="*"/>
++ <!-- By default clients require internal/dbus privilege to communicate
++ with D-Bus services and to claim name ownership. This is internal privilege that
++ is only accessible to trusted system services -->
++ <check own="*" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check send_type="method_call" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++
++ <!-- Reply messages (method returns, errors) are allowed
++ by default -->
++ <allow send_requested_reply="true" send_type="method_return"/>
++ <allow send_requested_reply="true" send_type="error"/>
++
++ <!-- All messages but signals may be received by default -->
++ <allow receive_type="method_call"/>
++ <allow receive_type="method_return"/>
++ <allow receive_type="error"/>
++
++ <!-- Allow anyone to talk to the message bus -->
++ <allow send_destination="org.freedesktop.DBus"/>
++ <allow receive_sender="org.freedesktop.DBus"/>
++
++ <!-- But disallow some specific bus services -->
++ <deny send_destination="org.freedesktop.DBus"
++ send_interface="org.freedesktop.DBus"
++ send_member="UpdateActivationEnvironment"/>
+ </policy>
+
+ <!-- Include legacy configuration location -->
+diff --git a/bus/system.conf.in b/bus/system.conf.in
+index 014f67ee..ebbd468a 100644
+--- a/bus/system.conf.in
++++ b/bus/system.conf.in
+@@ -50,23 +50,34 @@
+ <deny own="*"/>
+ <deny send_type="method_call"/>
+
+- <!-- Signals and reply messages (method returns, errors) are allowed
++ <!-- By default clients require internal/dbus privilege to send and receive signaks.
++ This is internal privilege that is only accessible to trusted system services -->
++ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" />
++
++ <!-- Reply messages (method returns, errors) are allowed
+ by default -->
+- <allow send_type="signal"/>
+ <allow send_requested_reply="true" send_type="method_return"/>
+ <allow send_requested_reply="true" send_type="error"/>
+
+- <!-- All messages may be received by default -->
++ <!-- All messages but signals may be received by default -->
+ <allow receive_type="method_call"/>
+ <allow receive_type="method_return"/>
+ <allow receive_type="error"/>
+- <allow receive_type="signal"/>
+
+ <!-- Allow anyone to talk to the message bus -->
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus" />
+ <allow send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus.Introspectable"/>
++ <!-- If there is a need specific bus services could be protected by Cynara as well.
++ However, this can lead to deadlock during the boot process when such check is made and
++ Cynara is not yet activated (systemd calls protected method synchronously,
++ dbus daemon tries to consult Cynara, Cynara waits for systemd activation).
++ Therefore it is advised to allow root processes to use bus services.
++ Currently anyone is allowed to talk to the message bus -->
++ <allow receive_sender="org.freedesktop.DBus"/>
++
+ <!-- But disallow some specific bus services -->
+ <deny send_destination="org.freedesktop.DBus"
+ send_interface="org.freedesktop.DBus"
+--
+2.14.3
+
diff --git a/meta-security/recipes-core/dbus-cynara/dbus_1.10.20.bbappend b/meta-security/recipes-core/dbus-cynara/dbus_1.10.20.bbappend
new file mode 100644
index 000000000..34064bab2
--- /dev/null
+++ b/meta-security/recipes-core/dbus-cynara/dbus_1.10.20.bbappend
@@ -0,0 +1,13 @@
+FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
+
+SRC_URI_append = "\
+ file://0001-Integration-of-Cynara-asynchronous-security-checks.patch \
+ file://0002-Disable-message-dispatching-when-send-rule-result-is.patch \
+ file://0003-Handle-unavailability-of-policy-results-for-broadcas.patch \
+ file://0004-Add-own-rule-result-unavailability-handling.patch \
+ file://0005-Perform-Cynara-runtime-policy-checks-by-default.patch \
+"
+
+DEPENDS_append_class-target = " cynara"
+EXTRA_OECONF_append_class-target = " --disable-selinux --enable-cynara"
+
diff --git a/meta-security/recipes-core/packagegroups/packagegroup-security-framework.bb b/meta-security/recipes-core/packagegroups/packagegroup-security-framework.bb
new file mode 100644
index 000000000..b52e18d4e
--- /dev/null
+++ b/meta-security/recipes-core/packagegroups/packagegroup-security-framework.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Security middleware components"
+LICENSE = "MIT"
+
+inherit packagegroup
+
+# Install Cynara and security-manager by default if (and only if)
+# Smack is enabled.
+#
+# Cynara does not have a hard dependency on Smack security,
+# but is meant to be used with it. security-manager however
+# links against smack and expects Smack to be active,
+# so we do not have any choice.
+#
+# Without configuration, security-manager is not usable. We use
+# the policy packaged from the upstream source code here. Adapting
+# it for the distro can be done by patching that source.
+RDEPENDS_${PN}_append_with-lsm-smack = " \
+ cynara \
+ security-manager \
+ security-manager-policy \
+ smacknet \
+"
diff --git a/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch b/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch
new file mode 100644
index 000000000..2ff51f86b
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch
@@ -0,0 +1,49 @@
+From da574755b8abe1d5fb9151f901ccea51d40d9509 Mon Sep 17 00:00:00 2001
+From: Michael Demeter <michael.demeter@intel.com>
+Date: Fri, 30 Oct 2015 11:25:50 +0100
+Subject: [PATCH] tizen-smack: Handling of /run and /sys/fs/cgroup
+
+Make /run a transmuting directory to enable systemd
+communications with services in the User domain.
+
+Upstream-Status: Pending
+
+Change-Id: I9e23b78d17a108d8e56ad85a9e839b6ccbe4feff
+---
+ src/core/mount-setup.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
+index cc2633e..3dc7cd7 100644
+--- a/src/core/mount-setup.c
++++ b/src/core/mount-setup.c
+@@ -85,19 +85,23 @@ static const MountPoint mount_table[] = {
+ use_smack, MNT_FATAL },
+ { "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ use_smack, MNT_FATAL },
+-#endif
++#else
+ { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
++#endif
+ { "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
+ NULL, MNT_IN_CONTAINER },
+ #ifdef HAVE_SMACK
+- { "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
++ { "tmpfs", "/run", "tmpfs", "mode=755,smackfstransmute=System::Run", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ use_smack, MNT_FATAL },
+-#endif
++ { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
++ use_smack, MNT_IN_CONTAINER },
++#else
+ { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
+ { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
++#endif
+ { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV,
+ NULL, MNT_IN_CONTAINER },
+ { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV,
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch b/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch
new file mode 100644
index 000000000..a4a3e50a6
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch
@@ -0,0 +1,50 @@
+From 831d552a9589bb2b99c042d01672409efa3d94fc Mon Sep 17 00:00:00 2001
+From: Michael Demeter <michael.demeter@intel.com>
+Date: Fri, 11 Oct 2013 15:37:57 -0700
+Subject: [PATCH 3/9] tizen-smack: Handling of /run and /sys/fs/cgroup
+
+Make /run a transmuting directory to enable systemd
+communications with services in the User domain.
+
+Upstream-Status: Pending
+
+Change-Id: I9e23b78d17a108d8e56ad85a9e839b6ccbe4feff
+---
+ src/core/mount-setup.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
+index 521545e..ba0867c 100644
+--- a/src/core/mount-setup.c
++++ b/src/core/mount-setup.c
+@@ -85,19 +85,23 @@ static const MountPoint mount_table[] = {
+ mac_smack_use, MNT_FATAL },
+ { "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ mac_smack_use, MNT_FATAL },
+-#endif
++#else
+ { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
++#endif
+ { "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
+ NULL, MNT_IN_CONTAINER },
+ #ifdef HAVE_SMACK
+- { "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+- mac_smack_use, MNT_FATAL },
+-#endif
++ { "tmpfs", "/run", "tmpfs", "mode=755,smackfstransmute=System::Run", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
++ mac_smack_use, MNT_FATAL },
++ { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
++ mac_smack_use, MNT_IN_CONTAINER },
++#else
+ { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
+ { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
+ NULL, MNT_FATAL|MNT_IN_CONTAINER },
++#endif
+ { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV,
+ NULL, MNT_IN_CONTAINER },
+ { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV,
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev-v216.patch b/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev-v216.patch
new file mode 100644
index 000000000..88c100fed
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev-v216.patch
@@ -0,0 +1,82 @@
+From 468ef790a7a0e53c390cec9c63090a0ae04a4d58 Mon Sep 17 00:00:00 2001
+From: Michael Demeter <michael.demeter@intel.com>
+Date: Fri, 11 Oct 2013 15:37:57 -0700
+Subject: [PATCH 4/9] tizen-smack: Handling of /dev
+
+Smack enabled systems need /dev special devices correctly labeled
+
+- Add AC_DEFINE for HAVE_SMACK to configure.ac
+- Add Check for smack in Makefile.am to include smack default rules
+- Add smack default rules to label /dev/xxx correctly for access
+
+Upstream-Status: Inappropriate [configuration]
+
+Change-Id: Iebe2e349cbedb3013abdf32edb55e9310f1d17f5
+---
+ configure.ac | 2 ++
+ Makefile.am | 5 +++++
+ rules/55-udev-smack-default.rules | 23 +++++++++++++++++++++++
+ 3 files changed, 30 insertions(+)
+ create mode 100644 rules/55-udev-smack-default.rules
+
+diff --git a/configure.ac b/configure.ac
+index 18b7198..05f49ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -635,6 +635,8 @@ if test "x${have_smack}" = xyes ; then
+ AC_DEFINE(HAVE_SMACK, 1, [Define if SMACK is available])
+ fi
+
++AM_CONDITIONAL([HAVE_SMACK], [test "x$have_smack" = "xyes"])
++
+ # ------------------------------------------------------------------------------
+ AC_ARG_ENABLE([gcrypt],
+ AS_HELP_STRING([--disable-gcrypt],[Disable optional GCRYPT support]),
+diff --git a/Makefile.am b/Makefile.am
+index bf04d31..1a05607 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -3108,6 +3108,11 @@ dist_udevrules_DATA += \
+ nodist_udevrules_DATA += \
+ rules/99-systemd.rules
+
++if HAVE_SMACK
++dist_udevrules_DATA += \
++ rules/55-udev-smack-default.rules
++endif
++
+ dist_udevhwdb_DATA = \
+ hwdb/20-pci-vendor-model.hwdb \
+ hwdb/20-pci-classes.hwdb \
+diff --git a/rules/55-udev-smack-default.rules b/rules/55-udev-smack-default.rules
+new file mode 100644
+index 0000000..3829019
+--- /dev/null
++++ b/rules/55-udev-smack-default.rules
+@@ -0,0 +1,23 @@
++# do not edit this file, it will be overwritten on update
++
++KERNEL=="null", SECLABEL{smack}="*"
++KERNEL=="zero", SECLABEL{smack}="*"
++KERNEL=="console", SECLABEL{smack}="*"
++KERNEL=="kmsg", SECLABEL{smack}="*"
++KERNEL=="video*", SECLABEL{smack}="*"
++KERNEL=="card*", SECLABEL{smack}="*"
++KERNEL=="ptmx", SECLABEL{smack}="*"
++KERNEL=="tty", SECLABEL{smack}="*"
++
++SUBSYSTEM=="graphics", GROUP="video", SECLABEL{smack}="*"
++SUBSYSTEM=="drm", GROUP="video", SECLABEL{smack}="*"
++SUBSYSTEM=="dvb", GROUP="video", SECLABEL{smack}="*"
++
++SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
++SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
++SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", SECLABEL{smack}="*"
++SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty", SECLABEL{smack}="*"
++KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout", SECLABEL{smack}="*"
++
++SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640", SECLABEL{smack}="*"
++SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640", SECLABEL{smack}="*"
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev.patch b/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev.patch
new file mode 100644
index 000000000..b12caaec5
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0004-tizen-smack-Handling-of-dev.patch
@@ -0,0 +1,68 @@
+From 468ef790a7a0e53c390cec9c63090a0ae04a4d58 Mon Sep 17 00:00:00 2001
+From: Michael Demeter <michael.demeter@intel.com>
+Date: Fri, 11 Oct 2013 15:37:57 -0700
+Subject: [PATCH 4/9] tizen-smack: Handling of /dev
+
+Smack enabled systems need /dev special devices correctly labeled
+
+- Add AC_DEFINE for HAVE_SMACK to configure.ac
+- Add Check for smack in Makefile.am to include smack default rules
+- Add smack default rules to label /dev/xxx correctly for access
+
+Upstream-Status: Inappropriate [configuration]
+
+Change-Id: Iebe2e349cbedb3013abdf32edb55e9310f1d17f5
+---
+ Makefile.am | 5 +++++
+ rules/55-udev-smack-default.rules | 23 +++++++++++++++++++++++
+ 2 files changed, 28 insertions(+)
+ create mode 100644 rules/55-udev-smack-default.rules
+
+diff --git a/Makefile.am b/Makefile.am
+index bf04d31..1a05607 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -3571,6 +3571,11 @@ dist_udevrules_DATA += \
+ nodist_udevrules_DATA += \
+ rules/99-systemd.rules
+
++if HAVE_SMACK
++dist_udevrules_DATA += \
++ rules/55-udev-smack-default.rules
++endif
++
+ udevconfdir = $(sysconfdir)/udev
+ dist_udevconf_DATA = \
+ src/udev/udev.conf
+diff --git a/rules/55-udev-smack-default.rules b/rules/55-udev-smack-default.rules
+new file mode 100644
+index 0000000..3829019
+--- /dev/null
++++ b/rules/55-udev-smack-default.rules
+@@ -0,0 +1,23 @@
++# do not edit this file, it will be overwritten on update
++
++KERNEL=="null", SECLABEL{smack}="*"
++KERNEL=="zero", SECLABEL{smack}="*"
++KERNEL=="console", SECLABEL{smack}="*"
++KERNEL=="kmsg", SECLABEL{smack}="*"
++KERNEL=="video*", SECLABEL{smack}="*"
++KERNEL=="card*", SECLABEL{smack}="*"
++KERNEL=="ptmx", SECLABEL{smack}="*"
++KERNEL=="tty", SECLABEL{smack}="*"
++
++SUBSYSTEM=="graphics", GROUP="video", SECLABEL{smack}="*"
++SUBSYSTEM=="drm", GROUP="video", SECLABEL{smack}="*"
++SUBSYSTEM=="dvb", GROUP="video", SECLABEL{smack}="*"
++
++SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
++SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
++SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", SECLABEL{smack}="*"
++SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty", SECLABEL{smack}="*"
++KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout", SECLABEL{smack}="*"
++
++SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640", SECLABEL{smack}="*"
++SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640", SECLABEL{smack}="*"
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v216.patch b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v216.patch
new file mode 100644
index 000000000..3d69bb2a8
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v216.patch
@@ -0,0 +1,107 @@
+From c257eade1a39ea00d26c4c297efd654b6ad4edb4 Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Fri, 8 Nov 2013 09:42:26 -0800
+Subject: [PATCH 5/9] tizen-smack: Handling network
+
+- Set Smack ambient to match run label
+- Set Smack netlabel host rules
+
+Set Smack ambient to match run label
+------------------------------------
+Set the Smack networking ambient label to match the
+run label of systemd. System services may expect to
+communicate with external services over IP. Setting
+the ambient label assigns that label to IP packets
+that do not include CIPSO headers. This allows systemd
+and the services it spawns access to unlabeled IP
+packets, and hence external services.
+
+A system may choose to restrict network access to
+particular services later in the startup process.
+This is easily done by resetting the ambient label
+elsewhere.
+
+Set Smack netlabel host rules
+-----------------------------
+If SMACK_RUN_LABEL is defined set all other hosts to be
+single label hosts at the specified label. Set the loopback
+address to be a CIPSO host.
+
+If any netlabel host rules are defined in /etc/smack/netlabel.d
+install them into the smackfs netlabel interface.
+
+Upstream-Status: Pending
+
+---
+ src/core/smack-setup.c | 33 ++++++++++++++++++++++++++++++++-
+ 1 file changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
+index 59f6832..33dc1ca 100644
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -42,6 +42,7 @@
+
+ #define SMACK_CONFIG "/etc/smack/accesses.d/"
+ #define CIPSO_CONFIG "/etc/smack/cipso.d/"
++#define NETLABEL_CONFIG "/etc/smack/netlabel.d/"
+
+ #ifdef HAVE_SMACK
+
+@@ -146,6 +147,19 @@ int smack_setup(bool *loaded_policy) {
+ if (r)
+ log_warning("Failed to set SMACK label \"%s\" on self: %s",
+ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL);
++ if (r)
++ log_warning("Failed to set SMACK ambient label \"%s\": %s",
++ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel",
++ "0.0.0.0/0 " SMACK_RUN_LABEL);
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "0.0.0.0/0 " SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO");
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "127.0.0.1 -CIPSO", strerror(-r));
+ #endif
+
+ r = write_rules("/sys/fs/smackfs/cipso2", CIPSO_CONFIG);
+@@ -155,14 +169,31 @@ int smack_setup(bool *loaded_policy) {
+ return 0;
+ case ENOENT:
+ log_debug("Smack/CIPSO access rules directory " CIPSO_CONFIG " not found");
+- return 0;
++ break;
+ case 0:
+ log_info("Successfully loaded Smack/CIPSO policies.");
+- return 0;
++ break;
+ default:
+ log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.",
+ strerror(abs(r)));
++ break;
++ }
++
++ r = write_rules("/sys/fs/smackfs/netlabel", NETLABEL_CONFIG);
++ switch(r) {
++ case -ENOENT:
++ log_debug("Smack/CIPSO is not enabled in the kernel.");
+ return 0;
++ case ENOENT:
++ log_debug("Smack network host rules directory " NETLABEL_CONFIG " not found");
++ break;
++ case 0:
++ log_info("Successfully loaded Smack network host rules.");
++ break;
++ default:
++ log_warning("Failed to load Smack network host rules: %s, ignoring.",
++ strerror(abs(r)));
++ break;
+ }
+
+ *loaded_policy = true;
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v225.patch b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v225.patch
new file mode 100644
index 000000000..d5678f2e6
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v225.patch
@@ -0,0 +1,191 @@
+From 513a8d943538643fabf0d31f1eed261677dfbddc Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Fri, 8 Nov 2013 09:42:26 -0800
+Subject: [PATCH] tizen-smack: Handling network
+
+- Set Smack ambient to match run label
+- Set Smack netlabel host rules
+
+Set Smack ambient to match run label
+------------------------------------
+Set the Smack networking ambient label to match the
+run label of systemd. System services may expect to
+communicate with external services over IP. Setting
+the ambient label assigns that label to IP packets
+that do not include CIPSO headers. This allows systemd
+and the services it spawns access to unlabeled IP
+packets, and hence external services.
+
+A system may choose to restrict network access to
+particular services later in the startup process.
+This is easily done by resetting the ambient label
+elsewhere.
+
+Set Smack netlabel host rules
+-----------------------------
+If SMACK_RUN_LABEL is defined set all other hosts to be
+single label hosts at the specified label. Set the loopback
+address to be a CIPSO host.
+
+If any netlabel host rules are defined in /etc/smack/netlabel.d
+install them into the smackfs netlabel interface.
+
+[Patrick Ohly: adapt to write_string_file() change in "fileio: consolidate write_string_file*()"]
+[Patrick Ohly: create write_netlabel_rules() based on the original write_rules() that was removed in "smack: support smack access change-rule"]
+
+Upstream-Status: Pending
+---
+ src/core/smack-setup.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 106 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
+index cbe7d0b..b384aa0 100644
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -34,6 +34,9 @@
+ #include "fileio.h"
+ #include "log.h"
+
++#define CIPSO_CONFIG "/etc/smack/cipso.d/"
++#define NETLABEL_CONFIG "/etc/smack/netlabel.d/"
++
+ #ifdef HAVE_SMACK
+
+ static int write_access2_rules(const char* srcdir) {
+@@ -193,6 +196,76 @@ static int write_cipso2_rules(const char* srcdir) {
+ return r;
+ }
+
++static int write_netlabel_rules(const char* srcdir) {
++ _cleanup_fclose_ FILE *dst = NULL;
++ _cleanup_closedir_ DIR *dir = NULL;
++ struct dirent *entry;
++ char buf[NAME_MAX];
++ int dfd = -1;
++ int r = 0;
++ static const char dstpath[] = "/sys/fs/smackfs/netlabel";
++
++ dst = fopen(dstpath, "we");
++ if (!dst) {
++ if (errno != ENOENT)
++ log_warning_errno(errno, "Failed to open %s: %m", dstpath);
++ return -errno; /* negative error */
++ }
++
++ /* write rules to dst from every file in the directory */
++ dir = opendir(srcdir);
++ if (!dir) {
++ if (errno != ENOENT)
++ log_warning_errno(errno, "Failed to opendir %s: %m", srcdir);
++ return errno; /* positive on purpose */
++ }
++
++ dfd = dirfd(dir);
++ assert(dfd >= 0);
++
++ FOREACH_DIRENT(entry, dir, return 0) {
++ int fd;
++ _cleanup_fclose_ FILE *policy = NULL;
++
++ fd = openat(dfd, entry->d_name, O_RDONLY|O_CLOEXEC);
++ if (fd < 0) {
++ if (r == 0)
++ r = -errno;
++ log_warning_errno(errno, "Failed to open %s: %m", entry->d_name);
++ continue;
++ }
++
++ policy = fdopen(fd, "re");
++ if (!policy) {
++ if (r == 0)
++ r = -errno;
++ safe_close(fd);
++ log_error_errno(errno, "Failed to open %s: %m", entry->d_name);
++ continue;
++ }
++
++ /* load2 write rules in the kernel require a line buffered stream */
++ FOREACH_LINE(buf, policy,
++ log_error_errno(errno, "Failed to read line from %s: %m",
++ entry->d_name)) {
++ if (!fputs(buf, dst)) {
++ if (r == 0)
++ r = -EINVAL;
++ log_error("Failed to write line to %s", dstpath);
++ break;
++ }
++ if (fflush(dst)) {
++ if (r == 0)
++ r = -errno;
++ log_error_errno(errno, "Failed to flush writes to %s: %m", dstpath);
++ break;
++ }
++ }
++ }
++
++ return r;
++}
++
+ #endif
+
+ int mac_smack_setup(bool *loaded_policy) {
+@@ -225,23 +298,53 @@ int mac_smack_setup(bool *loaded_policy) {
+ if (r)
+ log_warning("Failed to set SMACK label \"%s\" on self: %s",
+ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
++ if (r)
++ log_warning("Failed to set SMACK ambient label \"%s\": %s",
++ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel",
++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "0.0.0.0/0 " SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "127.0.0.1 -CIPSO", strerror(-r));
+ #endif
+
+- r = write_cipso2_rules("/etc/smack/cipso.d/");
++ r = write_cipso2_rules(CIPSO_CONFIG);
+ switch(r) {
+ case -ENOENT:
+ log_debug("Smack/CIPSO is not enabled in the kernel.");
+ return 0;
+ case ENOENT:
+- log_debug("Smack/CIPSO access rules directory '/etc/smack/cipso.d/' not found");
+- return 0;
++ log_debug("Smack/CIPSO access rules directory " CIPSO_CONFIG " not found");
++ break;
+ case 0:
+ log_info("Successfully loaded Smack/CIPSO policies.");
+ break;
+ default:
+ log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.",
+ strerror(abs(r)));
++ break;
++ }
++
++ r = write_netlabel_rules(NETLABEL_CONFIG);
++ switch(r) {
++ case -ENOENT:
++ log_debug("Smack/CIPSO is not enabled in the kernel.");
+ return 0;
++ case ENOENT:
++ log_debug("Smack network host rules directory " NETLABEL_CONFIG " not found");
++ break;
++ case 0:
++ log_info("Successfully loaded Smack network host rules.");
++ break;
++ default:
++ log_warning("Failed to load Smack network host rules: %s, ignoring.",
++ strerror(abs(r)));
++ break;
+ }
+
+ *loaded_policy = true;
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v228.patch b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v228.patch
new file mode 100644
index 000000000..bc6b97c8f
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network-v228.patch
@@ -0,0 +1,179 @@
+From e714327016fb65a0bf977588efaecbaf41ac3cfc Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Fri, 8 Nov 2013 09:42:26 -0800
+Subject: [PATCH 4/6] tizen-smack: Handling network
+
+- Set Smack ambient to match run label
+- Set Smack netlabel host rules
+
+Set Smack ambient to match run label
+------------------------------------
+Set the Smack networking ambient label to match the
+run label of systemd. System services may expect to
+communicate with external services over IP. Setting
+the ambient label assigns that label to IP packets
+that do not include CIPSO headers. This allows systemd
+and the services it spawns access to unlabeled IP
+packets, and hence external services.
+
+A system may choose to restrict network access to
+particular services later in the startup process.
+This is easily done by resetting the ambient label
+elsewhere.
+
+Set Smack netlabel host rules
+-----------------------------
+If SMACK_RUN_LABEL is defined set all other hosts to be
+single label hosts at the specified label. Set the loopback
+address to be a CIPSO host.
+
+If any netlabel host rules are defined in /etc/smack/netlabel.d
+install them into the smackfs netlabel interface.
+
+[Patrick Ohly: copied from https://review.tizen.org/git/?p=platform/upstream/systemd.git;a=commit;h=db4f6c9a074644aa2bf]
+[Patrick Ohly: adapt to write_string_file() change in "fileio: consolidate write_string_file*()"]
+[Patrick Ohly: create write_netlabel_rules() based on the original write_rules() that was removed in "smack: support smack access change-rule"]
+[Patrick Ohly: adapted to upstream code review feedback: error logging, string constants]
+
+Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/2262]
+
+%% original patch: 0005-tizen-smack-Handling-network-v225.patch
+---
+ src/core/smack-setup.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 98 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
+index 0661ff9..c9374ca 100644
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -197,6 +197,75 @@ static int write_cipso2_rules(const char* srcdir) {
+ return r;
+ }
+
++static int write_netlabel_rules(const char* srcdir) {
++ _cleanup_fclose_ FILE *dst = NULL;
++ _cleanup_closedir_ DIR *dir = NULL;
++ struct dirent *entry;
++ char buf[NAME_MAX];
++ int dfd = -1;
++ int r = 0;
++
++ dst = fopen("/sys/fs/smackfs/netlabel", "we");
++ if (!dst) {
++ if (errno != ENOENT)
++ log_warning_errno(errno, "Failed to open /sys/fs/smackfs/netlabel: %m");
++ return -errno; /* negative error */
++ }
++
++ /* write rules to dst from every file in the directory */
++ dir = opendir(srcdir);
++ if (!dir) {
++ if (errno != ENOENT)
++ log_warning_errno(errno, "Failed to opendir %s: %m", srcdir);
++ return errno; /* positive on purpose */
++ }
++
++ dfd = dirfd(dir);
++ assert(dfd >= 0);
++
++ FOREACH_DIRENT(entry, dir, return 0) {
++ int fd;
++ _cleanup_fclose_ FILE *policy = NULL;
++
++ fd = openat(dfd, entry->d_name, O_RDONLY|O_CLOEXEC);
++ if (fd < 0) {
++ if (r == 0)
++ r = -errno;
++ log_warning_errno(errno, "Failed to open %s: %m", entry->d_name);
++ continue;
++ }
++
++ policy = fdopen(fd, "re");
++ if (!policy) {
++ if (r == 0)
++ r = -errno;
++ safe_close(fd);
++ log_error_errno(errno, "Failed to open %s: %m", entry->d_name);
++ continue;
++ }
++
++ /* load2 write rules in the kernel require a line buffered stream */
++ FOREACH_LINE(buf, policy,
++ log_error_errno(errno, "Failed to read line from %s: %m",
++ entry->d_name)) {
++ if (!fputs(buf, dst)) {
++ if (r == 0)
++ r = -EINVAL;
++ log_error_errno(errno, "Failed to write line to /sys/fs/smackfs/netlabel");
++ break;
++ }
++ if (fflush(dst)) {
++ if (r == 0)
++ r = -errno;
++ log_error_errno(errno, "Failed to flush writes to /sys/fs/smackfs/netlabel: %m");
++ break;
++ }
++ }
++ }
++
++ return r;
++}
++
+ #endif
+
+ int mac_smack_setup(bool *loaded_policy) {
+@@ -225,8 +294,18 @@ int mac_smack_setup(bool *loaded_policy) {
+
+ #ifdef SMACK_RUN_LABEL
+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
+- if (r)
+- log_warning_errno(r, "Failed to set SMACK label \"%s\" on self: %m", SMACK_RUN_LABEL);
++ if (r < 0)
++ log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
++ if (r < 0)
++ log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
++ r = write_string_file("/sys/fs/smackfs/netlabel",
++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
++ if (r < 0)
++ log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
++ if (r < 0)
++ log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
+ #endif
+
+ r = write_cipso2_rules("/etc/smack/cipso.d/");
+@@ -236,13 +315,29 @@ int mac_smack_setup(bool *loaded_policy) {
+ return 0;
+ case ENOENT:
+ log_debug("Smack/CIPSO access rules directory '/etc/smack/cipso.d/' not found");
+- return 0;
++ break;
+ case 0:
+ log_info("Successfully loaded Smack/CIPSO policies.");
+ break;
+ default:
+ log_warning_errno(r, "Failed to load Smack/CIPSO access rules, ignoring: %m");
++ break;
++ }
++
++ r = write_netlabel_rules("/etc/smack/netlabel.d/");
++ switch(r) {
++ case -ENOENT:
++ log_debug("Smack/CIPSO is not enabled in the kernel.");
+ return 0;
++ case ENOENT:
++ log_debug("Smack network host rules directory '/etc/smack/netlabel.d/' not found");
++ break;
++ case 0:
++ log_info("Successfully loaded Smack network host rules.");
++ break;
++ default:
++ log_warning_errno(r, "Failed to load Smack network host rules: %m, ignoring.");
++ break;
+ }
+
+ *loaded_policy = true;
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network.patch b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network.patch
new file mode 100644
index 000000000..cd6a3c90b
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0005-tizen-smack-Handling-network.patch
@@ -0,0 +1,106 @@
+From c257eade1a39ea00d26c4c297efd654b6ad4edb4 Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Fri, 8 Nov 2013 09:42:26 -0800
+Subject: [PATCH 5/9] tizen-smack: Handling network
+
+- Set Smack ambient to match run label
+- Set Smack netlabel host rules
+
+Set Smack ambient to match run label
+------------------------------------
+Set the Smack networking ambient label to match the
+run label of systemd. System services may expect to
+communicate with external services over IP. Setting
+the ambient label assigns that label to IP packets
+that do not include CIPSO headers. This allows systemd
+and the services it spawns access to unlabeled IP
+packets, and hence external services.
+
+A system may choose to restrict network access to
+particular services later in the startup process.
+This is easily done by resetting the ambient label
+elsewhere.
+
+Set Smack netlabel host rules
+-----------------------------
+If SMACK_RUN_LABEL is defined set all other hosts to be
+single label hosts at the specified label. Set the loopback
+address to be a CIPSO host.
+
+If any netlabel host rules are defined in /etc/smack/netlabel.d
+install them into the smackfs netlabel interface.
+
+Upstream-Status: Pending
+
+---
+ src/core/smack-setup.c | 33 ++++++++++++++++++++++++++++++++-
+ 1 file changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
+index 59f6832..33dc1ca 100644
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -42,6 +42,7 @@
+
+ #define SMACK_CONFIG "/etc/smack/accesses.d/"
+ #define CIPSO_CONFIG "/etc/smack/cipso.d/"
++#define NETLABEL_CONFIG "/etc/smack/netlabel.d/"
+
+ #ifdef HAVE_SMACK
+
+@@ -146,6 +147,19 @@ int mac_smack_setup(bool *loaded_policy) {
+ if (r)
+ log_warning("Failed to set SMACK label \"%s\" on self: %s",
+ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL);
++ if (r)
++ log_warning("Failed to set SMACK ambient label \"%s\": %s",
++ SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel",
++ "0.0.0.0/0 " SMACK_RUN_LABEL);
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "0.0.0.0/0 " SMACK_RUN_LABEL, strerror(-r));
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO");
++ if (r)
++ log_warning("Failed to set SMACK netlabel rule \"%s\": %s",
++ "127.0.0.1 -CIPSO", strerror(-r));
+ #endif
+
+ r = write_rules("/sys/fs/smackfs/cipso2", CIPSO_CONFIG);
+@@ -155,14 +169,31 @@ int mac_smack_setup(bool *loaded_policy) {
+ return 0;
+ case ENOENT:
+ log_debug("Smack/CIPSO access rules directory " CIPSO_CONFIG " not found");
+- return 0;
++ break;
+ case 0:
+ log_info("Successfully loaded Smack/CIPSO policies.");
+ break;
+ default:
+ log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.",
+ strerror(abs(r)));
++ break;
++ }
++
++ r = write_rules("/sys/fs/smackfs/netlabel", NETLABEL_CONFIG);
++ switch(r) {
++ case -ENOENT:
++ log_debug("Smack/CIPSO is not enabled in the kernel.");
+ return 0;
++ case ENOENT:
++ log_debug("Smack network host rules directory " NETLABEL_CONFIG " not found");
++ break;
++ case 0:
++ log_info("Successfully loaded Smack network host rules.");
++ break;
++ default:
++ log_warning("Failed to load Smack network host rules: %s, ignoring.",
++ strerror(abs(r)));
++ break;
+ }
+
+ *loaded_policy = true;
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with-v216.patch b/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with-v216.patch
new file mode 100644
index 000000000..dd2c6542e
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with-v216.patch
@@ -0,0 +1,41 @@
+From ccf384ca0f1cabe37e07e752df95ddb1e017a7ef Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Thu, 19 Dec 2013 16:49:28 -0800
+Subject: [PATCH 7/9] tizen-smack: Runs systemd-journald with ^
+
+Run systemd-journald with the hat ("^") Smack label.
+
+The journal daemon needs global read access to gather information
+about the services spawned by systemd. The hat label is intended
+for this purpose. The journal daemon is the only part of the
+System domain that needs read access to the User domain. Giving
+the journal daemon the hat label means that we can remove the
+System domain's read access to the User domain.
+
+Upstream-Status: Inappropriate [configuration]
+
+Change-Id: Ic22633f0c9d99c04f873be8a346786ea577d0370
+Signed-off-by: Casey Schaufler <casey.schaufler@intel.com>
+---
+ units/systemd-journald.service.in | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
+index a3540c6..745dd84 100644
+--- a/units/systemd-journald.service.in
++++ b/units/systemd-journald.service.in
+@@ -20,8 +20,10 @@ Restart=always
+ RestartSec=0
+ NotifyAccess=all
+ StandardOutput=null
++SmackProcessLabel=^
+-CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID
++CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID CAP_MAC_OVERRIDE
+ WatchdogSec=1min
++FileDescriptorStoreMax=1024
+
+ # Increase the default a bit in order to allow many simultaneous
+ # services being run since we keep one fd open per service.
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with.patch b/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with.patch
new file mode 100644
index 000000000..27a9d0bc6
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/0007-tizen-smack-Runs-systemd-journald-with.patch
@@ -0,0 +1,37 @@
+From ccf384ca0f1cabe37e07e752df95ddb1e017a7ef Mon Sep 17 00:00:00 2001
+From: Casey Schaufler <casey@schaufler-ca.com>
+Date: Thu, 19 Dec 2013 16:49:28 -0800
+Subject: [PATCH 7/9] tizen-smack: Runs systemd-journald with ^
+
+Run systemd-journald with the hat ("^") Smack label.
+
+The journal daemon needs global read access to gather information
+about the services spawned by systemd. The hat label is intended
+for this purpose. The journal daemon is the only part of the
+System domain that needs read access to the User domain. Giving
+the journal daemon the hat label means that we can remove the
+System domain's read access to the User domain.
+
+Upstream-Status: Inappropriate [configuration]
+
+Change-Id: Ic22633f0c9d99c04f873be8a346786ea577d0370
+Signed-off-by: Casey Schaufler <casey.schaufler@intel.com>
+---
+ units/systemd-journald.service.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
+index a3540c6..745dd84 100644
+--- a/units/systemd-journald.service.in
++++ b/units/systemd-journald.service.in
+@@ -21,6 +21,7 @@ Restart=always
+ RestartSec=0
+ NotifyAccess=all
+ StandardOutput=null
++SmackProcessLabel=^
+ CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID CAP_MAC_OVERRIDE
+ WatchdogSec=1min
+ FileDescriptorStoreMax=1024
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-core/systemd/systemd/mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch b/meta-security/recipes-core/systemd/systemd/mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch
new file mode 100644
index 000000000..5a1baefed
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch
@@ -0,0 +1,58 @@
+From fd84be63d15fc94c1f396979c67e070c6cd7451b Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Mon, 21 Dec 2015 14:56:00 +0100
+Subject: [PATCH] mount-setup.c: fix handling of symlink Smack labelling in
+ cgroup setup
+
+The code introduced in f8c1a81c51 (= systemd 227) failed for me with:
+ Failed to copy smack label from net_cls to /sys/fs/cgroup/net_cls: No such file or directory
+
+There is no need for a symlink in this case because source and target
+are identical. The symlink() call is allowed to fail when the target
+already exists. When that happens, copying the Smack label must be
+skipped.
+
+But the code also failed when there is a symlink, like "cpu ->
+cpu,cpuacct", because mac_smack_copy() got called with
+src="cpu,cpuacct" which fails to find the entry because the current
+directory is not inside /sys/fs/cgroup. The absolute path to the existing
+entry must be used instead.
+
+Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/2205]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ src/core/mount-setup.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
+index 2b8d590..d73b319 100644
+--- a/src/core/mount-setup.c
++++ b/src/core/mount-setup.c
+@@ -304,13 +304,18 @@ int mount_cgroup_controllers(char ***join_controllers) {
+ return log_oom();
+
+ r = symlink(options, t);
+- if (r < 0 && errno != EEXIST)
+- return log_error_errno(errno, "Failed to create symlink %s: %m", t);
++ if (r >= 0) {
+ #ifdef SMACK_RUN_LABEL
+- r = mac_smack_copy(t, options);
+- if (r < 0 && r != -EOPNOTSUPP)
+- return log_error_errno(r, "Failed to copy smack label from %s to %s: %m", options, t);
++ _cleanup_free_ char *src;
++ src = strappend("/sys/fs/cgroup/", options);
++ if (!src)
++ return log_oom();
++ r = mac_smack_copy(t, src);
++ if (r < 0 && r != -EOPNOTSUPP)
++ return log_error_errno(r, "Failed to copy smack label from %s to %s: %m", src, t);
+ #endif
++ } else if (errno != EEXIST)
++ return log_error_errno(errno, "Failed to create symlink %s: %m", t);
+ }
+ }
+ }
+--
+2.1.4
+
diff --git a/meta-security/recipes-core/systemd/systemd/udev-smack-default.rules b/meta-security/recipes-core/systemd/systemd/udev-smack-default.rules
new file mode 100644
index 000000000..3829019de
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd/udev-smack-default.rules
@@ -0,0 +1,23 @@
+# do not edit this file, it will be overwritten on update
+
+KERNEL=="null", SECLABEL{smack}="*"
+KERNEL=="zero", SECLABEL{smack}="*"
+KERNEL=="console", SECLABEL{smack}="*"
+KERNEL=="kmsg", SECLABEL{smack}="*"
+KERNEL=="video*", SECLABEL{smack}="*"
+KERNEL=="card*", SECLABEL{smack}="*"
+KERNEL=="ptmx", SECLABEL{smack}="*"
+KERNEL=="tty", SECLABEL{smack}="*"
+
+SUBSYSTEM=="graphics", GROUP="video", SECLABEL{smack}="*"
+SUBSYSTEM=="drm", GROUP="video", SECLABEL{smack}="*"
+SUBSYSTEM=="dvb", GROUP="video", SECLABEL{smack}="*"
+
+SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
+SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666", SECLABEL{smack}="*"
+SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", SECLABEL{smack}="*"
+SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty", SECLABEL{smack}="*"
+KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout", SECLABEL{smack}="*"
+
+SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640", SECLABEL{smack}="*"
+SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640", SECLABEL{smack}="*"
diff --git a/meta-security/recipes-core/systemd/systemd_%.bbappend b/meta-security/recipes-core/systemd/systemd_%.bbappend
new file mode 100644
index 000000000..65e28f9de
--- /dev/null
+++ b/meta-security/recipes-core/systemd/systemd_%.bbappend
@@ -0,0 +1,120 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+# Most patches from sandbox/jobol/v219. Cannot be applied unconditionally
+# because systemd panics when booted without Smack support:
+# systemd[1]: Cannot determine cgroup we are running in: No such file or directory
+# systemd[1]: Failed to allocate manager object: No such file or directory
+# [!!!!!!] Failed to allocate manager object, freezing.
+#
+# There's a slight dependency on the base systemd in 0005-tizen-smack-Handling-network.
+# We use the beginning of PV (unexpanded here to prevent a cyclic dependency
+# during resolution apparently caused by ${SRCPV}) to pick the right set of
+# patches.
+#
+# Patches are optional. Hopefully we won't need any for systemd >= 229.
+SRC_URI_append_with-lsm-smack = " ${@d.getVar('SYSTEMD_SMACK_PATCHES_' + d.getVar('PV', False)[0:3], True) or ''}"
+
+SYSTEMD_SMACK_PATCHES_216 = " \
+file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch \
+file://0004-tizen-smack-Handling-of-dev-v216.patch \
+file://0005-tizen-smack-Handling-network-v216.patch \
+file://0007-tizen-smack-Runs-systemd-journald-with-v216.patch \
+"
+
+SYSTEMD_SMACK_PATCHES_219 = " \
+file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch \
+file://0004-tizen-smack-Handling-of-dev.patch \
+file://0005-tizen-smack-Handling-network.patch \
+file://0007-tizen-smack-Runs-systemd-journald-with.patch \
+"
+SYSTEMD_SMACK_PATCHES_225 = " \
+file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch \
+file://0004-tizen-smack-Handling-of-dev.patch \
+file://0005-tizen-smack-Handling-network-v225.patch \
+file://0007-tizen-smack-Runs-systemd-journald-with.patch \
+"
+
+SYSTEMD_SMACK_PATCHES_228 = " \
+file://0005-tizen-smack-Handling-network-v228.patch \
+file://mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch \
+"
+
+# From Tizen .spec file.
+EXTRA_OECONF_append_with-lsm-smack = " --with-smack-run-label=System"
+
+install_file() {
+ install -d $(dirname $1)
+ cat >>$1
+ chmod ${2:-0644} $1
+}
+
+# We need to emulate parts of the filesystem permissions from Tizen here.
+# The part for regular files is in base-files.bbappend, but /var/log and
+# /var/tmp point into /var/volatile (tmpfs) and get created anew during
+# startup. We set these permissions directly after creating them via
+# /etc/tmpfiles.d/00-create-volatile.conf
+RDEPENDS_${PN}_append_with-lsm-smack = " smack"
+do_install_append_with-lsm-smack() {
+ install_file ${D}${systemd_unitdir}/system/systemd-tmpfiles-setup.service.d/smack.conf <<EOF
+[Service]
+ExecStartPost=/bin/sh -c '([ ! -d /var/tmp ] || chsmack -L -a \"*\" /var/tmp) && ([ ! -d /var/log ] || chsmack -L -a System::Log /var/log && chsmack -L -t /var/log)'
+EOF
+
+ # Mount /tmp publicly accessable. Based on patch by Michael Demeter <michael.demeter@intel.com>.
+ # Upstream systemd temporarily had SmackFileSystemRoot for this (https://github.com/systemd/systemd/pull/1664),
+ # but it was removed again (https://github.com/systemd/systemd/issues/1696) because
+ # util-linux mount will ignore smackfsroot when Smack is not active. However,
+ # busybox is not that intelligent.
+ #
+ # When using busybox mount, adding smackfsroot=* and booting without
+ # Smack (i.e. security=none), tmp.mount will fail with an error about
+ # "Bad mount option smackfsroot".
+ install_file ${D}${systemd_unitdir}/system/tmp.mount.d/smack.conf <<EOF
+[Mount]
+Options=smackfsroot=*
+EOF
+
+ # Run systemd-journald with the hat ("^") Smack label.
+ #
+ # The journal daemon needs global read access to gather information
+ # about the services spawned by systemd. The hat label is intended
+ # for this purpose. The journal daemon is the only part of the
+ # System domain that needs read access to the User domain. Giving
+ # the journal daemon the hat label means that we can remove the
+ # System domain's read access to the User domain and we can avoid
+ # hard-coding a specific label name for that domain.
+ #
+ # Original author: Casey Schaufler <casey@schaufler-ca.com>
+ #
+ # This is considered a configuration change and thus distro specific.
+ install_file ${D}${systemd_unitdir}/system/systemd-journald.service.d/smack.conf <<EOF
+[Service]
+SmackProcessLabel=^
+EOF
+}
+
+# Will get installed in ${sysconfdir}/udev/rules.d/ by base systemd recipe.
+SRC_URI += "file://udev-smack-default.rules"
+
+# A workaround for a missing space in a SRC_URI_append in a private layer elsewhere:
+SRC_URI += ""
+
+# Maintaining trivial, non-upstreamable configuration changes as patches
+# is tedious. But in same cases (like early mounting of special directories)
+# the configuration has to be in code. We make these changes here directly.
+do_patch[prefuncs] += "patch_systemd"
+do_patch[vardeps] += "patch_systemd"
+patch_systemd() {
+ # Handling of /run and /sys/fs/cgroup. Make /run a transmuting directory to
+ # enable systemd communications with services in the User domain.
+ # Original patch by Michael Demeter <michael.demeter@intel.com>.
+ #
+ # We simplify the patching by touching only lines which check the result of
+ # mac_smack_use(). Those are the ones which are used when Smack is active.
+ #
+ # smackfsroot=* on /sys/fs/cgroup may be upstreamable, but smackfstransmute=System::Run
+ # is too distro specific (depends on Smack rules) and thus has to remain here.
+ sed -i -e 's;\("/sys/fs/cgroup", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfsroot=*\2;' \
+ -e 's;\("/run", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfstransmute=System::Run\2;' \
+ ${S}/src/core/mount-setup.c
+}
diff --git a/meta-security/recipes-core/util-linux/util-linux_%.bbappend b/meta-security/recipes-core/util-linux/util-linux_%.bbappend
new file mode 100644
index 000000000..05286f80d
--- /dev/null
+++ b/meta-security/recipes-core/util-linux/util-linux_%.bbappend
@@ -0,0 +1,8 @@
+# Enabling Smack support in util-linux enables special support
+# in [lib]mount for Smack mount options: they get removed if
+# Smack is not active in the current kernel. Important for
+# booting with "security=none" when userspace otherwise is
+# compiled to use Smack.
+
+PACKAGECONFIG_append_with-lsm-smack_class-target = " smack"
+PACKAGECONFIG[smack] = "--with-smack, --without-smack"
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs.inc b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs.inc
new file mode 100644
index 000000000..09e4ea5bb
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs.inc
@@ -0,0 +1,27 @@
+SUMMARY = "Ext2 Filesystem Utilities"
+DESCRIPTION = "The Ext2 Filesystem Utilities (e2fsprogs) contain all of the standard utilities for creating, \
+fixing, configuring , and debugging ext2 filesystems."
+HOMEPAGE = "http://e2fsprogs.sourceforge.net/"
+
+LICENSE = "GPLv2 & LGPLv2 & BSD & MIT"
+LICENSE_e2fsprogs-e2fsck = "GPLv2"
+LICENSE_e2fsprogs-mke2fs = "GPLv2"
+LICENSE_e2fsprogs-fsck = "GPLv2"
+LICENSE_e2fsprogs-tune2fs = "GPLv2"
+LICENSE_e2fsprogs-badblocks = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b48f21d765b875bd10400975d12c1ca2 \
+ file://lib/ext2fs/ext2fs.h;beginline=1;endline=9;md5=596a8dedcb4e731c6b21c7a46fba6bef \
+ file://lib/e2p/e2p.h;beginline=1;endline=7;md5=8a74ade8f9d65095d70ef2d4bf48e36a \
+ file://lib/uuid/uuid.h.in;beginline=1;endline=32;md5=dbb8079e114a5f841934b99e59c8820a \
+ file://lib/uuid/COPYING;md5=58dcd8452651fc8b07d1f65ce07ca8af \
+ file://lib/et/et_name.c;beginline=1;endline=11;md5=ead236447dac7b980dbc5b4804d8c836 \
+ file://lib/ss/ss.h;beginline=1;endline=20;md5=6e89ad47da6e75fecd2b5e0e81e1d4a6"
+SECTION = "base"
+DEPENDS = "util-linux"
+
+SRC_URI = "git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git"
+S = "${WORKDIR}/git"
+
+inherit autotools gettext texinfo pkgconfig multilib_header update-alternatives ptest
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/acinclude.m4 b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/acinclude.m4
new file mode 100644
index 000000000..c0bd7dbde
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/acinclude.m4
@@ -0,0 +1,135 @@
+# Extracted from the package's shipped aclocal.m4. Custom macros should be in
+# acinclude.m4 so running aclocal doesn't blow them away.
+#
+# Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+# from http://autoconf-archive.cryp.to/ax_tls.html
+#
+# This was licensed under the GPL with the following exception:
+#
+# As a special exception, the respective Autoconf Macro's copyright
+# owner gives unlimited permission to copy, distribute and modify the
+# configure scripts that are the output of Autoconf when processing
+# the Macro. You need not follow the terms of the GNU General Public
+# License when using or distributing such scripts, even though
+# portions of the text of the Macro appear in them. The GNU General
+# Public License (GPL) does govern all other use of the material that
+# constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the
+# Autoconf Macro released by the Autoconf Macro Archive. When you make
+# and distribute a modified version of the Autoconf Macro, you may
+# extend this special exception to the GPL to apply to your modified
+# version as well.
+#
+AC_DEFUN([AX_TLS], [
+ AC_MSG_CHECKING(for thread local storage (TLS) class)
+ AC_CACHE_VAL(ac_cv_tls, [
+ ax_tls_keywords="__thread __declspec(thread) none"
+ for ax_tls_keyword in $ax_tls_keywords; do
+ case $ax_tls_keyword in
+ none) ac_cv_tls=none ; break ;;
+ *)
+ AC_TRY_COMPILE(
+ [#include <stdlib.h>
+ static void
+ foo(void) {
+ static ] $ax_tls_keyword [ int bar;
+ exit(1);
+ }],
+ [],
+ [ac_cv_tls=$ax_tls_keyword ; break],
+ ac_cv_tls=none
+ )
+ esac
+ done
+])
+
+ if test "$ac_cv_tls" != "none"; then
+ dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
+ AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
+ fi
+ AC_MSG_RESULT($ac_cv_tls)
+])
+
+# ===========================================================================
+# http://www.nongnu.org/autoconf-archive/check_gnu_make.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# CHECK_GNU_MAKE()
+#
+# DESCRIPTION
+#
+# This macro searches for a GNU version of make. If a match is found, the
+# makefile variable `ifGNUmake' is set to the empty string, otherwise it
+# is set to "#". This is useful for including a special features in a
+# Makefile, which cannot be handled by other versions of make. The
+# variable _cv_gnu_make_command is set to the command to invoke GNU make
+# if it exists, the empty string otherwise.
+#
+# Here is an example of its use:
+#
+# Makefile.in might contain:
+#
+# # A failsafe way of putting a dependency rule into a makefile
+# $(DEPEND):
+# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
+#
+# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
+# @ifGNUmake@ include $(DEPEND)
+# @ifGNUmake@ endif
+#
+# Then configure.in would normally contain:
+#
+# CHECK_GNU_MAKE()
+# AC_OUTPUT(Makefile)
+#
+# Then perhaps to cause gnu make to override any other make, we could do
+# something like this (note that GNU make always looks for GNUmakefile
+# first):
+#
+# if ! test x$_cv_gnu_make_command = x ; then
+# mv Makefile GNUmakefile
+# echo .DEFAULT: > Makefile ;
+# echo \ $_cv_gnu_make_command \$@ >> Makefile;
+# fi
+#
+# Then, if any (well almost any) other make is called, and GNU make also
+# exists, then the other make wraps the GNU make.
+#
+# LICENSE
+#
+# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+#
+# Note: Modified by Ted Ts'o to add @ifNotGNUMake@
+
+AC_DEFUN(
+ [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
+ _cv_gnu_make_command='' ;
+dnl Search all the common names for GNU make
+ for a in "$MAKE" make gmake gnumake ; do
+ if test -z "$a" ; then continue ; fi ;
+ if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
+ _cv_gnu_make_command=$a ;
+ break;
+ fi
+ done ;
+ ) ;
+dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
+ if test "x$_cv_gnu_make_command" != "x" ; then
+ ifGNUmake='' ;
+ ifNotGNUmake='#' ;
+ else
+ ifGNUmake='#' ;
+ ifNotGNUmake='' ;
+ AC_MSG_RESULT("Not found");
+ fi
+ AC_SUBST(ifGNUmake)
+ AC_SUBST(ifNotGNUmake)
+] )
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/mkdir.patch b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/mkdir.patch
new file mode 100644
index 000000000..2a3aeff61
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/mkdir.patch
@@ -0,0 +1,18 @@
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Mei Lei <lei.mei@intel.com>
+
+diff --git a/configure.ac b/configure.ac
+index c1fe224..f5ac628 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1374,7 +1374,8 @@ if test -n "$WITH_DIET_LIBC" ; then
+ INCLUDES="$INCLUDES -D_REENTRANT"
+ fi
+ AC_SUBST(INCLUDES)
+-AM_MKINSTALLDIRS
++MKINSTALLDIRS="mkdir -p"
++AC_SUBST(MKINSTALLDIRS)
+ dnl
+ dnl Build CFLAGS
+ dnl
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/ptest.patch b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/ptest.patch
new file mode 100644
index 000000000..ef1ce5872
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/ptest.patch
@@ -0,0 +1,67 @@
+diff --git a/tests/Makefile.in b/tests/Makefile.in
+index 60cf655..ce220f1 100644
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -18,7 +18,7 @@ test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
+ @echo "#!/bin/sh" > test_one
+ @echo "HTREE=y" >> test_one
+ @echo "QUOTA=y" >> test_one
+- @echo "SRCDIR=@srcdir@" >> test_one
++ @echo "SRCDIR=/usr/lib/e2fsprogs/ptest/test" >> test_one
+ @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
+ @cat $(srcdir)/test_one.in >> test_one
+ @chmod +x test_one
+@@ -26,7 +26,7 @@ test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
+ test_script: test_one test_script.in Makefile mke2fs.conf
+ @echo "Creating test_script..."
+ @echo "#!/bin/sh" > test_script
+- @echo "SRCDIR=@srcdir@" >> test_script
++ @echo "SRCDIR=/usr/lib/e2fsprogs/ptest/test" >> test_script
+ @cat $(srcdir)/test_script.in >> test_script
+ @chmod +x test_script
+
+diff --git a/tests/test_config b/tests/test_config
+index 7f39157..c815a44 100644
+--- a/tests/test_config
++++ b/tests/test_config
+@@ -3,24 +3,24 @@
+ #
+
+ unset LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME PAGER
+-FSCK="$USE_VALGRIND ../e2fsck/e2fsck"
+-MKE2FS="$USE_VALGRIND ../misc/mke2fs"
+-DUMPE2FS="$USE_VALGRIND ../misc/dumpe2fs"
+-TUNE2FS="$USE_VALGRIND ../misc/tune2fs"
+-CHATTR="$USE_VALGRIND../misc/chattr"
+-LSATTR="$USE_VALGRIND ../misc/lsattr"
+-E2IMAGE="$USE_VALGRIND ../misc/e2image"
+-E2IMAGE_EXE="../misc/e2image"
+-DEBUGFS="$USE_VALGRIND ../debugfs/debugfs"
+-DEBUGFS_EXE="../debugfs/debugfs"
+-TEST_BITS="../debugfs/debugfs"
+-RESIZE2FS_EXE="../resize/resize2fs"
++FSCK="$USE_VALGRIND e2fsck"
++MKE2FS="$USE_VALGRIND mke2fs"
++DUMPE2FS="$USE_VALGRIND dumpe2fs"
++TUNE2FS="$USE_VALGRIND tune2fs"
++CHATTR="$USE_VALGRIND chattr"
++LSATTR="$USE_VALGRIND lsattr"
++E2IMAGE="$USE_VALGRIND e2image"
++E2IMAGE_EXE="/sbin/e2image"
++DEBUGFS="$USE_VALGRIND debugfs"
++DEBUGFS_EXE="/sbin/debugfs"
++TEST_BITS="/sbin/debugfs"
++RESIZE2FS_EXE="/sbin/resize2fs"
+ RESIZE2FS="$USE_VALGRIND $RESIZE2FS_EXE"
+-E2UNDO_EXE="../misc/e2undo"
++E2UNDO_EXE="/sbin/e2undo"
+ E2UNDO="$USE_VALGRIND $E2UNDO_EXE"
+-TEST_REL=../tests/progs/test_rel
+-TEST_ICOUNT=../tests/progs/test_icount
+-CRCSUM=../tests/progs/crcsum
++TEST_REL=./progs/test_rel
++TEST_ICOUNT=./progs/test_icount
++CRCSUM=./progs/crcsum
+ CLEAN_OUTPUT="sed -f $cmd_dir/filter.sed"
+ LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss:${LD_LIBRARY_PATH}
+ DYLD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss:${DYLD_LIBRARY_PATH}
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch
new file mode 100644
index 000000000..830e9d57a
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch
@@ -0,0 +1,19 @@
+When executing a script don't echo every command, as we do this for entire
+filesystems at rootfs time.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
+index 5590295..ac57292 100644
+--- a/debugfs/debugfs.c
++++ b/debugfs/debugfs.c
+@@ -2378,7 +2378,7 @@ static int source_file(const char *cmd_file, int ss_idx)
+ cp = strchr(buf, '\r');
+ if (cp)
+ *cp = 0;
+- printf("debugfs: %s\n", buf);
++ /*printf("debugfs: %s\n", buf);*/
+ retval = ss_execute_line(ss_idx, buf);
+ if (retval) {
+ ss_perror(ss_idx, retval, buf);
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/remove.ldconfig.call.patch b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/remove.ldconfig.call.patch
new file mode 100644
index 000000000..f3e6eb778
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/remove.ldconfig.call.patch
@@ -0,0 +1,44 @@
+From b139e03ac2f72e644e547c7ee9b1514383af4d97 Mon Sep 17 00:00:00 2001
+From: Andrei Dinu <andrei.adrianx.dinu@intel.com>
+Date: Wed, 30 Jan 2013 15:22:04 +0200
+Subject: [PATCH] When /etc/ld.so.cache is writeable by user running bitbake
+ then it creates invalid cache (in my case libstdc++.so
+ cannot be found after building zlib(-native) and I have to
+ call touch */libstdc++.so && /sbin/ldconfig to fix it.
+
+So remove ldconfig call from make install-libs
+
+Patch authored by Martin Jansa.
+
+Upstream-Status: Inappropriate [disable feature]
+
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
+---
+ lib/Makefile.elf-lib | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/lib/Makefile.elf-lib b/lib/Makefile.elf-lib
+index 78479d3..4a4a5ac 100644
+--- a/lib/Makefile.elf-lib
++++ b/lib/Makefile.elf-lib
+@@ -50,8 +50,6 @@ install-shlibs install:: $(ELF_LIB) installdirs-elf-lib $(DEP_INSTALL_SYMLINK)
+ $(E) " SYMLINK $(libdir)/$(ELF_IMAGE).so"
+ $(Q) $(INSTALL_SYMLINK) $(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ $(libdir)/$(ELF_IMAGE).so $(DESTDIR)
+- $(E) " LDCONFIG"
+- $(Q) -$(LDCONFIG)
+
+ install-strip: install
+ $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+@@ -67,7 +65,6 @@ uninstall-shlibs uninstall::
+ $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \
+ $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ $(DESTDIR)$(libdir)/$(ELF_IMAGE).so
+- -$(LDCONFIG)
+
+ clean::
+ $(RM) -rf elfshared
+--
+1.7.9.5
+
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/run-ptest b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/run-ptest
new file mode 100644
index 000000000..1ac251324
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs/run-ptest
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cd ./test
+./test_script &>../test.log
+if [ $? -eq 0 ]
+then
+ echo "PASS: e2fsprogs"
+ rm test.log
+else
+ echo "FAIL: e2fsprogs"
+fi
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend
new file mode 100644
index 000000000..35dd361d4
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend
@@ -0,0 +1,14 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+# Applying this patch is optional. Only some versions
+# of e2fsprogs need it. So try to apply it, but if it fails,
+# continue and hope the patch wasn't needed. If it is needed
+# and got skipped, the oeqa Smack tests will catch the failure.
+SRC_URI += "file://ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch;apply=no"
+
+do_patch[postfuncs] += "patch_xattr_support"
+patch_xattr_support () {
+ cd ${S}
+ cp lib/ext2fs/ext_attr.c lib/ext2fs/ext_attr.c.orig
+ patch lib/ext2fs/ext_attr.c <${WORKDIR}/ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch && rm lib/ext2fs/ext_attr.c.orig || mv lib/ext2fs/ext_attr.c.orig lib/ext2fs/ext_attr.c
+}
diff --git a/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_git.bb b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_git.bb
new file mode 100644
index 000000000..bc2d201a4
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/e2fsprogs_git.bb
@@ -0,0 +1,106 @@
+COREDIR = "${COREBASE}/meta/recipes-devtools/e2fsprogs"
+
+# This recipe is a copy of a e2fsprogs 1.42.99+1.43 from OE-core master and
+# only meant to be used when the current OE-core does not have that version yet.
+python () {
+ import os
+ upstream = os.path.join(d.getVar('COREDIR', True), 'e2fsprogs_1.42.9.bb')
+ if not os.path.exists(upstream):
+ raise bb.parse.SkipRecipe("This recipe replaces e2fsprogs 1.42.9 in OE-core. e2fsprogs from OE-core is something else and thus either recent enough to have xattr support or (less likely) something unexpected.")
+}
+
+
+require e2fsprogs.inc
+
+SRC_URI += "file://acinclude.m4 \
+ file://remove.ldconfig.call.patch \
+ file://quiet-debugfs.patch \
+ file://run-ptest \
+ file://ptest.patch \
+ file://mkdir.patch \
+"
+
+SRCREV = "0f26747167cc9d82df849b0aad387bf824f04544"
+PV = "1.42.99+1.43+git${SRCPV}"
+UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)$"
+
+EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
+ --enable-elf-shlibs --disable-libuuid --disable-uuidd \
+ --disable-libblkid --enable-verbose-makecmds"
+
+EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'
+
+do_configure_prepend () {
+ cp ${WORKDIR}/acinclude.m4 ${S}/
+}
+
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install
+ oe_runmake 'DESTDIR=${D}' install-libs
+ # We use blkid from util-linux now so remove from here
+ rm -f ${D}${base_libdir}/libblkid*
+ rm -rf ${D}${includedir}/blkid
+ rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
+ rm -f ${D}${base_sbindir}/blkid
+ rm -f ${D}${base_sbindir}/fsck
+ rm -f ${D}${base_sbindir}/findfs
+
+ # e2initrd_helper and the pkgconfig files belong in libdir
+ if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
+ install -d ${D}${libdir}
+ mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
+ mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
+ fi
+
+ oe_multilib_header ext2fs/ext2_types.h
+ install -d ${D}${base_bindir}
+ mv ${D}${bindir}/chattr ${D}${base_bindir}/chattr.e2fsprogs
+
+ install -v -m 755 ${S}/contrib/populate-extfs.sh ${D}${base_sbindir}/
+}
+
+do_install_append_class-target() {
+ # Clean host path in compile_et, mk_cmds
+ sed -i -e "s,ET_DIR=\"${S}/lib/et\",ET_DIR=\"${datadir}/et\",g" ${D}${bindir}/compile_et
+ sed -i -e "s,SS_DIR=\"${S}/lib/ss\",SS_DIR=\"${datadir}/ss\",g" ${D}${bindir}/mk_cmds
+}
+
+RDEPENDS_e2fsprogs = "e2fsprogs-badblocks"
+RRECOMMENDS_e2fsprogs = "e2fsprogs-mke2fs e2fsprogs-e2fsck"
+
+PACKAGES =+ "e2fsprogs-e2fsck e2fsprogs-mke2fs e2fsprogs-tune2fs e2fsprogs-badblocks e2fsprogs-resize2fs"
+PACKAGES =+ "libcomerr libss libe2p libext2fs"
+
+FILES_e2fsprogs-resize2fs = "${base_sbindir}/resize2fs*"
+FILES_e2fsprogs-e2fsck = "${base_sbindir}/e2fsck ${base_sbindir}/fsck.ext*"
+FILES_e2fsprogs-mke2fs = "${base_sbindir}/mke2fs ${base_sbindir}/mkfs.ext* ${sysconfdir}/mke2fs.conf"
+FILES_e2fsprogs-tune2fs = "${base_sbindir}/tune2fs ${base_sbindir}/e2label"
+FILES_e2fsprogs-badblocks = "${base_sbindir}/badblocks"
+FILES_libcomerr = "${base_libdir}/libcom_err.so.*"
+FILES_libss = "${base_libdir}/libss.so.*"
+FILES_libe2p = "${base_libdir}/libe2p.so.*"
+FILES_libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
+FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so"
+
+ALTERNATIVE_${PN} = "chattr"
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_LINK_NAME[chattr] = "${base_bindir}/chattr"
+ALTERNATIVE_TARGET[chattr] = "${base_bindir}/chattr.e2fsprogs"
+
+ALTERNATIVE_${PN}-doc = "fsck.8"
+ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
+
+RDEPENDS_${PN}-ptest += "${PN} ${PN}-tune2fs coreutils procps bash"
+
+do_compile_ptest() {
+ oe_runmake -C ${B}/tests
+}
+
+do_install_ptest() {
+ cp -a ${B}/tests ${D}${PTEST_PATH}/test
+ cp -a ${S}/tests/* ${D}${PTEST_PATH}/test
+ sed -e 's!../e2fsck/e2fsck!e2fsck!g' -i ${D}${PTEST_PATH}/test/*/expect*
+}
diff --git a/meta-security/recipes-devtools/e2fsprogs/files/ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch b/meta-security/recipes-devtools/e2fsprogs/files/ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch
new file mode 100644
index 000000000..67b8b68fb
--- /dev/null
+++ b/meta-security/recipes-devtools/e2fsprogs/files/ext_attr.c-fix-adding-multiple-xattrs-during-image-c.patch
@@ -0,0 +1,51 @@
+From 3b2b0922e031628f313f5480c4f1f9413c6656bf Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie@linuxfoundation.org>
+Date: Wed, 10 Feb 2016 15:51:43 +0100
+Subject: [PATCH] ext_attr.c: fix adding multiple xattrs during image creation
+
+http://www.nongnu.org/ext2-doc/ext2.html#CONTRIB-EXTENDED-ATTRIBUTES
+contains the small snippet that "The entry descriptors are sorted by
+attribute name, so that two extended attribute blocks can be compared
+efficiently".
+
+The libext2fs code in e2fsprogs needs to be taught about this minor
+sorting detail. Otherwise creating an image with "mkfs.ext -d" from a
+filesystem that reports xattrs in listxattr() in an order that does
+not match the expected order will lead to an image where listxattr()
+reports all xattrs, but reading some values fails with ENODATA.
+
+[Patch from RP, commit message from Patrick and RP]
+
+Upstream-Status: Pending [https://bugzilla.yoctoproject.org/show_bug.cgi?id=8992]
+---
+ lib/ext2fs/ext_attr.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c
+index 0a4f8c0..be8f9c3 100644
+--- a/lib/ext2fs/ext_attr.c
++++ b/lib/ext2fs/ext_attr.c
+@@ -258,6 +258,7 @@ static struct ea_name_index ea_names[] = {
+ static int attr_compare(const void *a, const void *b)
+ {
+ const struct ext2_xattr *xa = a, *xb = b;
++ size_t len;
+
+ if (xa->name == NULL)
+ return +1;
+@@ -267,7 +268,11 @@ static int attr_compare(const void *a, const void *b)
+ return -1;
+ else if (!strcmp(xb->name, "system.data"))
+ return +1;
+- return 0;
++ len = strlen(xa->name) - strlen(xb->name);
++ if (len)
++ return len;
++
++ return strcmp(xa->name, xb->name);
+ }
+
+ static const char *find_ea_prefix(int index)
+--
+2.1.4
+
diff --git a/meta-security/recipes-kernel/linux/linux-%.bbappend b/meta-security/recipes-kernel/linux/linux-%.bbappend
new file mode 100644
index 000000000..717d32e3a
--- /dev/null
+++ b/meta-security/recipes-kernel/linux/linux-%.bbappend
@@ -0,0 +1,17 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
+
+IS_KERNEL_RECIPE := "${@bb.data.inherits_class('kernel', d) and 'yes' or 'no'}"
+SMACK_KERNEL_SRC_URI_no = ""
+SMACK_KERNEL_SRC_URI_yes = ""
+
+# Kernel config fragment enabling Smack, without making it the default explicitly.
+SMACK_KERNEL_SRC_URI_yes += "file://smack.cfg"
+
+# When added, set Smack as the default LSM.
+SMACK_DEFAULT_SECURITY_CFG = "file://smack-default-lsm.cfg"
+
+# Add it by default, can be overridden by changing this variable here.
+SMACK_DEFAULT_SECURITY ??= "${SMACK_DEFAULT_SECURITY_CFG}"
+SMACK_KERNEL_SRC_URI_yes += " ${SMACK_DEFAULT_SECURITY}"
+
+SRC_URI_append_with-lsm-smack = "${SMACK_KERNEL_SRC_URI_${IS_KERNEL_RECIPE}}"
diff --git a/meta-security/recipes-kernel/linux/linux/audit.cfg b/meta-security/recipes-kernel/linux/linux/audit.cfg
new file mode 100644
index 000000000..214dbe33f
--- /dev/null
+++ b/meta-security/recipes-kernel/linux/linux/audit.cfg
@@ -0,0 +1,2 @@
+CONFIG_AUDIT=y
+CONFIG_AUDITSYSCALL=y
diff --git a/meta-security/recipes-kernel/linux/linux/smack-default-lsm.cfg b/meta-security/recipes-kernel/linux/linux/smack-default-lsm.cfg
new file mode 100644
index 000000000..b5c48454e
--- /dev/null
+++ b/meta-security/recipes-kernel/linux/linux/smack-default-lsm.cfg
@@ -0,0 +1,2 @@
+CONFIG_DEFAULT_SECURITY="smack"
+CONFIG_DEFAULT_SECURITY_SMACK=y
diff --git a/meta-security/recipes-kernel/linux/linux/smack.cfg b/meta-security/recipes-kernel/linux/linux/smack.cfg
new file mode 100644
index 000000000..62f465a45
--- /dev/null
+++ b/meta-security/recipes-kernel/linux/linux/smack.cfg
@@ -0,0 +1,8 @@
+CONFIG_IP_NF_SECURITY=m
+CONFIG_IP6_NF_SECURITY=m
+CONFIG_EXT2_FS_SECURITY=y
+CONFIG_EXT3_FS_SECURITY=y
+CONFIG_EXT4_FS_SECURITY=y
+CONFIG_SECURITY=y
+CONFIG_SECURITY_SMACK=y
+CONFIG_TMPFS_XATTR=y
diff --git a/meta-security/recipes-security/audit/audit/add-system-call-table-for-ARM.patch b/meta-security/recipes-security/audit/audit/add-system-call-table-for-ARM.patch
new file mode 100644
index 000000000..ad94d11bd
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/add-system-call-table-for-ARM.patch
@@ -0,0 +1,46 @@
+From 52ff74be2f01182ed9d4fcc3da059512fad63d72 Mon Sep 17 00:00:00 2001
+From: Han Chao <chan@windriver.com>
+Date: Thu, 27 Feb 2014 14:58:57 +0800
+Subject: [PATCH] add system call table for ARM.
+
+This change enable audit system call on ARM.
+Add arm System call table on machinetabs.h.
+Audit system call need enable kernel config CONFIG_AUDITSYSCALL.
+
+Signed-off-by: Han Chao <chan@windriver.com>
+---
+ lib/machinetabs.h | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/lib/machinetabs.h b/lib/machinetabs.h
+index ec2d033..1c2e284 100644
+--- a/lib/machinetabs.h
++++ b/lib/machinetabs.h
+@@ -1,10 +1,11 @@
+-/* This is a generated file, see Makefile.am for its inputs. */
+-static const char machine_strings[] = "i386\0i486\0i586\0i686\0ia64\0ppc\0ppc64\0s390\0s390x\0x86_64";
++/* Such is aways generated file, see Makefile.am for its inputs.
++ * But this version is not generated file, which is for ARM. */
++static const char machine_strings[] = "armeb\0armv5tejl\0armv5tel\0armv6l\0armv7l";
+ static const unsigned machine_s2i_s[] = {
+- 0,5,10,15,20,25,29,35,40,46,
++ 0,6,16,25,32,
+ };
+ static const int machine_s2i_i[] = {
+- 0,0,0,0,2,4,3,6,5,1,
++ 8,8,8,8,8,
+ };
+ static int machine_s2i(const char *s, int *value) {
+ size_t len, i;
+@@ -19,7 +20,7 @@ static int machine_s2i(const char *s, int *value) {
+ }
+ }
+ static const unsigned machine_i2s_direct[] = {
+- 0,46,20,29,25,40,35,
++ 39,85,59,68,64,
+ };
+ static const char *machine_i2s(int v) {
+ return i2s_direct__(machine_strings, machine_i2s_direct, 0, 6, v);
+--
+1.7.9.5
+
diff --git a/meta-security/recipes-security/audit/audit/audit-for-cross-compiling.patch b/meta-security/recipes-security/audit/audit/audit-for-cross-compiling.patch
new file mode 100644
index 000000000..60a23a8a4
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/audit-for-cross-compiling.patch
@@ -0,0 +1,2938 @@
+From f73f654734c5f0d1a6568c6c8fba232b01f919f4 Mon Sep 17 00:00:00 2001
+From: Joe MacDonald <joe@deserted.net>
+Date: Wed, 23 Oct 2013 16:02:34 -0400
+Subject: [PATCH] audit: use generated headers for cross compiling
+
+In the same vein as the patch for audit 2.2.1 (commit: 6c77455b), we generate
+the headers which are inherently architecture specific but portable on a
+convenient platform and use them for all platforms.
+
+Upstream-Status: Inappropriate [cross-compile specific]
+
+Signed-off-by: Joe MacDonald <joe@deserted.net>
+---
+ auparse/Makefile.am | 200 ---------------------------------------------
+ auparse/accesstabs.h | 6 ++
+ auparse/captabs.h | 14 ++++
+ auparse/clocktabs.h | 8 ++
+ auparse/clone-flagtabs.h | 10 +++
+ auparse/epoll_ctls.h | 8 ++
+ auparse/famtabs.h | 14 ++++
+ auparse/fcntl-cmdtabs.h | 17 ++++
+ auparse/flagtabs.h | 6 ++
+ auparse/icmptypetabs.h | 10 +++
+ auparse/ip6optnametabs.h | 20 +++++
+ auparse/ipccmdtabs.h | 6 ++
+ auparse/ipctabs.h | 11 +++
+ auparse/ipoptnametabs.h | 17 ++++
+ auparse/mmaptabs.h | 8 ++
+ auparse/mounttabs.h | 10 +++
+ auparse/nfprototabs.h | 9 ++
+ auparse/open-flagtabs.h | 8 ++
+ auparse/persontabs.h | 17 ++++
+ auparse/pktoptnametabs.h | 10 +++
+ auparse/prctl_opttabs.h | 14 ++++
+ auparse/prottabs.h | 6 ++
+ auparse/ptracetabs.h | 17 ++++
+ auparse/recvtabs.h | 8 ++
+ auparse/rlimittabs.h | 10 +++
+ auparse/schedtabs.h | 8 ++
+ auparse/seccomptabs.h | 11 +++
+ auparse/seektabs.h | 8 ++
+ auparse/shm_modetabs.h | 6 ++
+ auparse/signaltabs.h | 14 ++++
+ auparse/sockleveltabs.h | 12 +++
+ auparse/sockoptnametabs.h | 23 ++++++
+ auparse/socktabs.h | 10 +++
+ auparse/socktypetabs.h | 8 ++
+ auparse/tcpoptnametabs.h | 12 +++
+ auparse/typetabs.h | 35 ++++++++
+ auparse/umounttabs.h | 6 ++
+ lib/Makefile.am | 106 ------------------------
+ lib/aarch64_tables.h | 125 ++++++++++++++++++++++++++++
+ lib/actiontabs.h | 26 ++++++
+ lib/alpha_tables.h | 196 ++++++++++++++++++++++++++++++++++++++++++++
+ lib/armeb_tables.h | 165 +++++++++++++++++++++++++++++++++++++
+ lib/errtabs.h | 78 ++++++++++++++++++
+ lib/fieldtabs.h | 49 +++++++++++
+ lib/flagtabs.h | 26 ++++++
+ lib/ftypetabs.h | 29 +++++++
+ lib/i386_tables.h | 163 ++++++++++++++++++++++++++++++++++++
+ lib/ia64_tables.h | 147 +++++++++++++++++++++++++++++++++
+ lib/machinetabs.h | 26 ++++++
+ lib/msg_typetabs.h | 104 +++++++++++++++++++++++
+ lib/optabs.h | 11 +++
+ lib/ppc_tables.h | 163 ++++++++++++++++++++++++++++++++++++
+ lib/s390_tables.h | 153 ++++++++++++++++++++++++++++++++++
+ lib/s390x_tables.h | 144 ++++++++++++++++++++++++++++++++
+ lib/x86_64_tables.h | 150 ++++++++++++++++++++++++++++++++++
+ 55 files changed, 2172 insertions(+), 306 deletions(-)
+ create mode 100644 auparse/accesstabs.h
+ create mode 100644 auparse/captabs.h
+ create mode 100644 auparse/clocktabs.h
+ create mode 100644 auparse/clone-flagtabs.h
+ create mode 100644 auparse/epoll_ctls.h
+ create mode 100644 auparse/famtabs.h
+ create mode 100644 auparse/fcntl-cmdtabs.h
+ create mode 100644 auparse/flagtabs.h
+ create mode 100644 auparse/icmptypetabs.h
+ create mode 100644 auparse/ip6optnametabs.h
+ create mode 100644 auparse/ipccmdtabs.h
+ create mode 100644 auparse/ipctabs.h
+ create mode 100644 auparse/ipoptnametabs.h
+ create mode 100644 auparse/mmaptabs.h
+ create mode 100644 auparse/mounttabs.h
+ create mode 100644 auparse/nfprototabs.h
+ create mode 100644 auparse/open-flagtabs.h
+ create mode 100644 auparse/persontabs.h
+ create mode 100644 auparse/pktoptnametabs.h
+ create mode 100644 auparse/prctl_opttabs.h
+ create mode 100644 auparse/prottabs.h
+ create mode 100644 auparse/ptracetabs.h
+ create mode 100644 auparse/recvtabs.h
+ create mode 100644 auparse/rlimittabs.h
+ create mode 100644 auparse/schedtabs.h
+ create mode 100644 auparse/seccomptabs.h
+ create mode 100644 auparse/seektabs.h
+ create mode 100644 auparse/shm_modetabs.h
+ create mode 100644 auparse/signaltabs.h
+ create mode 100644 auparse/sockleveltabs.h
+ create mode 100644 auparse/sockoptnametabs.h
+ create mode 100644 auparse/socktabs.h
+ create mode 100644 auparse/socktypetabs.h
+ create mode 100644 auparse/tcpoptnametabs.h
+ create mode 100644 auparse/typetabs.h
+ create mode 100644 auparse/umounttabs.h
+ create mode 100644 lib/aarch64_tables.h
+ create mode 100644 lib/actiontabs.h
+ create mode 100644 lib/alpha_tables.h
+ create mode 100644 lib/armeb_tables.h
+ create mode 100644 lib/errtabs.h
+ create mode 100644 lib/fieldtabs.h
+ create mode 100644 lib/flagtabs.h
+ create mode 100644 lib/ftypetabs.h
+ create mode 100644 lib/i386_tables.h
+ create mode 100644 lib/ia64_tables.h
+ create mode 100644 lib/machinetabs.h
+ create mode 100644 lib/msg_typetabs.h
+ create mode 100644 lib/optabs.h
+ create mode 100644 lib/ppc_tables.h
+ create mode 100644 lib/s390_tables.h
+ create mode 100644 lib/s390x_tables.h
+ create mode 100644 lib/x86_64_tables.h
+
+diff --git a/auparse/Makefile.am b/auparse/Makefile.am
+index f0ca18f..7d1527c 100644
+--- a/auparse/Makefile.am
++++ b/auparse/Makefile.am
+@@ -53,203 +53,3 @@ BUILT_SOURCES = accesstabs.h captabs.h clocktabs.h clone-flagtabs.h \
+ seektabs.h shm_modetabs.h signaltabs.h sockoptnametabs.h \
+ socktabs.h sockleveltabs.h socktypetabs.h \
+ tcpoptnametabs.h typetabs.h umounttabs.h
+-noinst_PROGRAMS = gen_accesstabs_h gen_captabs_h gen_clock_h \
+- gen_clone-flagtabs_h \
+- gen_epoll_ctls_h gen_famtabs_h \
+- gen_fcntl-cmdtabs_h gen_flagtabs_h \
+- gen_icmptypetabs_h gen_ipctabs_h gen_ipccmdtabs_h\
+- gen_ipoptnametabs_h gen_ip6optnametabs_h gen_nfprototabs_h \
+- gen_mmaptabs_h gen_mounttabs_h \
+- gen_open-flagtabs_h gen_persontabs_h \
+- gen_prctl_opttabs_h gen_pktoptnametabs_h gen_prottabs_h \
+- gen_recvtabs_h gen_rlimit_h gen_ptracetabs_h \
+- gen_schedtabs_h gen_seccomptabs_h \
+- gen_seektabs_h gen_shm_modetabs_h gen_signals_h \
+- gen_sockoptnametabs_h gen_socktabs_h gen_sockleveltabs_h \
+- gen_socktypetabs_h gen_tcpoptnametabs_h gen_typetabs_h \
+- gen_umounttabs_h
+-
+-gen_accesstabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h accesstab.h
+-gen_accesstabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="accesstab.h"'
+-accesstabs.h: gen_accesstabs_h Makefile
+- ./gen_accesstabs_h --i2s-transtab access > $@
+-
+-gen_captabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h captab.h
+-gen_captabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="captab.h"'
+-captabs.h: gen_captabs_h Makefile
+- ./gen_captabs_h --i2s cap > $@
+-
+-gen_clock_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h clocktab.h
+-gen_clock_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="clocktab.h"'
+-clocktabs.h: gen_clock_h Makefile
+- ./gen_clock_h --i2s clock > $@
+-
+-gen_clone_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
+- clone-flagtab.h
+-gen_clone_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="clone-flagtab.h"'
+-clone-flagtabs.h: gen_clone-flagtabs_h Makefile
+- ./gen_clone-flagtabs_h --i2s-transtab clone_flag > $@
+-
+-gen_epoll_ctls_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h epoll_ctl.h
+-gen_epoll_ctls_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="epoll_ctl.h"'
+-epoll_ctls.h: gen_epoll_ctls_h Makefile
+- ./gen_epoll_ctls_h --i2s epoll_ctl > $@
+-
+-gen_famtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h famtab.h
+-gen_famtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="famtab.h"'
+-famtabs.h: gen_famtabs_h Makefile
+- ./gen_famtabs_h --i2s fam > $@
+-
+-gen_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h flagtab.h
+-# ../auparse/ is used to avoid using ../lib/flagtab.h
+-gen_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="../auparse/flagtab.h"'
+-flagtabs.h: gen_flagtabs_h Makefile
+- ./gen_flagtabs_h --i2s-transtab flag > $@
+-
+-gen_fcntl_cmdtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
+- fcntl-cmdtab.h
+-gen_fcntl_cmdtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="fcntl-cmdtab.h"'
+-fcntl-cmdtabs.h: gen_fcntl-cmdtabs_h Makefile
+- ./gen_fcntl-cmdtabs_h --i2s fcntl > $@
+-
+-gen_icmptypetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h icmptypetab.h
+-gen_icmptypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="icmptypetab.h"'
+-icmptypetabs.h: gen_icmptypetabs_h Makefile
+- ./gen_icmptypetabs_h --i2s icmptype > $@
+-
+-gen_ipctabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ipctab.h
+-gen_ipctabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ipctab.h"'
+-ipctabs.h: gen_ipctabs_h Makefile
+- ./gen_ipctabs_h --i2s ipc > $@
+-
+-gen_ipccmdtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ipccmdtab.h
+-gen_ipccmdtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ipccmdtab.h"'
+-ipccmdtabs.h: gen_ipccmdtabs_h Makefile
+- ./gen_ipccmdtabs_h --i2s-transtab ipccmd > $@
+-
+-gen_ipoptnametabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ipoptnametab.h
+-gen_ipoptnametabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ipoptnametab.h"'
+-ipoptnametabs.h: gen_ipoptnametabs_h Makefile
+- ./gen_ipoptnametabs_h --i2s ipoptname > $@
+-
+-gen_ip6optnametabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ip6optnametab.h
+-gen_ip6optnametabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ip6optnametab.h"'
+-ip6optnametabs.h: gen_ip6optnametabs_h Makefile
+- ./gen_ip6optnametabs_h --i2s ip6optname > $@
+-
+-gen_mmaptabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h mmaptab.h
+-gen_mmaptabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="mmaptab.h"'
+-mmaptabs.h: gen_mmaptabs_h Makefile
+- ./gen_mmaptabs_h --i2s-transtab mmap > $@
+-
+-gen_mounttabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h mounttab.h
+-gen_mounttabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="mounttab.h"'
+-mounttabs.h: gen_mounttabs_h Makefile
+- ./gen_mounttabs_h --i2s-transtab mount > $@
+-
+-gen_nfprototabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h nfprototab.h
+-gen_nfprototabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="nfprototab.h"'
+-nfprototabs.h: gen_nfprototabs_h Makefile
+- ./gen_nfprototabs_h --i2s nfproto > $@
+-
+-gen_open_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
+- open-flagtab.h
+-gen_open_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="open-flagtab.h"'
+-open-flagtabs.h: gen_open-flagtabs_h Makefile
+- ./gen_open-flagtabs_h --i2s-transtab open_flag > $@
+-
+-gen_persontabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h persontab.h
+-gen_persontabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="persontab.h"'
+-persontabs.h: gen_persontabs_h Makefile
+- ./gen_persontabs_h --i2s person > $@
+-
+-gen_ptracetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h ptracetab.h
+-gen_ptracetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ptracetab.h"'
+-ptracetabs.h: gen_ptracetabs_h Makefile
+- ./gen_ptracetabs_h --i2s ptrace > $@
+-
+-gen_prctl_opttabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h prctl-opt-tab.h
+-gen_prctl_opttabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="prctl-opt-tab.h"'
+-prctl_opttabs.h: gen_prctl_opttabs_h Makefile
+- ./gen_prctl_opttabs_h --i2s prctl_opt > $@
+-
+-gen_pktoptnametabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h pktoptnametab.h
+-gen_pktoptnametabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="pktoptnametab.h"'
+-pktoptnametabs.h: gen_pktoptnametabs_h Makefile
+- ./gen_pktoptnametabs_h --i2s pktoptname > $@
+-
+-gen_prottabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h prottab.h
+-gen_prottabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="prottab.h"'
+-prottabs.h: gen_prottabs_h Makefile
+- ./gen_prottabs_h --i2s-transtab prot > $@
+-
+-gen_recvtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h recvtab.h
+-gen_recvtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="recvtab.h"'
+-recvtabs.h: gen_recvtabs_h Makefile
+- ./gen_recvtabs_h --i2s-transtab recv > $@
+-
+-gen_rlimit_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h rlimittab.h
+-gen_rlimit_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="rlimittab.h"'
+-rlimittabs.h: gen_rlimit_h Makefile
+- ./gen_rlimit_h --i2s rlimit > $@
+-
+-gen_schedtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h schedtab.h
+-gen_schedtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="schedtab.h"'
+-schedtabs.h: gen_schedtabs_h Makefile
+- ./gen_schedtabs_h --i2s sched > $@
+-
+-gen_seccomptabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h seccomptab.h
+-gen_seccomptabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="seccomptab.h"'
+-seccomptabs.h: gen_seccomptabs_h Makefile
+- ./gen_seccomptabs_h --i2s seccomp > $@
+-
+-gen_seektabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h seektab.h
+-gen_seektabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="seektab.h"'
+-seektabs.h: gen_seektabs_h Makefile
+- ./gen_seektabs_h --i2s seek > $@
+-
+-gen_shm_modetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h shm_modetab.h
+-gen_shm_modetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="shm_modetab.h"'
+-shm_modetabs.h: gen_shm_modetabs_h Makefile
+- ./gen_shm_modetabs_h --i2s-transtab shm_mode > $@
+-
+-gen_signals_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h signaltab.h
+-gen_signals_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="signaltab.h"'
+-signaltabs.h: gen_signals_h Makefile
+- ./gen_signals_h --i2s signal > $@
+-
+-gen_sockleveltabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h sockleveltab.h
+-gen_sockleveltabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="sockleveltab.h"'
+-sockleveltabs.h: gen_sockleveltabs_h Makefile
+- ./gen_sockleveltabs_h --i2s socklevel > $@
+-
+-gen_sockoptnametabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h sockoptnametab.h
+-gen_sockoptnametabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="sockoptnametab.h"'
+-sockoptnametabs.h: gen_sockoptnametabs_h Makefile
+- ./gen_sockoptnametabs_h --i2s sockoptname > $@
+-
+-gen_socktabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h socktab.h
+-gen_socktabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="socktab.h"'
+-socktabs.h: gen_socktabs_h Makefile
+- ./gen_socktabs_h --i2s sock > $@
+-
+-gen_socktypetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h socktypetab.h
+-gen_socktypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="socktypetab.h"'
+-socktypetabs.h: gen_socktypetabs_h Makefile
+- ./gen_socktypetabs_h --i2s sock_type > $@
+-
+-gen_tcpoptnametabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h tcpoptnametab.h
+-gen_tcpoptnametabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="tcpoptnametab.h"'
+-tcpoptnametabs.h: gen_tcpoptnametabs_h Makefile
+- ./gen_tcpoptnametabs_h --i2s tcpoptname > $@
+-
+-gen_typetabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h typetab.h
+-gen_typetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="typetab.h"'
+-typetabs.h: gen_typetabs_h Makefile
+- ./gen_typetabs_h --s2i type > $@
+-
+-gen_umounttabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h umounttab.h
+-gen_umounttabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="umounttab.h"'
+-umounttabs.h: gen_umounttabs_h Makefile
+- ./gen_umounttabs_h --i2s-transtab umount > $@
+-
+diff --git a/auparse/accesstabs.h b/auparse/accesstabs.h
+new file mode 100644
+index 0000000..867d99c
+--- /dev/null
++++ b/auparse/accesstabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char access_strings[] = "R_OK\0W_OK\0X_OK";
++static const struct transtab access_table[] = {
++ {1,10},{2,5},{4,0},
++};
++#define ACCESS_NUM_ENTRIES (sizeof(access_table) / sizeof(*access_table))
+diff --git a/auparse/captabs.h b/auparse/captabs.h
+new file mode 100644
+index 0000000..9267466
+--- /dev/null
++++ b/auparse/captabs.h
+@@ -0,0 +1,14 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char cap_strings[] = "audit_control\0audit_write\0block_suspend\0chown\0compromise_kernel\0dac_override\0dac_read_search\0fowner\0fsetid\0ipc_lock\0"
++ "ipc_owner\0kill\0lease\0linux_immutable\0mac_admin\0mac_override\0mknod\0net_admin\0net_bind_service\0net_broadcast\0"
++ "net_raw\0setfcap\0setgid\0setpcap\0setuid\0sys_admin\0sys_boot\0sys_chroot\0sys_module\0sys_nice\0"
++ "sys_pacct\0sys_ptrace\0sys_rawio\0sys_resource\0sys_time\0sys_tty_config\0syslog\0wake_alarm";
++static const unsigned cap_i2s_direct[] = {
++ 40,64,77,93,100,126,239,254,246,137,
++ 192,209,182,223,107,116,291,332,280,321,
++ 311,261,271,302,342,355,364,176,131,14,
++ 0,231,163,153,379,386,26,46,
++};
++static const char *cap_i2s(int v) {
++ return i2s_direct__(cap_strings, cap_i2s_direct, 0, 37, v);
++}
+diff --git a/auparse/clocktabs.h b/auparse/clocktabs.h
+new file mode 100644
+index 0000000..03f9f09
+--- /dev/null
++++ b/auparse/clocktabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char clock_strings[] = "CLOCK_BOOTTIME\0CLOCK_BOOTTIME_ALARM\0CLOCK_MONOTONIC\0CLOCK_MONOTONIC_COARSE\0CLOCK_MONOTONIC_RAW\0CLOCK_PROCESS_CPUTIME_ID\0CLOCK_REALTIME\0CLOCK_REALTIME_ALARM\0CLOCK_REALTIME_COARSE\0CLOCK_THREAD_CPUTIME_ID";
++static const unsigned clock_i2s_direct[] = {
++ 120,36,95,178,75,156,52,0,135,15,
++};
++static const char *clock_i2s(int v) {
++ return i2s_direct__(clock_strings, clock_i2s_direct, 0, 9, v);
++}
+diff --git a/auparse/clone-flagtabs.h b/auparse/clone-flagtabs.h
+new file mode 100644
+index 0000000..b8f815d
+--- /dev/null
++++ b/auparse/clone-flagtabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char clone_flag_strings[] = "CLONE_CHILD_CLEARTID\0CLONE_CHILD_SETTID\0CLONE_DETACHED\0CLONE_FILES\0CLONE_FS\0CLONE_IO\0CLONE_NEWIPC\0CLONE_NEWNET\0CLONE_NEWNS\0CLONE_NEWPID\0"
++ "CLONE_NEWUSER\0CLONE_NEWUTS\0CLONE_PARENT\0CLONE_PARENT_SETTID\0CLONE_PTRACE\0CLONE_SETTLS\0CLONE_SIGHAND\0CLONE_STOPPED\0CLONE_SYSVSEM\0CLONE_THREAD\0"
++ "CLONE_UNTRACED\0CLONE_VFORK\0CLONE_VM";
++static const struct transtab clone_flag_table[] = {
++ {256,304},{512,67},{1024,55},{2048,222},{8192,196},{16384,292},{32768,163},{65536,264},{131072,111},{262144,250},
++ {524288,209},{1048576,176},{2097152,0},{4194304,40},{8388608,277},{16777216,21},{33554432,236},{67108864,150},{134217728,85},{268435456,136},
++ {536870912,123},{1073741824,98},{-2147483648,76},
++};
++#define CLONE_FLAG_NUM_ENTRIES (sizeof(clone_flag_table) / sizeof(*clone_flag_table))
+diff --git a/auparse/epoll_ctls.h b/auparse/epoll_ctls.h
+new file mode 100644
+index 0000000..2787c18
+--- /dev/null
++++ b/auparse/epoll_ctls.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char epoll_ctl_strings[] = "EPOLL_CTL_ADD\0EPOLL_CTL_DEL\0EPOLL_CTL_MOD";
++static const unsigned epoll_ctl_i2s_direct[] = {
++ 0,14,28,
++};
++static const char *epoll_ctl_i2s(int v) {
++ return i2s_direct__(epoll_ctl_strings, epoll_ctl_i2s_direct, 1, 3, v);
++}
+diff --git a/auparse/famtabs.h b/auparse/famtabs.h
+new file mode 100644
+index 0000000..cae396b
+--- /dev/null
++++ b/auparse/famtabs.h
+@@ -0,0 +1,14 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char fam_strings[] = "alg\0appletalk\0ash\0atmpvc\0atmsvc\0ax25\0bluetooth\0bridge\0caif\0can\0"
++ "decnet\0econet\0ieee802154\0inet\0inet6\0ipx\0irda\0isdn\0iucv\0key\0"
++ "llc\0local\0netbeui\0netlink\0netrom\0nfc\0packet\0phonet\0pppox\0rds\0"
++ "rose\0rxrpc\0security\0sna\0tipc\0vsock\0wanpipe\0x25";
++static const unsigned fam_i2s_direct[] = {
++ 126,88,32,99,4,148,47,18,226,93,
++ 183,63,132,194,118,140,159,14,70,25,
++ 179,203,103,173,218,122,-1u,-1u,59,207,
++ 37,113,188,108,166,77,54,0,155,212,
++};
++static const char *fam_i2s(int v) {
++ return i2s_direct__(fam_strings, fam_i2s_direct, 1, 40, v);
++}
+diff --git a/auparse/fcntl-cmdtabs.h b/auparse/fcntl-cmdtabs.h
+new file mode 100644
+index 0000000..18c6cc7
+--- /dev/null
++++ b/auparse/fcntl-cmdtabs.h
+@@ -0,0 +1,17 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char fcntl_strings[] = "F_CANCELLK\0F_DUPFD\0F_DUPFD_CLOEXEC\0F_GETFD\0F_GETFL\0F_GETLEASE\0F_GETLK\0F_GETLK64\0F_GETOWN\0F_GETOWNER_UIDS\0"
++ "F_GETOWN_EX\0F_GETPIPE_SZ\0F_GETSIG\0F_NOTIFY\0F_SETFD\0F_SETFL\0F_SETLEASE\0F_SETLK\0F_SETLK64\0F_SETLKW\0"
++ "F_SETLKW64\0F_SETOWN\0F_SETOWN_EX\0F_SETPIPE_SZ\0F_SETSIG";
++static const int fcntl_i2s_i[] = {
++ 0,1,2,3,4,5,6,7,8,9,
++ 10,11,12,13,14,15,16,17,1024,1025,
++ 1026,1029,1030,1031,1032,
++};
++static const unsigned fcntl_i2s_s[] = {
++ 11,35,148,43,156,62,175,193,213,80,
++ 247,130,70,183,202,222,105,89,164,51,
++ 139,0,19,234,117,
++};
++static const char *fcntl_i2s(int v) {
++ return i2s_bsearch__(fcntl_strings, fcntl_i2s_i, fcntl_i2s_s, 25, v);
++}
+diff --git a/auparse/flagtabs.h b/auparse/flagtabs.h
+new file mode 100644
+index 0000000..5f57e14
+--- /dev/null
++++ b/auparse/flagtabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char flag_strings[] = "access\0atomic\0continue\0create\0directory\0follow\0noalt\0open\0parent";
++static const struct transtab flag_table[] = {
++ {1,40},{2,30},{4,14},{16,58},{32,47},{64,7},{256,53},{512,23},{1024,0},
++};
++#define FLAG_NUM_ENTRIES (sizeof(flag_table) / sizeof(*flag_table))
+diff --git a/auparse/icmptypetabs.h b/auparse/icmptypetabs.h
+new file mode 100644
+index 0000000..49b44bf
+--- /dev/null
++++ b/auparse/icmptypetabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char icmptype_strings[] = "address-mask-reply\0address-mask-request\0destination-unreachable\0echo\0echo-reply\0info-reply\0info-request\0parameter-problem\0redirect\0source-quench\0"
++ "time-exceeded\0timestamp-reply\0timestamp-request";
++static const unsigned icmptype_i2s_direct[] = {
++ 69,-1u,-1u,40,131,122,-1u,-1u,64,-1u,
++ -1u,145,104,175,159,91,80,19,0,
++};
++static const char *icmptype_i2s(int v) {
++ return i2s_direct__(icmptype_strings, icmptype_i2s_direct, 0, 18, v);
++}
+diff --git a/auparse/ip6optnametabs.h b/auparse/ip6optnametabs.h
+new file mode 100644
+index 0000000..4af11c2
+--- /dev/null
++++ b/auparse/ip6optnametabs.h
+@@ -0,0 +1,20 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ip6optname_strings[] = "IP6T_SO_GET_REVISION_MATCH\0IP6T_SO_GET_REVISION_TARGET\0IP6T_SO_ORIGINAL_DST\0IP6T_SO_SET_ADD_COUNTERS\0IP6T_SO_SET_REPLACE\0IPV6_2292DSTOPTS\0IPV6_2292HOPLIMIT\0IPV6_2292HOPOPTS\0IPV6_2292PKTINFO\0IPV6_2292PKTOPTIONS\0"
++ "IPV6_2292RTHDR\0IPV6_ADDRFORM\0IPV6_ADDR_PREFERENCES\0IPV6_ADD_MEMBERSHIP\0IPV6_AUTHHDR\0IPV6_CHECKSUM\0IPV6_DONTFRAG\0IPV6_DROP_MEMBERSHIP\0IPV6_DSTOPTS\0IPV6_FLOWINFO\0"
++ "IPV6_FLOWINFO_SEND\0IPV6_FLOWLABEL_MGR\0IPV6_HOPLIMIT\0IPV6_HOPOPTS\0IPV6_IPSEC_POLICY\0IPV6_JOIN_ANYCAST\0IPV6_LEAVE_ANYCAST\0IPV6_MINHOPCOUNT\0IPV6_MTU\0IPV6_MTU_DISCOVER\0"
++ "IPV6_MULTICAST_HOPS\0IPV6_MULTICAST_IF\0IPV6_MULTICAST_LOOP\0IPV6_NEXTHOP\0IPV6_ORIGDSTADDR\0IPV6_PATHMTU\0IPV6_PKTINFO\0IPV6_RECVDSTOPTS\0IPV6_RECVERR\0IPV6_RECVHOPLIMIT\0"
++ "IPV6_RECVHOPOPTS\0IPV6_RECVPATHMTU\0IPV6_RECVPKTINFO\0IPV6_RECVRTHDR\0IPV6_RECVTCLASS\0IPV6_ROUTER_ALERT\0IPV6_RTHDR\0IPV6_RTHDRDSTOPTS\0IPV6_TCLASS\0IPV6_TRANSPARENT\0"
++ "IPV6_UNICAST_HOPS\0IPV6_UNICAST_IF\0IPV6_USE_MIN_MTU\0IPV6_V6ONLY\0IPV6_XFRM_POLICY";
++static const unsigned ip6optname_i2s_direct[] = {
++ 225,173,156,121,210,190,294,138,592,281,
++ 356,-1u,-1u,-1u,-1u,854,554,534,572,261,
++ 322,778,516,507,665,905,453,471,-1u,-1u,
++ -1u,389,370,435,917,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,730,635,
++ 678,408,696,422,807,747,796,648,343,713,
++ 622,308,888,101,76,762,825,0,27,-1u,
++ -1u,239,490,605,837,872,-1u,-1u,-1u,55,
++};
++static const char *ip6optname_i2s(int v) {
++ return i2s_direct__(ip6optname_strings, ip6optname_i2s_direct, 1, 80, v);
++}
+diff --git a/auparse/ipccmdtabs.h b/auparse/ipccmdtabs.h
+new file mode 100644
+index 0000000..ff43dbb
+--- /dev/null
++++ b/auparse/ipccmdtabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ipccmd_strings[] = "IPC_CREAT\0IPC_EXCL\0IPC_NOWAIT";
++static const struct transtab ipccmd_table[] = {
++ {512,0},{1024,10},{2048,19},
++};
++#define IPCCMD_NUM_ENTRIES (sizeof(ipccmd_table) / sizeof(*ipccmd_table))
+diff --git a/auparse/ipctabs.h b/auparse/ipctabs.h
+new file mode 100644
+index 0000000..4bf3bcd
+--- /dev/null
++++ b/auparse/ipctabs.h
+@@ -0,0 +1,11 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ipc_strings[] = "msgctl\0msgget\0msgrcv\0msgsnd\0semctl\0semget\0semop\0semtimedop\0shmat\0shmctl\0"
++ "shmdt\0shmget";
++static const unsigned ipc_i2s_direct[] = {
++ 42,35,28,48,-1u,-1u,-1u,-1u,-1u,-1u,
++ 21,14,7,0,-1u,-1u,-1u,-1u,-1u,-1u,
++ 59,72,78,65,
++};
++static const char *ipc_i2s(int v) {
++ return i2s_direct__(ipc_strings, ipc_i2s_direct, 1, 24, v);
++}
+diff --git a/auparse/ipoptnametabs.h b/auparse/ipoptnametabs.h
+new file mode 100644
+index 0000000..fb0b8b7
+--- /dev/null
++++ b/auparse/ipoptnametabs.h
+@@ -0,0 +1,17 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ipoptname_strings[] = "IPT_SO_GET_REVISION_TARGET\0IPT_SO_SET_ADD_COUNTERS\0IPT_SO_SET_REPLACE\0IP_ADD_MEMBERSHIP\0IP_ADD_SOURCE_MEMBERSHIP\0IP_BLOCK_SOURCE\0IP_DROP_MEMBERSHIP\0IP_DROP_SOURCE_MEMBERSHIP\0IP_FREEBIND\0IP_HDRINCL\0"
++ "IP_IPSEC_POLICY\0IP_MINTTL\0IP_MSFILTER\0IP_MTU\0IP_MTU_DISCOVER\0IP_MULTICAST_ALL\0IP_MULTICAST_IF\0IP_MULTICAST_LOOP\0IP_MULTICAST_TTL\0IP_NODEFRAG\0"
++ "IP_OPTIONS\0IP_ORIGDSTADDR\0IP_PASSSEC\0IP_PKTINFO\0IP_PKTOPTIONS\0IP_RECVERR\0IP_RECVOPTS\0IP_RECVTTL\0IP_RETOPTS\0IP_ROUTER_ALERT\0"
++ "IP_TOS\0IP_TRANSPARENT\0IP_TTL\0IP_UNBLOCK_SOURCE\0IP_UNICAST_IF\0IP_XFRM_POLICY";
++static const unsigned ipoptname_i2s_direct[] = {
++ 461,483,186,338,445,411,434,375,386,242,
++ 400,423,-1u,235,174,197,522,364,468,349,
++ 213,326,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,275,309,291,70,129,490,113,88,148,
++ 223,-1u,-1u,-1u,-1u,-1u,-1u,-1u,258,508,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,51,27,0,
++};
++static const char *ipoptname_i2s(int v) {
++ return i2s_direct__(ipoptname_strings, ipoptname_i2s_direct, 1, 66, v);
++}
+diff --git a/auparse/mmaptabs.h b/auparse/mmaptabs.h
+new file mode 100644
+index 0000000..386833c
+--- /dev/null
++++ b/auparse/mmaptabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char mmap_strings[] = "MAP_32BIT\0MAP_ANONYMOUS\0MAP_DENYWRITE\0MAP_EXECUTABLE\0MAP_FIXED\0MAP_GROWSDOWN\0MAP_HUGETLB\0MAP_LOCKED\0MAP_NONBLOCK\0MAP_NORESERVE\0"
++ "MAP_POPULATE\0MAP_PRIVATE\0MAP_SHARED\0MAP_STACK";
++static const struct transtab mmap_table[] = {
++ {1,152},{2,140},{16,53},{32,10},{64,0},{256,63},{2048,24},{4096,38},{8192,89},{16384,113},
++ {32768,127},{65536,100},{131072,163},{262144,77},
++};
++#define MMAP_NUM_ENTRIES (sizeof(mmap_table) / sizeof(*mmap_table))
+diff --git a/auparse/mounttabs.h b/auparse/mounttabs.h
+new file mode 100644
+index 0000000..ca66885
+--- /dev/null
++++ b/auparse/mounttabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char mount_strings[] = "MS_ACTIVE\0MS_BIND\0MS_BORN\0MS_DIRSYNC\0MS_I_VERSION\0MS_KERNMOUNT\0MS_MANDLOCK\0MS_MOVE\0MS_NOATIME\0MS_NODEV\0"
++ "MS_NODIRATIME\0MS_NOEXEC\0MS_NOSEC\0MS_NOSUID\0MS_NOUSER\0MS_POSIXACL\0MS_PRIVATE\0MS_RDONLY\0MS_REC\0MS_RELATIME\0"
++ "MS_REMOUNT\0MS_SHARED\0MS_SILENT\0MS_SLAVE\0MS_SNAP_STABLE\0MS_STRICTATIME\0MS_SYNCHRONOUS\0MS_UNBINDABLE";
++static const struct transtab mount_table[] = {
++ {1,179},{2,136},{4,94},{8,117},{16,278},{32,208},{64,63},{128,26},{1024,83},{2048,103},
++ {4096,10},{8192,75},{16384,189},{32768,229},{65536,156},{131072,293},{262144,168},{524288,239},{1048576,219},{2097152,196},
++ {4194304,50},{8388608,37},{16777216,263},{134217728,248},{268435456,127},{536870912,18},{1073741824,0},{-2147483648,146},
++};
++#define MOUNT_NUM_ENTRIES (sizeof(mount_table) / sizeof(*mount_table))
+diff --git a/auparse/nfprototabs.h b/auparse/nfprototabs.h
+new file mode 100644
+index 0000000..9bb2723
+--- /dev/null
++++ b/auparse/nfprototabs.h
+@@ -0,0 +1,9 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char nfproto_strings[] = "arp\0bridge\0decnet\0ipv4\0ipv6\0unspecified";
++static const unsigned nfproto_i2s_direct[] = {
++ 28,-1u,18,0,-1u,-1u,-1u,4,-1u,-1u,
++ 23,-1u,11,
++};
++static const char *nfproto_i2s(int v) {
++ return i2s_direct__(nfproto_strings, nfproto_i2s_direct, 0, 12, v);
++}
+diff --git a/auparse/open-flagtabs.h b/auparse/open-flagtabs.h
+new file mode 100644
+index 0000000..5e3c3eb
+--- /dev/null
++++ b/auparse/open-flagtabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char open_flag_strings[] = "O_APPEND\0O_ASYNC\0O_CLOEXEC\0O_CREAT\0O_DIRECT\0O_DIRECTORY\0O_DSYNC\0O_EXCL\0O_NOATIME\0O_NOCTTY\0"
++ "O_NOFOLLOW\0O_NONBLOCK\0O_PATH\0O_RDWR\0O_TRUNC\0O_WRONLY\0__O_SYNC";
++static const struct transtab open_flag_table[] = {
++ {1,134},{2,119},{64,27},{128,64},{256,81},{512,126},{1024,0},{2048,101},{4096,56},{8192,9},
++ {16384,35},{65536,44},{131072,90},{262144,71},{524288,17},{1048576,143},{2097152,112},
++};
++#define OPEN_FLAG_NUM_ENTRIES (sizeof(open_flag_table) / sizeof(*open_flag_table))
+diff --git a/auparse/persontabs.h b/auparse/persontabs.h
+new file mode 100644
+index 0000000..d099839
+--- /dev/null
++++ b/auparse/persontabs.h
+@@ -0,0 +1,17 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char person_strings[] = "PER_BSD\0PER_HPUX\0PER_IRIX32\0PER_IRIX64\0PER_IRIXN32\0PER_ISCR4\0PER_LINUX\0PER_LINUX32\0PER_LINUX32_3GB\0PER_LINUX_32BIT\0"
++ "PER_OSF4\0PER_OSR5\0PER_RISCOS\0PER_SCOSVR3\0PER_SOLARIS\0PER_SUNOS\0PER_SVR3\0PER_SVR4\0PER_UW7\0PER_WYSEV386\0"
++ "PER_XENIX";
++static const int person_i2s_i[] = {
++ 0,6,8,12,15,16,8388608,67108869,67108870,67108873,
++ 67108874,67108875,67108877,68157441,68157454,83886082,83886084,83886087,100663299,117440515,
++ 134217736,
++};
++static const unsigned person_i2s_s[] = {
++ 61,0,71,133,115,8,99,51,168,17,
++ 39,28,156,187,196,178,204,217,124,144,
++ 83,
++};
++static const char *person_i2s(int v) {
++ return i2s_bsearch__(person_strings, person_i2s_i, person_i2s_s, 21, v);
++}
+diff --git a/auparse/pktoptnametabs.h b/auparse/pktoptnametabs.h
+new file mode 100644
+index 0000000..4613372
+--- /dev/null
++++ b/auparse/pktoptnametabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char pktoptname_strings[] = "PACKET_ADD_MEMBERSHIP\0PACKET_AUXDATA\0PACKET_COPY_THRESH\0PACKET_DROP_MEMBERSHIP\0PACKET_FANOUT\0PACKET_HDRLEN\0PACKET_LOSS\0PACKET_ORIGDEV\0PACKET_RECV_OUTPUT\0PACKET_RESERVE\0"
++ "PACKET_RX_RING\0PACKET_STATISTICS\0PACKET_TIMESTAMP\0PACKET_TX_HAS_OFF\0PACKET_TX_RING\0PACKET_TX_TIMESTAMP\0PACKET_VERSION\0PACKET_VNET_HDR";
++static const unsigned pktoptname_i2s_direct[] = {
++ 0,56,134,-1u,168,183,37,22,119,271,
++ 93,153,236,107,286,251,201,79,218,
++};
++static const char *pktoptname_i2s(int v) {
++ return i2s_direct__(pktoptname_strings, pktoptname_i2s_direct, 1, 19, v);
++}
+diff --git a/auparse/prctl_opttabs.h b/auparse/prctl_opttabs.h
+new file mode 100644
+index 0000000..03707a8
+--- /dev/null
++++ b/auparse/prctl_opttabs.h
+@@ -0,0 +1,14 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char prctl_opt_strings[] = "PR_CAPBSET_DROP\0PR_CAPBSET_READ\0PR_GET_CHILD_SUBREAPER\0PR_GET_DUMPABLE\0PR_GET_ENDIAN\0PR_GET_FPEMU\0PR_GET_FPEXC\0PR_GET_KEEPCAPS\0PR_GET_NAME\0PR_GET_NO_NEW_PRIVS\0"
++ "PR_GET_PDEATHSIG\0PR_GET_SECCOMP\0PR_GET_SECUREBITS\0PR_GET_TID_ADDRESS\0PR_GET_TIMERSLACK\0PR_GET_TIMING\0PR_GET_TSC\0PR_GET_UNALIGN\0PR_MCE_KILL\0PR_MCE_KILL_GET\0"
++ "PR_SET_CHILD_SUBREAPER\0PR_SET_DUMPABLE\0PR_SET_ENDIAN\0PR_SET_FPEMU\0PR_SET_FPEXC\0PR_SET_KEEPCAPS\0PR_SET_MM\0PR_SET_NAME\0PR_SET_NO_NEW_PRIVS\0PR_SET_PDEATHSIG\0"
++ "PR_SET_SECCOMP\0PR_SET_SECUREBITS\0PR_SET_TIMERSLACK\0PR_SET_TIMING\0PR_SET_TSC\0PR_SET_UNALIGN\0PR_TASK_PERF_EVENTS_DISABLE\0PR_TASK_PERF_EVENTS_ENABLE";
++static const unsigned prctl_opt_i2s_direct[] = {
++ 451,159,55,337,271,544,111,393,85,367,
++ 98,380,246,519,419,127,-1u,-1u,71,353,
++ 176,468,16,0,260,533,191,483,501,228,
++ 559,587,286,298,409,314,32,431,139,209,
++};
++static const char *prctl_opt_i2s(int v) {
++ return i2s_direct__(prctl_opt_strings, prctl_opt_i2s_direct, 1, 40, v);
++}
+diff --git a/auparse/prottabs.h b/auparse/prottabs.h
+new file mode 100644
+index 0000000..1727f43
+--- /dev/null
++++ b/auparse/prottabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char prot_strings[] = "PROT_EXEC\0PROT_READ\0PROT_SEM\0PROT_WRITE";
++static const struct transtab prot_table[] = {
++ {1,10},{2,29},{4,0},{8,20},
++};
++#define PROT_NUM_ENTRIES (sizeof(prot_table) / sizeof(*prot_table))
+diff --git a/auparse/ptracetabs.h b/auparse/ptracetabs.h
+new file mode 100644
+index 0000000..6bbfc9b
+--- /dev/null
++++ b/auparse/ptracetabs.h
+@@ -0,0 +1,17 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ptrace_strings[] = "PTRACE_ATTACH\0PTRACE_CONT\0PTRACE_DETACH\0PTRACE_GETEVENTMSG\0PTRACE_GETFPREGS\0PTRACE_GETFPXREGS\0PTRACE_GETREGS\0PTRACE_GETREGSET\0PTRACE_GETSIGINFO\0PTRACE_INTERRUPT\0"
++ "PTRACE_KILL\0PTRACE_LISTEN\0PTRACE_PEEKDATA\0PTRACE_PEEKTEXT\0PTRACE_PEEKUSER\0PTRACE_POKEDATA\0PTRACE_POKETEXT\0PTRACE_POKEUSER\0PTRACE_SEIZE\0PTRACE_SETFPREGS\0"
++ "PTRACE_SETFPXREGS\0PTRACE_SETOPTIONS\0PTRACE_SETREGS\0PTRACE_SETREGSET\0PTRACE_SETSIGINFO\0PTRACE_SINGLESTEP\0PTRACE_SYSCALL\0PTRACE_TRACEME";
++static const int ptrace_i2s_i[] = {
++ 0,1,2,3,4,5,6,7,8,9,
++ 12,13,14,15,16,17,18,19,24,16896,
++ 16897,16898,16899,16900,16901,16902,16903,16904,
++};
++static const unsigned ptrace_i2s_s[] = {
++ 432,203,187,219,251,235,267,14,161,399,
++ 94,349,59,296,0,26,76,313,417,331,
++ 40,126,381,109,364,283,144,173,
++};
++static const char *ptrace_i2s(int v) {
++ return i2s_bsearch__(ptrace_strings, ptrace_i2s_i, ptrace_i2s_s, 28, v);
++}
+diff --git a/auparse/recvtabs.h b/auparse/recvtabs.h
+new file mode 100644
+index 0000000..9cab5a3
+--- /dev/null
++++ b/auparse/recvtabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char recv_strings[] = "MSG_CMSG_CLOEXEC\0MSG_CONFIRM\0MSG_CTRUNC\0MSG_DONTROUTE\0MSG_DONTWAIT\0MSG_EOR\0MSG_ERRQUEUE\0MSG_FASTOPEN\0MSG_FIN\0MSG_MORE\0"
++ "MSG_NOSIGNAL\0MSG_OOB\0MSG_PEEK\0MSG_PROXY\0MSG_RST\0MSG_SENDPAGE_NOTLAST\0MSG_SYN\0MSG_TRUNC\0MSG_WAITALL\0MSG_WAITFORONE";
++static const struct transtab recv_table[] = {
++ {1,131},{2,139},{4,40},{8,29},{16,148},{32,195},{64,54},{128,67},{256,205},{512,101},
++ {1024,187},{2048,17},{4096,158},{8192,75},{16384,118},{32768,109},{65536,217},{131072,166},{536870912,88},{1073741824,0},
++};
++#define RECV_NUM_ENTRIES (sizeof(recv_table) / sizeof(*recv_table))
+diff --git a/auparse/rlimittabs.h b/auparse/rlimittabs.h
+new file mode 100644
+index 0000000..364ad69
+--- /dev/null
++++ b/auparse/rlimittabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char rlimit_strings[] = "RLIMIT_AS\0RLIMIT_CORE\0RLIMIT_CPU\0RLIMIT_DATA\0RLIMIT_FSIZE\0RLIMIT_LOCKS\0RLIMIT_MEMLOCK\0RLIMIT_MSGQUEUE\0RLIMIT_NICE\0RLIMIT_NOFILE\0"
++ "RLIMIT_NPROC\0RLIMIT_RSS\0RLIMIT_RTPRIO\0RLIMIT_RTTIME\0RLIMIT_SIGPENDING\0RLIMIT_STACK";
++static const unsigned rlimit_i2s_direct[] = {
++ 22,45,33,198,10,141,128,114,71,0,
++ 58,180,86,102,152,166,
++};
++static const char *rlimit_i2s(int v) {
++ return i2s_direct__(rlimit_strings, rlimit_i2s_direct, 0, 15, v);
++}
+diff --git a/auparse/schedtabs.h b/auparse/schedtabs.h
+new file mode 100644
+index 0000000..875317f
+--- /dev/null
++++ b/auparse/schedtabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char sched_strings[] = "SCHED_BATCH\0SCHED_FIFO\0SCHED_IDLE\0SCHED_OTHER\0SCHED_RR";
++static const unsigned sched_i2s_direct[] = {
++ 34,12,46,0,-1u,23,
++};
++static const char *sched_i2s(int v) {
++ return i2s_direct__(sched_strings, sched_i2s_direct, 0, 5, v);
++}
+diff --git a/auparse/seccomptabs.h b/auparse/seccomptabs.h
+new file mode 100644
+index 0000000..5c6c911
+--- /dev/null
++++ b/auparse/seccomptabs.h
+@@ -0,0 +1,11 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char seccomp_strings[] = "allow\0errno\0kill\0trace\0trap";
++static const int seccomp_i2s_i[] = {
++ 0,196608,327680,2146435072,2147418112,
++};
++static const unsigned seccomp_i2s_s[] = {
++ 12,23,6,17,0,
++};
++static const char *seccomp_i2s(int v) {
++ return i2s_bsearch__(seccomp_strings, seccomp_i2s_i, seccomp_i2s_s, 5, v);
++}
+diff --git a/auparse/seektabs.h b/auparse/seektabs.h
+new file mode 100644
+index 0000000..0d0f542
+--- /dev/null
++++ b/auparse/seektabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char seek_strings[] = "SEEK_CUR\0SEEK_DATA\0SEEK_END\0SEEK_HOLE\0SEEK_SET";
++static const unsigned seek_i2s_direct[] = {
++ 38,0,19,9,28,
++};
++static const char *seek_i2s(int v) {
++ return i2s_direct__(seek_strings, seek_i2s_direct, 0, 4, v);
++}
+diff --git a/auparse/shm_modetabs.h b/auparse/shm_modetabs.h
+new file mode 100644
+index 0000000..ddd414d
+--- /dev/null
++++ b/auparse/shm_modetabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char shm_mode_strings[] = "SHM_DEST\0SHM_HUGETLB\0SHM_LOCKED\0SHM_NORESERVE";
++static const struct transtab shm_mode_table[] = {
++ {512,0},{1024,21},{2048,9},{4096,32},
++};
++#define SHM_MODE_NUM_ENTRIES (sizeof(shm_mode_table) / sizeof(*shm_mode_table))
+diff --git a/auparse/signaltabs.h b/auparse/signaltabs.h
+new file mode 100644
+index 0000000..91ce38e
+--- /dev/null
++++ b/auparse/signaltabs.h
+@@ -0,0 +1,14 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char signal_strings[] = "IGPWR\0SIG0\0SIGABRT\0SIGALRM\0SIGBUS\0SIGCHLD\0SIGCONT\0SIGFPE\0SIGHUP\0SIGILL\0"
++ "SIGINT\0SIGIO\0SIGKILL\0SIGPIPE\0SIGPROF\0SIGQUIT\0SIGSEGV\0SIGSTKFLT\0SIGSTOP\0SIGSYS\0"
++ "SIGTERM\0SIGTRAP\0SIGTSTP\0SIGTTIN\0SIGTTOU\0SIGURG\0SIGUSR1\0SIGUSR2\0SIGVTALRM\0SIGWINCH\0"
++ "SIGXCPU\0SIGXFSZ";
++static const unsigned signal_i2s_direct[] = {
++ 6,57,71,108,64,157,11,27,50,84,
++ 196,116,204,92,19,149,124,34,42,134,
++ 165,173,181,189,231,239,212,100,222,78,
++ 0,142,
++};
++static const char *signal_i2s(int v) {
++ return i2s_direct__(signal_strings, signal_i2s_direct, 0, 31, v);
++}
+diff --git a/auparse/sockleveltabs.h b/auparse/sockleveltabs.h
+new file mode 100644
+index 0000000..4473d8c
+--- /dev/null
++++ b/auparse/sockleveltabs.h
+@@ -0,0 +1,12 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char socklevel_strings[] = "SOL_AAL\0SOL_ALG\0SOL_ATALK\0SOL_ATM\0SOL_AX25\0SOL_BLUETOOTH\0SOL_CAIF\0SOL_DCCP\0SOL_DECNET\0SOL_IPX\0"
++ "SOL_IRDA\0SOL_IUCV\0SOL_LLC\0SOL_NETBEUI\0SOL_NETLINK\0SOL_NETROM\0SOL_PACKET\0SOL_PNPIPE\0SOL_PPPOL2TP\0SOL_RAW\0"
++ "SOL_RDS\0SOL_ROSE\0SOL_RXRPC\0SOL_TIPC";
++static const unsigned socklevel_i2s_direct[] = {
++ 190,86,34,16,144,206,75,-1u,155,26,
++ 0,94,120,112,66,132,225,215,177,43,
++ 166,198,103,57,8,
++};
++static const char *socklevel_i2s(int v) {
++ return i2s_direct__(socklevel_strings, socklevel_i2s_direct, 255, 279, v);
++}
+diff --git a/auparse/sockoptnametabs.h b/auparse/sockoptnametabs.h
+new file mode 100644
+index 0000000..831a030
+--- /dev/null
++++ b/auparse/sockoptnametabs.h
+@@ -0,0 +1,23 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char sockoptname_strings[] = "SO_ACCEPTCONN\0SO_ATTACH_FILTER\0SO_BINDTODEVICE\0SO_BROADCAST\0SO_BSDCOMPAT\0SO_DEBUG\0SO_DETACH_FILTER\0SO_DOMAIN\0SO_DONTROUTE\0SO_ERROR\0"
++ "SO_KEEPALIVE\0SO_LINGER\0SO_LOCK_FILTER\0SO_MARK\0SO_NOFCS\0SO_NO_CHECK\0SO_OOBINLINE\0SO_PASSCRED\0SO_PASSCRED\0SO_PASSSEC\0"
++ "SO_PEEK_OFF\0SO_PEERCRED\0SO_PEERCRED\0SO_PEERNAME\0SO_PEERSEC\0SO_PRIORITY\0SO_PROTOCOL\0SO_RCVBUF\0SO_RCVBUFFORCE\0SO_RCVLOWAT\0"
++ "SO_RCVLOWAT\0SO_RCVTIMEO\0SO_RCVTIMEO\0SO_REUSEADDR\0SO_REUSEPORT\0SO_RXQ_OVFL\0SO_SECURITY_AUTHENTICATION\0SO_SECURITY_ENCRYPTION_NETWORK\0SO_SECURITY_ENCRYPTION_TRANSPORT\0SO_SNDBUF\0"
++ "SO_SNDBUFFORCE\0SO_SNDLOWAT\0SO_SNDLOWAT\0SO_SNDTIMEO\0SO_SNDTIMEO\0SO_TIMESTAMP\0SO_TIMESTAMPING\0SO_TIMESTAMPNS\0SO_TYPE\0SO_WIFI_STATUS";
++static const int sockoptname_i2s_i[] = {
++ 1,2,3,4,5,6,7,8,9,10,
++ 11,12,13,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,
++ 41,42,43,44,116,117,118,119,120,121,
++};
++static const unsigned sockoptname_i2s_s[] = {
++ 73,402,648,122,109,47,531,329,131,198,
++ 186,305,144,60,415,211,258,354,556,378,
++ 580,440,498,467,31,14,82,282,604,0,
++ 294,541,339,235,633,169,617,317,99,428,
++ 656,246,177,154,366,568,390,592,223,270,
++};
++static const char *sockoptname_i2s(int v) {
++ return i2s_bsearch__(sockoptname_strings, sockoptname_i2s_i, sockoptname_i2s_s, 50, v);
++}
+diff --git a/auparse/socktabs.h b/auparse/socktabs.h
+new file mode 100644
+index 0000000..66a8235
+--- /dev/null
++++ b/auparse/socktabs.h
+@@ -0,0 +1,10 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char sock_strings[] = "accept\0accept4\0bind\0connect\0getpeername\0getsockname\0getsockopt\0listen\0recv\0recvfrom\0"
++ "recvmmsg\0recvmsg\0send\0sendmmsg\0sendmsg\0sendto\0setsockopt\0shutdown\0socket\0socketpair";
++static const unsigned sock_i2s_direct[] = {
++ 150,15,20,63,0,40,28,157,101,70,
++ 123,75,141,130,52,115,93,7,84,106,
++};
++static const char *sock_i2s(int v) {
++ return i2s_direct__(sock_strings, sock_i2s_direct, 1, 20, v);
++}
+diff --git a/auparse/socktypetabs.h b/auparse/socktypetabs.h
+new file mode 100644
+index 0000000..05e8d36
+--- /dev/null
++++ b/auparse/socktypetabs.h
+@@ -0,0 +1,8 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char sock_type_strings[] = "SOCK_DCCP\0SOCK_DGRAM\0SOCK_PACKET\0SOCK_RAW\0SOCK_RDM\0SOCK_SEQPACKET\0SOCK_STREAM";
++static const unsigned sock_type_i2s_direct[] = {
++ 66,10,33,42,51,0,-1u,-1u,-1u,21,
++};
++static const char *sock_type_i2s(int v) {
++ return i2s_direct__(sock_type_strings, sock_type_i2s_direct, 1, 10, v);
++}
+diff --git a/auparse/tcpoptnametabs.h b/auparse/tcpoptnametabs.h
+new file mode 100644
+index 0000000..061db3f
+--- /dev/null
++++ b/auparse/tcpoptnametabs.h
+@@ -0,0 +1,12 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char tcpoptname_strings[] = "TCP_CONGESTION\0TCP_COOKIE_TRANSACTIONS\0TCP_CORK\0TCP_DEFER_ACCEPT\0TCP_FASTOPEN\0TCP_INFO\0TCP_KEEPCNT\0TCP_KEEPIDLE\0TCP_KEEPINTVL\0TCP_LINGER2\0"
++ "TCP_MAXSEG\0TCP_MD5SIG\0TCP_NODELAY\0TCP_QUEUE_SEQ\0TCP_QUICKACK\0TCP_REPAIR\0TCP_REPAIR_OPTIONS\0TCP_REPAIR_QUEUE\0TCP_SYNCNT\0TCP_THIN_DUPACK\0"
++ "TCP_THIN_LINEAR_TIMEOUTS\0TCP_TIMESTAMP\0TCP_USER_TIMEOUT\0TCP_WINDOW_CLAMP";
++static const unsigned tcpoptname_i2s_direct[] = {
++ 160,138,39,99,112,87,246,126,48,329,
++ 78,186,0,149,15,273,257,312,199,229,
++ 172,210,65,298,
++};
++static const char *tcpoptname_i2s(int v) {
++ return i2s_direct__(tcpoptname_strings, tcpoptname_i2s_direct, 1, 24, v);
++}
+diff --git a/auparse/typetabs.h b/auparse/typetabs.h
+new file mode 100644
+index 0000000..a99d398
+--- /dev/null
++++ b/auparse/typetabs.h
+@@ -0,0 +1,35 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char type_strings[] = "a0\0a1\0a2\0a3\0acct\0addr\0arch\0auid\0cap_fi\0cap_fp\0"
++ "cap_pe\0cap_pi\0cap_pp\0capability\0cgroup\0cmd\0code\0comm\0cwd\0data\0"
++ "device\0dir\0egid\0euid\0exe\0exit\0family\0fe\0fi\0file\0"
++ "flags\0fp\0fsgid\0fsuid\0gid\0icmptype\0id\0igid\0inode_gid\0inode_uid\0"
++ "iuid\0key\0list\0mode\0name\0new-disk\0new-fs\0new-rng\0new_gid\0new_pe\0"
++ "new_pi\0new_pp\0oauid\0obj_gid\0obj_uid\0ocomm\0oflag\0ogid\0old-disk\0old-fs\0"
++ "old-rng\0old_pe\0old_pi\0old_pp\0old_prom\0ouid\0path\0per\0perm\0perm_mask\0"
++ "prom\0proto\0res\0result\0saddr\0sauid\0ses\0sgid\0sig\0sigev_signo\0"
++ "suid\0syscall\0uid\0vm\0watch";
++static const unsigned type_s2i_s[] = {
++ 0,3,6,9,12,17,22,27,32,39,
++ 46,53,60,67,78,85,89,94,99,103,
++ 108,115,119,124,129,133,138,145,148,151,
++ 156,162,165,171,177,181,190,193,198,208,
++ 218,223,227,232,237,242,251,258,266,274,
++ 281,288,295,301,309,317,323,329,334,343,
++ 350,358,365,372,379,388,393,398,402,407,
++ 417,422,428,432,439,445,451,455,460,464,
++ 476,481,489,493,496,
++};
++static const int type_s2i_i[] = {
++ 14,15,16,17,6,26,4,1,22,22,
++ 22,22,22,12,6,6,28,6,6,20,
++ 6,6,2,1,6,5,23,22,22,6,
++ 30,22,2,1,2,24,1,2,2,1,
++ 1,6,19,8,6,6,6,6,2,22,
++ 22,22,1,2,1,6,29,2,6,6,
++ 6,22,22,22,11,1,6,27,7,7,
++ 11,25,13,13,9,1,21,2,18,18,
++ 1,3,1,6,6,
++};
++static int type_s2i(const char *s, int *value) {
++ return s2i__(type_strings, type_s2i_s, type_s2i_i, 85, s, value);
++}
+diff --git a/auparse/umounttabs.h b/auparse/umounttabs.h
+new file mode 100644
+index 0000000..e98118f
+--- /dev/null
++++ b/auparse/umounttabs.h
+@@ -0,0 +1,6 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char umount_strings[] = "MNT_DETACH\0MNT_EXPIRE\0MNT_FORCE\0UMOUNT_NOFOLLOW\0UMOUNT_UNUSED";
++static const struct transtab umount_table[] = {
++ {1,22},{2,0},{4,11},{8,32},{-2147483647,48},
++};
++#define UMOUNT_NUM_ENTRIES (sizeof(umount_table) / sizeof(*umount_table))
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index 5e9f966..5a7d12b 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -50,109 +50,3 @@ endif
+ if USE_AARCH64
+ BUILT_SOURCES += aarch64_tables.h
+ endif
+-noinst_PROGRAMS = gen_actiontabs_h gen_errtabs_h gen_fieldtabs_h \
+- gen_flagtabs_h gen_ftypetabs_h gen_i386_tables_h \
+- gen_ia64_tables_h gen_machinetabs_h gen_msg_typetabs_h \
+- gen_optabs_h gen_ppc_tables_h gen_s390_tables_h \
+- gen_s390x_tables_h gen_x86_64_tables_h
+-if USE_ALPHA
+-noinst_PROGRAMS += gen_alpha_tables_h
+-endif
+-if USE_ARMEB
+-noinst_PROGRAMS += gen_armeb_tables_h
+-endif
+-if USE_AARCH64
+-noinst_PROGRAMS += gen_aarch64_tables_h
+-endif
+-gen_actiontabs_h_SOURCES = gen_tables.c gen_tables.h actiontab.h
+-gen_actiontabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="actiontab.h"'
+-actiontabs.h: gen_actiontabs_h Makefile
+- ./gen_actiontabs_h --lowercase --i2s --s2i action > $@
+-
+-if USE_ALPHA
+-gen_alpha_tables_h_SOURCES = gen_tables.c gen_tables.h alpha_table.h
+-gen_alpha_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="alpha_table.h"'
+-alpha_tables.h: gen_alpha_tables_h Makefile
+- ./gen_alpha_tables_h --lowercase --i2s --s2i alpha_syscall > $@
+-endif
+-
+-if USE_ARMEB
+-gen_armeb_tables_h_SOURCES = gen_tables.c gen_tables.h armeb_table.h
+-gen_armeb_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="armeb_table.h"'
+-armeb_tables.h: gen_armeb_tables_h Makefile
+- ./gen_armeb_tables_h --lowercase --i2s --s2i armeb_syscall > $@
+-endif
+-
+-if USE_AARCH64
+-gen_aarch64_tables_h_SOURCES = gen_tables.c gen_tables.h aarch64_table.h
+-gen_aarch64_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="aarch64_table.h"'
+-aarch64_tables.h: gen_aarch64_tables_h Makefile
+- ./gen_aarch64_tables_h --lowercase --i2s --s2i aarch64_syscall > $@
+-endif
+-
+-gen_errtabs_h_SOURCES = gen_tables.c gen_tables.h errtab.h
+-gen_errtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="errtab.h"'
+-errtabs.h: gen_errtabs_h Makefile
+- ./gen_errtabs_h --duplicate-ints --uppercase --i2s --s2i err > $@
+-
+-gen_fieldtabs_h_SOURCES = gen_tables.c gen_tables.h fieldtab.h
+-gen_fieldtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="fieldtab.h"'
+-fieldtabs.h: gen_fieldtabs_h Makefile
+- ./gen_fieldtabs_h --duplicate-ints --lowercase --i2s --s2i field > $@
+-
+-gen_flagtabs_h_SOURCES = gen_tables.c gen_tables.h flagtab.h
+-gen_flagtabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="flagtab.h"'
+-flagtabs.h: gen_flagtabs_h Makefile
+- ./gen_flagtabs_h --lowercase --i2s --s2i flag > $@
+-
+-gen_ftypetabs_h_SOURCES = gen_tables.c gen_tables.h ftypetab.h
+-gen_ftypetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ftypetab.h"'
+-ftypetabs.h: gen_ftypetabs_h Makefile
+- ./gen_ftypetabs_h --lowercase --i2s --s2i ftype > $@
+-
+-gen_i386_tables_h_SOURCES = gen_tables.c gen_tables.h i386_table.h
+-gen_i386_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="i386_table.h"'
+-i386_tables.h: gen_i386_tables_h Makefile
+- ./gen_i386_tables_h --duplicate-ints --lowercase --i2s --s2i \
+- i386_syscall > $@
+-
+-gen_ia64_tables_h_SOURCES = gen_tables.c gen_tables.h ia64_table.h
+-gen_ia64_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ia64_table.h"'
+-ia64_tables.h: gen_ia64_tables_h Makefile
+- ./gen_ia64_tables_h --lowercase --i2s --s2i ia64_syscall > $@
+-
+-gen_machinetabs_h_SOURCES = gen_tables.c gen_tables.h machinetab.h
+-gen_machinetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="machinetab.h"'
+-machinetabs.h: gen_machinetabs_h Makefile
+- ./gen_machinetabs_h --duplicate-ints --lowercase --i2s --s2i machine \
+- > $@
+-
+-gen_msg_typetabs_h_SOURCES = gen_tables.c gen_tables.h msg_typetab.h
+-gen_msg_typetabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="msg_typetab.h"'
+-msg_typetabs.h: gen_msg_typetabs_h Makefile
+- ./gen_msg_typetabs_h --uppercase --i2s --s2i msg_type > $@
+-
+-gen_optabs_h_SOURCES = gen_tables.c gen_tables.h optab.h
+-gen_optabs_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="optab.h"'
+-optabs.h: gen_optabs_h Makefile
+- ./gen_optabs_h --i2s op > $@
+-
+-gen_ppc_tables_h_SOURCES = gen_tables.c gen_tables.h ppc_table.h
+-gen_ppc_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="ppc_table.h"'
+-ppc_tables.h: gen_ppc_tables_h Makefile
+- ./gen_ppc_tables_h --lowercase --i2s --s2i ppc_syscall > $@
+-
+-gen_s390_tables_h_SOURCES = gen_tables.c gen_tables.h s390_table.h
+-gen_s390_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="s390_table.h"'
+-s390_tables.h: gen_s390_tables_h Makefile
+- ./gen_s390_tables_h --lowercase --i2s --s2i s390_syscall > $@
+-
+-gen_s390x_tables_h_SOURCES = gen_tables.c gen_tables.h s390x_table.h
+-gen_s390x_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="s390x_table.h"'
+-s390x_tables.h: gen_s390x_tables_h Makefile
+- ./gen_s390x_tables_h --lowercase --i2s --s2i s390x_syscall > $@
+-
+-gen_x86_64_tables_h_SOURCES = gen_tables.c gen_tables.h x86_64_table.h
+-gen_x86_64_tables_h_CFLAGS = $(AM_CFLAGS) '-DTABLE_H="x86_64_table.h"'
+-x86_64_tables.h: gen_x86_64_tables_h Makefile
+- ./gen_x86_64_tables_h --lowercase --i2s --s2i x86_64_syscall > $@
+diff --git a/lib/aarch64_tables.h b/lib/aarch64_tables.h
+new file mode 100644
+index 0000000..571d6ee
+--- /dev/null
++++ b/lib/aarch64_tables.h
+@@ -0,0 +1,125 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char aarch64_syscall_strings[] = "accept\0accept4\0acct\0add_key\0adjtimex\0bind\0brk\0capget\0capset\0chdir\0"
++ "chroot\0clock_adjtime\0clock_getres\0clock_gettime\0clock_nanosleep\0clock_settime\0clone\0close\0connect\0delete_module\0"
++ "dup\0dup3\0epoll_create1\0epoll_ctl\0epoll_pwait\0eventfd2\0execve\0exit\0exit_group\0faccessat\0"
++ "fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0fchownat\0fdatasync\0fgetxattr\0"
++ "finit_module\0flistxattr\0flock\0fremovexattr\0fsetxattr\0fsync\0futex\0get_mempolicy\0get_robust_list\0getcpu\0"
++ "getcwd\0getdents64\0getegid\0geteuid\0getgid\0getgroups\0getitimer\0getpeername\0getpgid\0getpid\0"
++ "getppid\0getpriority\0getresgid\0getresuid\0getrlimit\0getrusage\0getsid\0getsockname\0getsockopt\0gettid\0"
++ "gettimeofday\0getuid\0getxattr\0init_module\0inotify_add_watch\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0"
++ "io_setup\0io_submit\0ioctl\0ioprio_get\0ioprio_set\0kcmp\0kexec_load\0keyctl\0kill\0lgetxattr\0"
++ "linkat\0listen\0listxattr\0llistxattr\0lookup_dcookie\0lremovexattr\0lsetxattr\0madvise\0mbind\0migrate_pages\0"
++ "mincore\0mkdirat\0mknodat\0mlock\0mlockall\0mount\0move_pages\0mprotect\0mq_getsetattr\0mq_notify\0"
++ "mq_open\0mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msgctl\0msgget\0msgrcv\0msgsnd\0msync\0"
++ "munlock\0munlockall\0munmap\0name_to_handle_at\0nanosleep\0nfsservctl\0open_by_handle_at\0openat\0perf_event_open\0personality\0"
++ "pipe2\0pivot_root\0ppoll\0prctl\0pread64\0preadv\0prlimit64\0process_vm_readv\0process_vm_writev\0pselect6\0"
++ "ptrace\0pwrite64\0pwritev\0quotactl\0read\0readahead\0readlinkat\0readv\0reboot\0recvfrom\0"
++ "recvmmsg\0recvmsg\0remap_file_pages\0removexattr\0renameat\0request_key\0restart_syscall\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0"
++ "rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0"
++ "sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0sched_yield\0semctl\0semget\0semop\0semtimedop\0sendmmsg\0"
++ "sendmsg\0sendto\0set_mempolicy\0set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsuid\0setgid\0setgroups\0"
++ "sethostname\0setitimer\0setns\0setpgid\0setpriority\0setregid\0setresgid\0setresuid\0setreuid\0setrlimit\0"
++ "setsid\0setsockopt\0settimeofday\0setuid\0setxattr\0shmat\0shmctl\0shmdt\0shmget\0shutdown\0"
++ "sigaltstack\0signalfd4\0socket\0socketpair\0splice\0swapoff\0swapon\0symlinkat\0sync\0sync_file_range\0"
++ "syncfs\0sysinfo\0syslog\0tee\0tgkill\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0"
++ "timerfd_create\0timerfd_gettime\0timerfd_settime\0times\0tkill\0umask\0umount2\0uname\0unlinkat\0unshare\0"
++ "utimensat\0vhangup\0vmsplice\0wait4\0waitid\0write\0writev";
++static const unsigned aarch64_syscall_s2i_s[] = {
++ 0,7,15,20,28,37,42,46,53,60,
++ 66,73,87,100,114,130,144,150,156,164,
++ 178,182,187,201,211,223,232,239,244,255,
++ 265,275,289,303,310,317,326,333,342,352,
++ 362,375,386,392,405,415,421,427,441,457,
++ 464,471,482,490,498,505,515,525,537,545,
++ 552,560,572,582,592,602,612,619,631,642,
++ 649,662,669,678,690,708,722,739,749,760,
++ 773,782,792,798,809,820,825,836,843,848,
++ 858,865,872,882,893,908,921,931,939,945,
++ 959,967,975,983,989,998,1004,1015,1024,1038,
++ 1048,1056,1072,1085,1095,1102,1109,1116,1123,1130,
++ 1136,1144,1155,1162,1180,1190,1201,1219,1226,1242,
++ 1254,1260,1271,1277,1283,1291,1298,1308,1325,1343,
++ 1352,1359,1368,1376,1385,1390,1400,1411,1417,1424,
++ 1433,1442,1450,1467,1479,1488,1500,1516,1529,1543,
++ 1558,1574,1587,1601,1617,1635,1658,1681,1699,1714,
++ 1733,1755,1773,1788,1807,1819,1826,1833,1839,1850,
++ 1859,1867,1874,1888,1904,1920,1934,1943,1952,1959,
++ 1969,1981,1991,1997,2005,2017,2026,2036,2046,2055,
++ 2065,2072,2083,2096,2103,2112,2118,2125,2131,2138,
++ 2147,2159,2169,2176,2187,2194,2202,2209,2219,2224,
++ 2240,2247,2255,2262,2266,2273,2286,2299,2316,2330,
++ 2344,2359,2375,2391,2397,2403,2409,2417,2423,2432,
++ 2440,2450,2458,2467,2473,2480,2486,
++};
++static const int aarch64_syscall_s2i_i[] = {
++ 202,242,89,217,171,200,214,90,91,49,
++ 51,266,114,113,115,112,220,57,203,106,
++ 23,24,20,21,22,19,221,93,94,48,
++ 47,262,263,50,52,53,55,54,83,10,
++ 273,13,32,16,7,82,98,236,100,168,
++ 17,61,177,175,176,158,102,205,155,172,
++ 173,141,150,148,163,165,156,204,209,178,
++ 169,174,8,105,27,26,28,3,1,4,
++ 0,2,29,31,30,272,104,219,129,9,
++ 37,201,11,12,18,15,6,233,235,238,
++ 232,34,33,228,230,40,239,226,185,184,
++ 180,183,182,181,216,187,186,188,189,227,
++ 229,231,215,264,101,42,265,56,241,92,
++ 59,41,73,167,67,69,261,270,271,72,
++ 117,68,70,60,63,213,78,65,142,207,
++ 243,212,234,14,38,218,128,134,136,135,
++ 138,139,133,137,240,125,126,123,121,120,
++ 127,122,118,119,124,191,190,193,192,269,
++ 211,206,237,99,96,162,152,151,144,159,
++ 161,103,268,154,140,143,149,147,145,164,
++ 157,208,170,146,5,196,195,197,194,210,
++ 132,74,198,199,76,225,224,36,81,84,
++ 267,179,116,77,131,107,111,109,108,110,
++ 85,87,86,153,130,166,39,160,35,97,
++ 88,58,75,260,95,64,66,
++};
++static int aarch64_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(aarch64_syscall_strings, aarch64_syscall_s2i_s, aarch64_syscall_s2i_i, 247, copy, value);
++ }
++}
++static const unsigned aarch64_syscall_i2s_direct[] = {
++ 773,749,782,739,760,2103,921,405,669,848,
++ 352,872,882,375,1467,908,392,464,893,223,
++ 187,201,211,178,182,-1u,708,690,722,792,
++ 809,798,386,975,967,2423,2209,858,1479,2409,
++ 998,1260,1190,-1u,-1u,-1u,-1u,265,255,60,
++ 303,66,310,317,333,326,1219,150,2450,1254,
++ 1376,471,-1u,1385,2480,1411,2486,1283,1359,1291,
++ 1368,-1u,1343,1271,2159,2458,2187,2262,1400,-1u,
++ -1u,2219,415,342,2224,2344,2375,2359,2440,15,
++ 46,53,1242,239,244,2473,1904,2432,421,1888,
++ 441,1180,515,1981,825,678,164,2273,2316,2299,
++ 2330,2286,130,100,87,114,2255,1352,1773,1788,
++ 1714,1699,1755,1681,1807,1635,1658,1733,1500,843,
++ 2397,2266,2147,1587,1516,1543,1529,1601,1558,1574,
++ 2005,560,1417,2017,1952,2046,2096,2036,582,2026,
++ 572,1943,1934,2391,1997,537,612,2065,505,1959,
++ 2417,1969,1920,592,2055,602,2403,1277,457,649,
++ 2083,28,545,552,662,490,498,482,642,2247,
++ 1048,1085,1072,1056,1038,1024,1109,1102,1116,1123,
++ 1826,1819,1839,1833,2131,2118,2112,2125,2169,2176,
++ 37,865,0,156,619,525,1867,1424,2072,631,
++ 2138,1859,1442,1390,42,1155,1095,20,1488,836,
++ 144,232,-1u,-1u,2202,2194,1015,1130,983,1136,
++ 989,1144,959,931,1450,939,427,1874,945,1004,
++ 1617,1226,7,1433,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ 2467,1298,275,289,1162,1201,73,2240,1991,1850,
++ 1308,1325,820,362,
++};
++static const char *aarch64_syscall_i2s(int v) {
++ return i2s_direct__(aarch64_syscall_strings, aarch64_syscall_i2s_direct, 0, 273, v);
++}
+diff --git a/lib/actiontabs.h b/lib/actiontabs.h
+new file mode 100644
+index 0000000..a7a9e62
+--- /dev/null
++++ b/lib/actiontabs.h
+@@ -0,0 +1,26 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char action_strings[] = "always\0never\0possible";
++static const unsigned action_s2i_s[] = {
++ 0,7,13,
++};
++static const int action_s2i_i[] = {
++ 2,0,1,
++};
++static int action_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(action_strings, action_s2i_s, action_s2i_i, 3, copy, value);
++ }
++}
++static const unsigned action_i2s_direct[] = {
++ 7,13,0,
++};
++static const char *action_i2s(int v) {
++ return i2s_direct__(action_strings, action_i2s_direct, 0, 2, v);
++}
+diff --git a/lib/alpha_tables.h b/lib/alpha_tables.h
+new file mode 100644
+index 0000000..b57e54c
+--- /dev/null
++++ b/lib/alpha_tables.h
+@@ -0,0 +1,196 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char alpha_syscall_strings[] = "_sysctl\0accept\0accept4\0access\0acct\0add_key\0adjtimex\0afs_syscall\0bdflush\0bind\0"
++ "brk\0capget\0capset\0chdir\0chmod\0chown\0chroot\0clock_adjtime\0clone\0close\0"
++ "connect\0create_module\0delete_module\0dipc\0dup\0dup2\0dup3\0epoll_create\0epoll_create1\0epoll_ctl\0"
++ "epoll_pwait\0epoll_wait\0eventfd\0eventfd2\0exec_with_loader\0execve\0exit\0exit_group\0faccessat\0fadvise64\0"
++ "fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0fchownat\0fcntl\0fdatasync\0"
++ "fgetxattr\0flistxattr\0flock\0fork\0fremovexattr\0fsetxattr\0fstat\0fstat64\0fstatat64\0fstatfs\0"
++ "fsync\0ftruncate\0futex\0futimesat\0get_kernel_syms\0get_mempolicy\0get_robust_list\0getcpu\0getcwd\0getdents\0"
++ "getdents64\0getdtablesize\0getgroups\0gethostname\0getitimer\0getpagesize\0getpeername\0getpgid\0getpgrp\0getpriority\0"
++ "getresgid\0getresuid\0getrlimit\0getrusage\0getsid\0getsockname\0getsockopt\0gettid\0gettimeofday\0getxattr\0"
++ "getxgid\0getxpid\0getxuid\0init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0"
++ "io_getevents\0io_setup\0io_submit\0ioctl\0ioprio_get\0ioprio_set\0kexec_load\0keyctl\0kill\0lchown\0"
++ "lgetxattr\0link\0linkat\0listen\0listxattr\0llistxattr\0lookup_dcookie\0lremovexattr\0lseek\0lsetxattr\0"
++ "lstat\0lstat64\0madvise\0mbind\0migrate_pages\0mincore\0mkdir\0mkdirat\0mknod\0mknodat\0"
++ "mlock\0mlockall\0mmap\0mount\0move_pages\0mprotect\0mq_getsetattr\0mq_notify\0mq_open\0mq_timedreceive\0"
++ "mq_timedsend\0mq_unlink\0mremap\0msgctl\0msgget\0msgrcv\0msgsnd\0msync\0munlock\0munlockall\0"
++ "munmap\0name_to_handle_at\0nanosleep\0nfsservctl\0old_adjtimex\0oldumount\0open\0open_by_handle_at\0openat\0osf_adjtime\0"
++ "osf_afs_syscall\0osf_alt_plock\0osf_alt_setsid\0osf_alt_sigpending\0osf_asynch_daemon\0osf_audcntl\0osf_audgen\0osf_chflags\0osf_execve\0osf_exportfs\0"
++ "osf_fchflags\0osf_fdatasync\0osf_fpathconf\0osf_fstatfs\0osf_fuser\0osf_getaddressconf\0osf_getdirentries\0osf_getdomainname\0osf_getfh\0osf_getfsstat\0"
++ "osf_gethostid\0osf_getitimer\0osf_getlogin\0osf_getmnt\0osf_getrusage\0osf_getsysinfo\0osf_gettimeofday\0osf_kloadcall\0osf_kmodcall\0osf_memcntl\0"
++ "osf_mincore\0osf_mount\0osf_mremap\0osf_msfs_syscall\0osf_msleep\0osf_mvalid\0osf_mwakeup\0osf_naccept\0osf_nfssvc\0osf_ngetpeername\0"
++ "osf_ngetsockname\0osf_nrecvfrom\0osf_nrecvmsg\0osf_nsendmsg\0osf_ntp_adjtime\0osf_ntp_gettime\0osf_old_creat\0osf_old_fstat\0osf_old_getpgrp\0osf_old_killpg\0"
++ "osf_old_lstat\0osf_old_open\0osf_old_sigaction\0osf_old_sigblock\0osf_old_sigreturn\0osf_old_sigsetmask\0osf_old_sigvec\0osf_old_stat\0osf_old_vadvise\0osf_old_vtrace\0"
++ "osf_old_wait\0osf_oldquota\0osf_pathconf\0osf_pid_block\0osf_pid_unblock\0osf_plock\0osf_priocntlset\0osf_profil\0osf_proplist_syscall\0osf_reboot\0"
++ "osf_revoke\0osf_sbrk\0osf_security\0osf_select\0osf_set_program_attributes\0osf_set_speculative\0osf_sethostid\0osf_setitimer\0osf_setlogin\0osf_setsysinfo\0"
++ "osf_settimeofday\0osf_shmat\0osf_signal\0osf_sigprocmask\0osf_sigsendset\0osf_sigstack\0osf_sigwaitprim\0osf_sstk\0osf_statfs\0osf_subsys_info\0"
++ "osf_swapctl\0osf_swapon\0osf_syscall\0osf_sysinfo\0osf_table\0osf_uadmin\0osf_usleep_thread\0osf_uswitch\0osf_utc_adjtime\0osf_utc_gettime\0"
++ "osf_utimes\0osf_utsname\0osf_wait4\0osf_waitid\0pciconfig_iobase\0pciconfig_read\0pciconfig_write\0perf_event_open\0personality\0pipe\0"
++ "pipe2\0pivot_root\0poll\0ppoll\0prctl\0pread\0preadv\0prlimit64\0process_vm_readv\0process_vm_writev\0"
++ "pselect6\0ptrace\0pwrite\0pwritev\0query_module\0quotactl\0read\0readahead\0readlink\0readlinkat\0"
++ "readv\0reboot\0recv\0recvfrom\0recvmmsg\0recvmsg\0remap_file_pages\0removexattr\0rename\0renameat\0"
++ "request_key\0restart_syscall\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0"
++ "rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0"
++ "sched_yield\0select\0semctl\0semget\0semop\0send\0sendfile\0sendmmsg\0sendmsg\0sendto\0"
++ "set_mempolicy\0set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsuid\0setgid\0setgroups\0sethae\0sethostname\0"
++ "setitimer\0setns\0setpgid\0setpgrp\0setpriority\0setregid\0setresgid\0setresuid\0setreuid\0setrlimit\0"
++ "setsid\0setsockopt\0settimeofday\0setuid\0setxattr\0shmctl\0shmdt\0shmget\0shutdown\0sigaction\0"
++ "sigaltstack\0signalfd\0signalfd4\0sigpending\0sigreturn\0sigsuspend\0socket\0socketpair\0splice\0stat\0"
++ "stat64\0statfs\0swapoff\0swapon\0symlink\0symlinkat\0sync\0sync_file_range\0syncfs\0sysfs\0"
++ "sysinfo\0syslog\0tee\0tgkill\0timerfd\0timerfd_create\0timerfd_gettime\0timerfd_settime\0times\0tkill\0"
++ "truncate\0tuxcall\0umask\0umount\0uname\0unlink\0unlinkat\0unshare\0uselib\0ustat\0"
++ "utimensat\0utimes\0vfork\0vhangup\0vmsplice\0vserver\0wait4\0waitid\0write\0writev";
++static const unsigned alpha_syscall_s2i_s[] = {
++ 0,8,15,23,30,35,43,52,64,72,
++ 77,81,88,95,101,107,113,120,134,140,
++ 146,154,168,182,187,191,196,201,214,228,
++ 238,250,261,269,278,295,302,307,318,328,
++ 338,348,362,376,383,390,399,406,415,421,
++ 431,441,452,458,463,476,486,492,500,510,
++ 518,524,534,540,550,566,580,596,603,610,
++ 619,630,644,654,666,676,688,700,708,716,
++ 728,738,748,758,768,775,787,798,805,818,
++ 827,835,843,851,863,881,894,908,925,935,
++ 946,959,968,978,984,995,1006,1017,1024,1029,
++ 1036,1046,1051,1058,1065,1075,1086,1101,1114,1120,
++ 1130,1136,1144,1152,1158,1172,1180,1186,1194,1200,
++ 1208,1214,1223,1228,1234,1245,1254,1268,1278,1286,
++ 1302,1315,1325,1332,1339,1346,1353,1360,1366,1374,
++ 1385,1392,1410,1420,1431,1444,1454,1459,1477,1484,
++ 1496,1512,1526,1541,1560,1578,1590,1601,1613,1624,
++ 1637,1650,1664,1678,1690,1700,1719,1737,1755,1765,
++ 1779,1793,1807,1820,1831,1845,1860,1877,1891,1904,
++ 1916,1928,1938,1949,1966,1977,1988,2000,2012,2023,
++ 2040,2057,2071,2084,2097,2113,2129,2143,2157,2173,
++ 2188,2202,2215,2233,2250,2268,2287,2302,2315,2331,
++ 2346,2359,2372,2385,2399,2415,2425,2441,2452,2473,
++ 2484,2495,2504,2517,2528,2555,2575,2589,2603,2616,
++ 2631,2648,2658,2669,2685,2700,2713,2729,2738,2749,
++ 2765,2777,2788,2800,2812,2822,2833,2851,2863,2879,
++ 2895,2906,2918,2928,2939,2956,2971,2987,3003,3015,
++ 3020,3026,3037,3042,3048,3054,3060,3067,3077,3094,
++ 3112,3121,3128,3135,3143,3156,3165,3170,3180,3189,
++ 3200,3206,3213,3218,3227,3236,3244,3261,3273,3280,
++ 3289,3301,3317,3323,3336,3350,3365,3381,3394,3408,
++ 3424,3442,3465,3488,3506,3521,3540,3562,3580,3595,
++ 3614,3626,3633,3640,3647,3653,3658,3667,3676,3684,
++ 3691,3705,3721,3737,3751,3760,3769,3776,3786,3793,
++ 3805,3815,3821,3829,3837,3849,3858,3868,3878,3887,
++ 3897,3904,3915,3928,3935,3944,3951,3957,3964,3973,
++ 3983,3995,4004,4014,4025,4035,4046,4053,4064,4071,
++ 4076,4083,4090,4098,4105,4113,4123,4128,4144,4151,
++ 4157,4165,4172,4176,4183,4191,4206,4222,4238,4244,
++ 4250,4259,4267,4273,4280,4286,4293,4302,4310,4317,
++ 4323,4333,4340,4346,4354,4363,4371,4377,4384,4390,
++};
++static const int alpha_syscall_s2i_i[] = {
++ 319,99,502,33,51,439,366,338,300,104,
++ 17,368,369,12,15,16,61,499,312,6,
++ 98,306,308,373,41,90,487,407,486,408,
++ 474,409,478,485,25,59,1,405,462,413,
++ 480,494,495,13,124,461,123,453,92,447,
++ 387,390,131,2,393,384,91,427,455,329,
++ 95,130,394,454,309,430,467,473,367,305,
++ 377,89,79,87,361,64,141,233,63,100,
++ 372,344,144,364,234,150,118,378,359,385,
++ 47,20,24,307,445,444,489,446,402,399,
++ 400,398,401,54,443,442,448,441,37,208,
++ 386,9,458,106,388,389,406,392,19,383,
++ 68,426,75,429,449,375,136,451,14,452,
++ 314,316,71,302,472,74,437,436,432,435,
++ 434,433,341,200,201,202,203,217,315,317,
++ 73,497,340,342,303,321,45,498,450,140,
++ 258,181,188,187,163,252,253,34,11,169,
++ 35,261,248,161,243,214,159,165,164,18,
++ 142,86,49,184,117,256,116,223,77,260,
++ 78,21,65,240,215,213,216,30,158,31,
++ 32,29,27,28,245,246,8,62,81,146,
++ 40,5,46,109,139,110,108,38,72,115,
++ 84,149,247,153,154,107,237,44,244,55,
++ 56,69,222,93,43,239,143,83,50,257,
++ 122,209,218,48,238,112,157,70,160,255,
++ 259,199,0,241,85,242,251,250,220,219,
++ 138,207,7,236,376,345,346,493,324,42,
++ 488,374,94,464,348,349,490,496,504,505,
++ 463,26,350,491,347,148,3,379,58,460,
++ 120,311,102,125,479,113,410,391,128,457,
++ 440,412,137,352,354,353,356,351,357,355,
++ 492,335,336,396,331,333,337,395,330,332,
++ 334,358,204,205,206,101,370,503,114,133,
++ 431,466,411,166,326,325,132,80,301,88,
++ 362,501,39,82,96,127,371,343,126,145,
++ 147,105,360,23,382,210,211,212,134,156,
++ 235,476,484,52,103,111,97,135,468,67,
++ 425,328,304,322,57,459,36,469,500,254,
++ 318,310,470,424,477,481,483,482,323,381,
++ 129,397,60,22,339,10,456,465,313,327,
++ 475,363,66,76,471,428,365,438,4,121,
++};
++static int alpha_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(alpha_syscall_strings, alpha_syscall_s2i_s, alpha_syscall_s2i_i, 410, copy, value);
++ }
++}
++static const unsigned alpha_syscall_i2s_direct[] = {
++ 2788,302,458,3165,4384,2202,140,2918,2129,1046,
++ 4286,1613,95,376,1194,101,107,77,1765,1114,
++ 835,1928,4273,3928,843,278,3121,2071,2084,2057,
++ 2000,2023,2040,23,1601,1637,4123,1024,2302,3821,
++ 2188,187,3015,2528,2441,1454,2215,827,2669,1807,
++ 2603,30,4014,-1u,978,2473,2484,4105,3180,295,
++ 4267,113,2143,708,676,1938,4340,4071,1130,2495,
++ 2729,1223,2315,1385,1245,1144,4346,1891,1916,644,
++ 3776,2157,3829,2589,2346,2812,1793,654,3793,630,
++ 191,486,415,2517,3037,518,3837,4046,146,8,
++ 716,3653,3213,4025,72,3904,1058,2415,2287,2233,
++ 2268,4035,2700,3236,3676,2331,1860,1831,787,-1u,
++ 3200,4390,2631,399,383,3218,3878,3849,3273,4250,
++ 524,452,3769,3684,3964,4053,1180,3317,2895,2250,
++ 1484,688,1779,2575,748,3887,2173,3897,3156,2359,
++ 775,-1u,-1u,2385,2399,-1u,3973,2713,2012,1719,
++ 2738,1678,-1u,1560,1755,1737,3737,-1u,-1u,1624,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,1512,-1u,-1u,1820,-1u,-1u,1541,1526,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,2777,
++ 1332,1339,1346,1353,3633,3640,3647,2906,1029,2648,
++ 3944,3951,3957,1977,1700,1966,1988,1360,2658,2879,
++ 2863,-1u,2504,1877,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,700,768,3983,2928,2425,2685,2555,
++ 1949,2800,2822,1690,2452,2097,2113,2372,1664,-1u,
++ 2851,2833,1578,1590,4151,2749,1845,2616,1496,2765,
++ 1904,1650,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,-1u,
++ 64,3786,1228,1431,4090,610,154,851,168,550,
++ 4165,3206,134,4310,1208,1366,1214,1374,4157,0,
++ -1u,1444,4098,4238,3003,3760,3751,4317,4083,510,
++ 3580,3506,3595,3521,3614,3442,3465,3540,52,4280,
++ 1410,1325,1420,3868,738,2956,2971,3143,3048,3054,
++ 3128,3381,3323,3350,3336,3408,3365,3394,3626,805,
++ 3915,666,3805,4333,758,4371,43,603,81,88,
++ 3658,3858,728,182,3026,1172,2939,619,798,3170,
++ -1u,4244,3935,1120,476,818,1036,431,1065,1075,
++ 441,3261,1101,463,534,3562,3488,4259,959,935,
++ 946,968,925,-1u,-1u,307,1086,201,228,250,
++ 3244,3721,3301,328,-1u,-1u,-1u,-1u,-1u,-1u,
++ -1u,-1u,-1u,-1u,4176,4076,1136,492,4363,1152,
++ 566,3691,1278,1315,1302,1286,1268,1254,4377,35,
++ 3289,1017,995,984,881,863,908,421,1006,1158,
++ 1477,1186,1200,406,540,500,4293,3280,1051,4113,
++ 3189,390,318,3112,3042,4302,3705,580,4064,4128,
++ 4172,4354,1234,596,238,4323,3995,4183,261,3227,
++ 338,4191,4222,4206,4004,269,214,196,3020,894,
++ 3060,3135,3424,2987,348,362,3067,1392,1459,120,
++ 4144,3815,15,3667,3077,3094,
++};
++static const char *alpha_syscall_i2s(int v) {
++ return i2s_direct__(alpha_syscall_strings, alpha_syscall_i2s_direct, 0, 505, v);
++}
+diff --git a/lib/armeb_tables.h b/lib/armeb_tables.h
+new file mode 100644
+index 0000000..dd2bf5f
+--- /dev/null
++++ b/lib/armeb_tables.h
+@@ -0,0 +1,165 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char armeb_syscall_strings[] = "accept\0accept4\0access\0acct\0add_key\0adjtimex\0alarm\0bdflush\0bind\0brk\0"
++ "capget\0capset\0chdir\0chmod\0chown\0chown32\0chroot\0clock_adjtime\0clock_getres\0clock_gettime\0"
++ "clock_nanosleep\0clock_settime\0clone\0close\0connect\0creat\0delete_module\0dup\0dup2\0dup3\0"
++ "epoll_create\0epoll_create1\0epoll_ctl\0epoll_wait\0eventfd\0eventfd2\0execve\0exit\0exit_group\0faccessat\0"
++ "fadvise64_64\0fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0fchown32\0fchownat\0"
++ "fcntl\0fcntl64\0fdatasync\0fgetxattr\0finit_module\0flistxattr\0flock\0fork\0fremovexattr\0fsetxattr\0"
++ "fstat\0fstat64\0fstatat64\0fstatfs\0fstatfs64\0fsync\0ftruncate\0ftruncate64\0futex\0futimesat\0"
++ "get_mempolicy\0get_robust_list\0getcpu\0getcwd\0getdents\0getdents64\0getegid\0getegid32\0geteuid\0geteuid32\0"
++ "getgid\0getgid32\0getgroups\0getgroups32\0getitimer\0getpeername\0getpgid\0getpgrp\0getpid\0getppid\0"
++ "getpriority\0getresgid\0getresgid32\0getresuid\0getresuid32\0getrlimit\0getrusage\0getsid\0getsockname\0getsockopt\0"
++ "gettid\0gettimeofday\0getuid\0getuid32\0getxattr\0init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0"
++ "io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0ioctl\0ioprio_get\0ioprio_set\0ipc\0kcmp\0"
++ "kexec_load\0keyctl\0kill\0lchown\0lchown32\0lgetxattr\0link\0linkat\0listen\0listxattr\0"
++ "llistxattr\0llseek\0lookup_dcookie\0lremovexattr\0lseek\0lsetxattr\0lstat\0lstat64\0madvise\0mbind\0"
++ "mincore\0mkdir\0mkdirat\0mknod\0mknodat\0mlock\0mlockall\0mmap\0mmap2\0mount\0"
++ "move_pages\0mprotect\0mq_getsetattr\0mq_notify\0mq_open\0mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msgctl\0"
++ "msgget\0msgrcv\0msgsnd\0msync\0munlock\0munlockall\0munmap\0name_to_handle_at\0nanosleep\0newselect\0"
++ "nfsservctl\0nice\0open\0open_by_handle_at\0openat\0pause\0pciconfig_iobase\0pciconfig_read\0pciconfig_write\0perf_event_open\0"
++ "personality\0pipe\0pipe2\0pivot_root\0poll\0prctl\0pread64\0preadv\0prlimit64\0process_vm_readv\0"
++ "process_vm_writev\0ptrace\0pwrite64\0pwritev\0quotactl\0read\0readahead\0readdir\0readlink\0readlinkat\0"
++ "readv\0reboot\0recv\0recvfrom\0recvmmsg\0recvmsg\0remap_file_pages\0removexattr\0rename\0renameat\0"
++ "request_key\0restart_syscall\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0"
++ "rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0"
++ "sched_yield\0select\0semctl\0semget\0semop\0semtimedop\0send\0sendfile\0sendfile64\0sendmmsg\0"
++ "sendmsg\0sendto\0set_mempolicy\0set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsgid32\0setfsuid\0setfsuid32\0"
++ "setgid\0setgid32\0setgroups\0setgroups32\0sethostname\0setitimer\0setns\0setpgid\0setpriority\0setregid\0"
++ "setregid32\0setresgid\0setresgid32\0setresuid\0setresuid32\0setreuid\0setreuid32\0setrlimit\0setsid\0setsockopt\0"
++ "settimeofday\0setuid\0setuid32\0setxattr\0shmat\0shmctl\0shmdt\0shmget\0shutdown\0sigaction\0"
++ "sigaltstack\0signalfd\0signalfd4\0sigpending\0sigprocmask\0sigreturn\0sigsuspend\0socket\0socketcall\0socketpair\0"
++ "splice\0stat\0stat64\0statfs\0statfs64\0stime\0swapoff\0swapon\0symlink\0symlinkat\0"
++ "sync\0sync_file_range\0syncfs\0syscall\0sysctl\0sysfs\0sysinfo\0syslog\0tee\0tgkill\0"
++ "time\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd_create\0timerfd_gettime\0timerfd_settime\0times\0"
++ "tkill\0truncate\0truncate64\0ugetrlimit\0umask\0umount\0umount2\0uname\0unlink\0unlinkat\0"
++ "unshare\0uselib\0ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0vmsplice\0vserver\0"
++ "wait4\0waitid\0write\0writev";
++static const unsigned armeb_syscall_s2i_s[] = {
++ 0,7,15,22,27,35,44,50,58,63,
++ 67,74,81,87,93,99,107,114,128,141,
++ 155,171,185,191,197,205,211,225,229,234,
++ 239,252,266,276,287,295,304,311,316,327,
++ 337,350,360,374,388,395,402,411,418,427,
++ 436,442,450,460,470,483,494,500,505,518,
++ 528,534,542,552,560,570,576,586,598,604,
++ 614,628,644,651,658,667,678,686,696,704,
++ 714,721,730,740,752,762,774,782,790,797,
++ 805,817,827,839,849,861,871,881,888,900,
++ 911,918,931,938,947,956,968,986,999,1013,
++ 1030,1040,1051,1064,1073,1083,1089,1100,1111,1115,
++ 1120,1131,1138,1143,1150,1159,1169,1174,1181,1188,
++ 1198,1209,1216,1231,1244,1250,1260,1266,1274,1282,
++ 1288,1296,1302,1310,1316,1324,1330,1339,1344,1350,
++ 1356,1367,1376,1390,1400,1408,1424,1437,1447,1454,
++ 1461,1468,1475,1482,1488,1496,1507,1514,1532,1542,
++ 1552,1563,1568,1573,1591,1598,1604,1621,1636,1652,
++ 1668,1680,1685,1691,1702,1707,1713,1721,1728,1738,
++ 1755,1773,1780,1789,1797,1806,1811,1821,1829,1838,
++ 1849,1855,1862,1867,1876,1885,1893,1910,1922,1929,
++ 1938,1950,1966,1972,1985,1999,2014,2030,2043,2057,
++ 2073,2091,2114,2137,2155,2170,2189,2211,2229,2244,
++ 2263,2275,2282,2289,2296,2302,2313,2318,2327,2338,
++ 2347,2355,2362,2376,2392,2408,2422,2431,2442,2451,
++ 2462,2469,2478,2488,2500,2512,2522,2528,2536,2548,
++ 2557,2568,2578,2590,2600,2612,2621,2632,2642,2649,
++ 2660,2673,2680,2689,2698,2704,2711,2717,2724,2733,
++ 2743,2755,2764,2774,2785,2797,2807,2818,2825,2836,
++ 2847,2854,2859,2866,2873,2882,2888,2896,2903,2911,
++ 2921,2926,2942,2949,2957,2964,2970,2978,2985,2989,
++ 2996,3001,3014,3027,3044,3058,3072,3087,3103,3119,
++ 3125,3131,3140,3151,3162,3168,3175,3183,3189,3196,
++ 3205,3213,3220,3226,3232,3242,3249,3255,3263,3272,
++ 3280,3286,3293,3299,
++};
++static const int armeb_syscall_s2i_i[] = {
++ 285,366,33,51,309,124,27,134,282,45,
++ 184,185,12,15,182,212,61,372,264,263,
++ 265,262,120,6,283,8,129,41,63,358,
++ 250,357,251,252,351,356,11,1,248,334,
++ 270,352,367,368,133,94,333,95,207,325,
++ 55,221,148,231,379,234,143,2,237,228,
++ 108,197,327,100,267,118,93,194,240,326,
++ 320,339,345,183,141,217,50,202,49,201,
++ 47,200,80,205,105,287,132,65,20,64,
++ 96,171,211,165,209,76,77,147,286,295,
++ 224,78,24,199,229,128,317,316,360,318,
++ 247,244,245,243,246,54,315,314,117,378,
++ 347,311,37,16,198,230,9,330,284,232,
++ 233,140,249,236,19,227,107,196,220,319,
++ 219,39,323,14,324,150,152,90,192,21,
++ 344,125,279,278,274,277,276,275,163,304,
++ 303,302,301,144,151,153,91,370,162,142,
++ 169,34,5,371,322,29,271,272,273,364,
++ 136,42,359,218,168,172,180,361,369,376,
++ 377,26,181,362,131,3,225,89,85,332,
++ 145,88,291,292,365,297,253,235,38,329,
++ 310,0,40,174,176,175,178,173,179,177,
++ 363,159,160,242,155,157,161,241,154,156,
++ 158,82,300,299,298,312,289,187,239,374,
++ 296,290,321,338,256,121,139,216,138,215,
++ 46,214,81,206,74,104,375,57,97,71,
++ 204,170,210,164,208,70,203,75,66,294,
++ 79,23,213,226,305,308,306,307,293,67,
++ 186,349,355,73,126,119,72,281,102,288,
++ 340,106,195,99,266,25,115,87,83,331,
++ 36,341,373,113,149,135,116,103,342,268,
++ 13,257,261,260,259,258,350,354,353,43,
++ 238,92,193,191,60,22,52,122,10,328,
++ 337,86,62,30,348,269,190,111,343,313,
++ 114,280,4,146,
++};
++static int armeb_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(armeb_syscall_strings, armeb_syscall_s2i_s, armeb_syscall_s2i_i, 344, copy, value);
++ }
++}
++static const unsigned armeb_syscall_i2s_direct[] = {
++ 1950,311,500,1806,3293,1568,191,-1u,205,1169,
++ 3189,304,81,2996,1310,87,1143,-1u,-1u,1244,
++ 790,1350,3168,2673,931,2882,1773,44,-1u,1598,
++ 3226,-1u,-1u,15,1563,-1u,2921,1138,1922,1296,
++ 1966,225,1680,3119,-1u,63,2462,714,-1u,696,
++ 678,22,3175,-1u,1083,436,-1u,2528,-1u,-1u,
++ 3162,107,3220,229,797,782,2642,2733,-1u,-1u,
++ 2612,2548,2807,2774,2500,2632,861,871,918,2660,
++ 730,2478,2275,2903,-1u,1829,3213,2896,1855,1821,
++ 1339,1507,3131,576,395,411,805,2536,-1u,2866,
++ 552,-1u,2825,2978,2512,752,2854,1260,528,-1u,
++ -1u,3255,-1u,2949,3280,2888,2970,1111,570,2797,
++ 185,2408,3183,-1u,35,1367,2785,-1u,956,211,
++ -1u,1797,774,388,50,2964,1668,-1u,2442,2422,
++ 1209,658,1542,494,1482,1849,3299,881,450,2957,
++ 1324,1488,1330,1496,2229,2155,2244,2170,2263,2091,
++ 2114,2189,1532,1447,2590,839,-1u,-1u,1702,1552,
++ 2568,817,1707,2030,1972,1999,1985,2057,2014,2043,
++ 1713,1780,93,651,67,74,2743,2318,-1u,-1u,
++ 3249,3151,1344,3140,586,2859,1266,534,1150,938,
++ 721,704,686,2621,2557,740,2488,418,2600,849,
++ 2578,827,99,2680,2469,2451,2431,667,1691,1288,
++ 1274,442,-1u,-1u,911,1811,2689,1250,518,947,
++ 1159,460,1188,1198,483,1910,1231,505,3125,2327,
++ 598,2211,2137,1064,1040,1051,1073,1030,316,1216,
++ 239,266,276,1893,-1u,-1u,2392,3001,3058,3044,
++ 3027,3014,171,141,128,155,2873,560,2989,3242,
++ 337,1604,1621,1636,1400,1437,1424,1408,1390,1376,
++ 3286,2818,58,197,1181,0,888,762,2836,2313,
++ 2355,1862,1867,2724,2649,900,2347,1885,2296,2289,
++ 2282,1475,1468,1461,1454,2698,2711,2717,2704,27,
++ 1938,1131,2302,3272,1100,1089,986,968,1013,1282,
++ 614,2362,1591,1302,1316,427,604,542,3196,1929,
++ 1174,2911,1838,402,327,-1u,-1u,3205,2376,628,
++ 2847,2926,2985,3263,1356,644,-1u,1120,3232,2755,
++ 3072,287,350,3103,3087,2764,295,252,234,1685,
++ 999,1721,1789,2073,1652,1876,7,360,374,1728,
++ 1514,1573,114,2942,2338,2522,1738,1755,1115,470,
++};
++static const char *armeb_syscall_i2s(int v) {
++ return i2s_direct__(armeb_syscall_strings, armeb_syscall_i2s_direct, 0, 379, v);
++}
+diff --git a/lib/errtabs.h b/lib/errtabs.h
+new file mode 100644
+index 0000000..53deac2
+--- /dev/null
++++ b/lib/errtabs.h
+@@ -0,0 +1,78 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char err_strings[] = "E2BIG\0EACCES\0EADDRINUSE\0EADDRNOTAVAIL\0EADV\0EAFNOSUPPORT\0EAGAIN\0EALREADY\0EBADE\0EBADF\0"
++ "EBADFD\0EBADMSG\0EBADR\0EBADRQC\0EBADSLT\0EBFONT\0EBUSY\0ECANCELED\0ECHILD\0ECHRNG\0"
++ "ECOMM\0ECONNABORTED\0ECONNREFUSED\0ECONNRESET\0EDEADLK\0EDEADLOCK\0EDESTADDRREQ\0EDOM\0EDOTDOT\0EDQUOT\0"
++ "EEXIST\0EFAULT\0EFBIG\0EHOSTDOWN\0EHOSTUNREACH\0EIDRM\0EILSEQ\0EINPROGRESS\0EINTR\0EINVAL\0"
++ "EIO\0EISCONN\0EISDIR\0EISNAM\0EKEYEXPIRED\0EKEYREJECTED\0EKEYREVOKED\0EL2HLT\0EL2NSYNC\0EL3HLT\0"
++ "EL3RST\0ELIBACC\0ELIBBAD\0ELIBEXEC\0ELIBMAX\0ELIBSCN\0ELNRNG\0ELOOP\0EMEDIUMTYPE\0EMFILE\0"
++ "EMLINK\0EMSGSIZE\0EMULTIHOP\0ENAMETOOLONG\0ENAVAIL\0ENETDOWN\0ENETRESET\0ENETUNREACH\0ENFILE\0ENOANO\0"
++ "ENOBUFS\0ENOCSI\0ENODATA\0ENODEV\0ENOENT\0ENOEXEC\0ENOKEY\0ENOLCK\0ENOLINK\0ENOMEDIUM\0"
++ "ENOMEM\0ENOMSG\0ENONET\0ENOPKG\0ENOPROTOOPT\0ENOSPC\0ENOSR\0ENOSTR\0ENOSYS\0ENOTBLK\0"
++ "ENOTCONN\0ENOTDIR\0ENOTEMPTY\0ENOTNAM\0ENOTRECOVERABLE\0ENOTSOCK\0ENOTTY\0ENOTUNIQ\0ENXIO\0EOPNOTSUPP\0"
++ "EOVERFLOW\0EOWNERDEAD\0EPERM\0EPFNOSUPPORT\0EPIPE\0EPROTO\0EPROTONOSUPPORT\0EPROTOTYPE\0ERANGE\0EREMCHG\0"
++ "EREMOTE\0EREMOTEIO\0ERESTART\0EROFS\0ESHUTDOWN\0ESOCKTNOSUPPORT\0ESPIPE\0ESRCH\0ESRMNT\0ESTALE\0"
++ "ESTRPIPE\0ETIME\0ETIMEDOUT\0ETOOMANYREFS\0ETXTBSY\0EUCLEAN\0EUNATCH\0EUSERS\0EWOULDBLOCK\0EXDEV\0"
++ "EXFULL";
++static const unsigned err_s2i_s[] = {
++ 0,6,13,24,38,43,56,63,72,78,
++ 84,91,99,105,113,121,128,134,144,151,
++ 158,164,177,190,201,209,219,232,237,245,
++ 252,259,266,272,282,295,301,308,320,326,
++ 333,337,345,352,359,371,384,396,403,412,
++ 419,426,434,442,451,459,467,474,480,492,
++ 499,506,515,525,538,546,555,565,577,584,
++ 591,599,606,614,621,628,636,643,650,658,
++ 668,675,682,689,696,708,715,721,728,735,
++ 743,752,760,770,778,794,803,810,819,825,
++ 836,846,857,863,876,882,889,905,916,923,
++ 931,939,949,958,964,974,990,997,1003,1010,
++ 1017,1026,1032,1042,1055,1063,1071,1079,1086,1098,
++ 1104,
++};
++static const int err_s2i_i[] = {
++ 7,13,98,99,68,97,11,114,52,9,
++ 77,74,53,56,57,59,16,125,10,44,
++ 70,103,111,104,35,35,89,33,73,122,
++ 17,14,27,112,113,43,84,115,4,22,
++ 5,106,21,120,127,129,128,51,45,46,
++ 47,79,80,83,82,81,48,40,124,24,
++ 31,90,72,36,119,100,102,101,23,55,
++ 105,50,61,19,2,8,126,37,67,123,
++ 12,42,64,65,92,28,63,60,38,15,
++ 107,20,39,118,131,88,25,76,6,95,
++ 75,130,1,96,32,71,93,91,34,78,
++ 66,121,85,30,108,94,29,3,69,116,
++ 86,62,110,109,26,117,49,87,11,18,
++ 54,
++};
++static int err_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISLOWER(c) ? c - 'a' + 'A' : c;
++ }
++ copy[i] = 0;
++ return s2i__(err_strings, err_s2i_s, err_s2i_i, 131, copy, value);
++ }
++}
++static const unsigned err_i2s_direct[] = {
++ 857,621,997,320,333,819,0,628,78,144,
++ 56,668,6,259,735,128,252,1098,614,752,
++ 345,326,577,492,803,1055,266,708,990,958,
++ 499,876,232,916,201,525,643,728,760,474,
++ -1u,675,295,151,403,412,419,467,1071,599,
++ 396,72,99,1104,584,105,113,-1u,121,721,
++ 606,1026,715,682,689,931,650,38,1003,158,
++ 882,515,237,91,836,810,84,923,426,434,
++ 459,451,442,301,949,1017,1079,794,219,506,
++ 905,696,889,974,825,863,43,13,24,546,
++ 565,555,164,190,591,337,743,964,1042,1032,
++ 177,272,282,63,308,1010,1063,770,538,352,
++ 939,245,658,480,134,636,359,384,371,846,
++ 778,
++};
++static const char *err_i2s(int v) {
++ return i2s_direct__(err_strings, err_i2s_direct, 1, 131, v);
++}
+diff --git a/lib/fieldtabs.h b/lib/fieldtabs.h
+new file mode 100644
+index 0000000..fb50e08
+--- /dev/null
++++ b/lib/fieldtabs.h
+@@ -0,0 +1,49 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char field_strings[] = "a0\0a1\0a2\0a3\0arch\0auid\0devmajor\0devminor\0dir\0egid\0"
++ "euid\0exit\0field_compare\0filetype\0fsgid\0fsuid\0gid\0inode\0key\0loginuid\0"
++ "msgtype\0obj_gid\0obj_lev_high\0obj_lev_low\0obj_role\0obj_type\0obj_uid\0obj_user\0path\0perm\0"
++ "pers\0pid\0ppid\0sgid\0subj_clr\0subj_role\0subj_sen\0subj_type\0subj_user\0success\0"
++ "suid\0uid";
++static const unsigned field_s2i_s[] = {
++ 0,3,6,9,12,17,22,31,40,44,
++ 49,54,59,73,82,88,94,98,104,108,
++ 117,125,133,146,158,167,176,184,193,198,
++ 203,208,212,217,222,231,241,250,260,270,
++ 278,283,
++};
++static const int field_s2i_i[] = {
++ 200,201,202,203,11,9,100,101,107,6,
++ 2,103,111,108,8,4,5,102,210,9,
++ 12,110,23,22,20,21,109,19,105,106,
++ 10,0,18,7,17,14,16,15,13,104,
++ 3,1,
++};
++static int field_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(field_strings, field_s2i_s, field_s2i_i, 42, copy, value);
++ }
++}
++static const int field_i2s_i[] = {
++ 0,1,2,3,4,5,6,7,8,9,
++ 10,11,12,13,14,15,16,17,18,19,
++ 20,21,22,23,100,101,102,103,104,105,
++ 106,107,108,109,110,111,200,201,202,203,
++ 210,
++};
++static const unsigned field_i2s_s[] = {
++ 208,283,49,278,88,94,44,217,82,17,
++ 203,12,117,260,231,250,241,222,212,184,
++ 158,167,146,133,22,31,98,54,270,193,
++ 198,40,73,176,125,59,0,3,6,9,
++ 104,
++};
++static const char *field_i2s(int v) {
++ return i2s_bsearch__(field_strings, field_i2s_i, field_i2s_s, 41, v);
++}
+diff --git a/lib/flagtabs.h b/lib/flagtabs.h
+new file mode 100644
+index 0000000..e191db3
+--- /dev/null
++++ b/lib/flagtabs.h
+@@ -0,0 +1,26 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char flag_strings[] = "entry\0exclude\0exit\0task\0user";
++static const unsigned flag_s2i_s[] = {
++ 0,6,14,19,24,
++};
++static const int flag_s2i_i[] = {
++ 2,5,4,1,0,
++};
++static int flag_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(flag_strings, flag_s2i_s, flag_s2i_i, 5, copy, value);
++ }
++}
++static const unsigned flag_i2s_direct[] = {
++ 24,19,0,-1u,14,6,
++};
++static const char *flag_i2s(int v) {
++ return i2s_direct__(flag_strings, flag_i2s_direct, 0, 5, v);
++}
+diff --git a/lib/ftypetabs.h b/lib/ftypetabs.h
+new file mode 100644
+index 0000000..04aaa46
+--- /dev/null
++++ b/lib/ftypetabs.h
+@@ -0,0 +1,29 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ftype_strings[] = "block\0character\0dir\0fifo\0file\0link\0socket";
++static const unsigned ftype_s2i_s[] = {
++ 0,6,16,20,25,30,35,
++};
++static const int ftype_s2i_i[] = {
++ 24576,8192,16384,4096,32768,40960,49152,
++};
++static int ftype_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(ftype_strings, ftype_s2i_s, ftype_s2i_i, 7, copy, value);
++ }
++}
++static const int ftype_i2s_i[] = {
++ 4096,8192,16384,24576,32768,40960,49152,
++};
++static const unsigned ftype_i2s_s[] = {
++ 20,6,16,0,25,30,35,
++};
++static const char *ftype_i2s(int v) {
++ return i2s_bsearch__(ftype_strings, ftype_i2s_i, ftype_i2s_s, 7, v);
++}
+diff --git a/lib/i386_tables.h b/lib/i386_tables.h
+new file mode 100644
+index 0000000..6703ffc
+--- /dev/null
++++ b/lib/i386_tables.h
+@@ -0,0 +1,163 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char i386_syscall_strings[] = "_llseek\0_newselect\0_sysctl\0access\0acct\0add_key\0adjtimex\0afs_syscall\0alarm\0bdflush\0"
++ "break\0brk\0capget\0capset\0chdir\0chmod\0chown\0chown32\0chroot\0clock_adjtime\0"
++ "clock_getres\0clock_gettime\0clock_nanosleep\0clock_settime\0clone\0close\0creat\0create_module\0delete_module\0dup\0"
++ "dup2\0dup3\0epoll_create\0epoll_create1\0epoll_ctl\0epoll_pwait\0epoll_wait\0eventfd\0eventfd2\0execve\0"
++ "exit\0exit_group\0faccessat\0fadvise64\0fadvise64_64\0fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0"
++ "fchmodat\0fchown\0fchown32\0fchownat\0fcntl\0fcntl64\0fdatasync\0fgetxattr\0finit_module\0flistxattr\0"
++ "flock\0fork\0fremovexattr\0fsetxattr\0fstat\0fstat64\0fstatat64\0fstatfs\0fstatfs64\0fsync\0"
++ "ftime\0ftruncate\0ftruncate64\0futex\0futimesat\0get_kernel_syms\0get_mempolicy\0get_robust_list\0get_thread_area\0getcpu\0"
++ "getcwd\0getdents\0getdents64\0getegid\0getegid32\0geteuid\0geteuid32\0getgid\0getgid32\0getgroups\0"
++ "getgroups32\0getitimer\0getpgid\0getpgrp\0getpid\0getpmsg\0getppid\0getpriority\0getresgid\0getresgid32\0"
++ "getresuid\0getresuid32\0getrlimit\0getrusage\0getsid\0gettid\0gettimeofday\0getuid\0getuid32\0getxattr\0"
++ "gtty\0idle\0init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0"
++ "io_setup\0io_submit\0ioctl\0ioperm\0iopl\0ioprio_get\0ioprio_set\0ipc\0kcmp\0keyctl\0"
++ "kill\0lchown\0lchown32\0lgetxattr\0link\0linkat\0listxattr\0llistxattr\0lock\0lookup_dcookie\0"
++ "lremovexattr\0lseek\0lsetxattr\0lstat\0lstat64\0madvise\0madvise1\0mbind\0migrate_pages\0mincore\0"
++ "mkdir\0mkdirat\0mknod\0mknodat\0mlock\0mlockall\0mmap\0mmap2\0modify_ldt\0mount\0"
++ "move_pages\0mprotect\0mpx\0mq_getsetattr\0mq_notify\0mq_open\0mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0"
++ "msync\0munlock\0munlockall\0munmap\0name_to_handle_at\0nanosleep\0nfsservctl\0nice\0oldfstat\0oldlstat\0"
++ "oldolduname\0oldstat\0olduname\0open\0open_by_handle_at\0openat\0pause\0perf_event_open\0personality\0pipe\0"
++ "pipe2\0pivot_root\0poll\0ppoll\0prctl\0pread64\0preadv\0prlimit64\0process_vm_readv\0process_vm_writev\0"
++ "prof\0profil\0pselect6\0ptrace\0putpmsg\0pwrite64\0pwritev\0query_module\0quotactl\0read\0"
++ "readahead\0readdir\0readlink\0readlinkat\0readv\0reboot\0recvmmsg\0remap_file_pages\0removexattr\0rename\0"
++ "renameat\0request_key\0restart_syscall\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0"
++ "rt_sigtimedwait\0rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0"
++ "sched_setscheduler\0sched_yield\0select\0sendfile\0sendfile64\0sendmmsg\0set_mempolicy\0set_robust_list\0set_thread_area\0set_tid_address\0"
++ "setdomainname\0setfsgid\0setfsgid32\0setfsuid\0setfsuid32\0setgid\0setgid32\0setgroups\0setgroups32\0sethostname\0"
++ "setitimer\0setns\0setpgid\0setpriority\0setregid\0setregid32\0setresgid\0setresgid32\0setresuid\0setresuid32\0"
++ "setreuid\0setreuid32\0setrlimit\0setsid\0settimeofday\0setuid\0setuid32\0setxattr\0sgetmask\0sigaction\0"
++ "sigaltstack\0signal\0signalfd\0signalfd4\0sigpending\0sigprocmask\0sigreturn\0sigsuspend\0socketcall\0splice\0"
++ "ssetmask\0stat\0stat64\0statfs\0statfs64\0stime\0stty\0swapoff\0swapon\0symlink\0"
++ "symlinkat\0sync\0sync_file_range\0syncfs\0sys_kexec_load\0sysfs\0sysinfo\0syslog\0tee\0tgkill\0"
++ "time\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd\0timerfd_gettime\0timerfd_settime\0times\0"
++ "tkill\0truncate\0truncate64\0ugetrlimit\0ulimit\0umask\0umount\0umount2\0uname\0unlink\0"
++ "unlinkat\0unshare\0uselib\0ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0vm86\0"
++ "vm86old\0vmsplice\0vserver\0wait4\0waitid\0waitpid\0write\0writev";
++static const unsigned i386_syscall_s2i_s[] = {
++ 0,8,19,27,34,39,47,56,68,74,
++ 82,88,92,99,106,112,118,124,132,139,
++ 153,166,180,196,210,216,222,228,242,256,
++ 260,265,270,283,297,307,319,330,338,347,
++ 354,359,370,380,390,403,413,427,441,448,
++ 455,464,471,480,489,495,503,513,523,536,
++ 547,553,558,571,581,587,595,605,613,623,
++ 629,635,645,657,663,673,689,703,719,735,
++ 742,749,758,769,777,787,795,805,812,821,
++ 831,843,853,861,869,876,884,892,904,914,
++ 926,936,948,958,968,975,982,995,1002,1011,
++ 1020,1025,1030,1042,1060,1073,1087,1104,1114,1125,
++ 1138,1147,1157,1163,1170,1175,1186,1197,1201,1206,
++ 1213,1218,1225,1234,1244,1249,1256,1266,1277,1282,
++ 1297,1310,1316,1326,1332,1340,1348,1357,1363,1377,
++ 1385,1391,1399,1405,1413,1419,1428,1433,1439,1450,
++ 1456,1467,1476,1480,1494,1504,1512,1528,1541,1551,
++ 1558,1564,1572,1583,1590,1608,1618,1629,1634,1643,
++ 1652,1664,1672,1681,1686,1704,1711,1717,1733,1745,
++ 1750,1756,1767,1772,1778,1784,1792,1799,1809,1826,
++ 1844,1849,1856,1865,1872,1880,1889,1897,1910,1919,
++ 1924,1934,1942,1951,1962,1968,1975,1984,2001,2013,
++ 2020,2029,2041,2057,2063,2076,2090,2105,2121,2134,
++ 2148,2164,2182,2205,2228,2246,2261,2280,2302,2320,
++ 2335,2354,2366,2373,2382,2393,2402,2416,2432,2448,
++ 2464,2478,2487,2498,2507,2518,2525,2534,2544,2556,
++ 2568,2578,2584,2592,2604,2613,2624,2634,2646,2656,
++ 2668,2677,2688,2698,2705,2718,2725,2734,2743,2752,
++ 2762,2774,2781,2790,2800,2811,2823,2833,2844,2855,
++ 2862,2871,2876,2883,2890,2899,2905,2910,2918,2925,
++ 2933,2943,2948,2964,2971,2986,2992,3000,3007,3011,
++ 3018,3023,3036,3049,3066,3080,3094,3102,3118,3134,
++ 3140,3146,3155,3166,3177,3184,3190,3197,3205,3211,
++ 3218,3227,3235,3242,3248,3254,3264,3271,3277,3285,
++ 3290,3298,3307,3315,3321,3328,3336,3342,
++};
++static const int i386_syscall_s2i_i[] = {
++ 140,142,149,33,51,286,124,137,27,134,
++ 17,45,184,185,12,15,182,212,61,343,
++ 266,265,267,264,120,6,8,127,129,41,
++ 63,330,254,329,255,319,256,323,328,11,
++ 1,252,307,250,272,324,338,339,133,94,
++ 306,95,207,298,55,221,148,231,350,234,
++ 143,2,237,228,108,197,300,100,269,118,
++ 35,93,194,240,299,130,275,312,244,318,
++ 183,141,220,50,202,49,201,47,200,80,
++ 205,105,132,65,20,188,64,96,171,211,
++ 165,209,76,77,147,224,78,24,199,229,
++ 32,112,128,292,291,332,293,249,246,247,
++ 245,248,54,101,110,290,289,117,349,288,
++ 37,16,198,230,9,303,232,233,53,253,
++ 236,19,227,107,196,219,219,274,294,218,
++ 39,296,14,297,150,152,90,192,123,21,
++ 317,125,56,282,281,277,280,279,278,163,
++ 144,151,153,91,341,162,169,34,28,84,
++ 59,18,109,5,342,295,29,336,136,42,
++ 331,217,168,309,172,180,333,340,347,348,
++ 44,98,308,26,189,181,334,167,131,3,
++ 225,89,85,305,145,88,337,257,235,38,
++ 302,287,0,40,174,176,175,178,173,179,
++ 177,335,159,160,242,155,157,161,241,154,
++ 156,158,82,187,239,345,276,311,243,258,
++ 121,139,216,138,215,46,214,81,206,74,
++ 104,346,57,97,71,204,170,210,164,208,
++ 70,203,75,66,79,23,213,226,68,67,
++ 186,48,321,327,73,126,119,72,102,313,
++ 69,106,195,99,268,25,31,115,87,83,
++ 304,36,314,344,283,135,116,103,315,270,
++ 13,259,263,262,261,260,322,326,325,43,
++ 238,92,193,191,58,60,22,52,122,10,
++ 301,310,86,62,30,320,271,190,111,166,
++ 113,316,273,114,284,7,4,146,
++};
++static int i386_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(i386_syscall_strings, i386_syscall_s2i_s, i386_syscall_s2i_i, 348, copy, value);
++ }
++}
++static const unsigned i386_syscall_i2s_direct[] = {
++ 2041,354,553,1919,3336,1681,216,3328,222,1244,
++ 3211,347,106,3018,1399,112,1218,82,1664,1310,
++ 869,1450,3190,2718,995,2899,1865,68,1634,1711,
++ 3248,2905,1020,27,1629,629,2943,1213,2013,1385,
++ 2057,256,1745,3134,1844,88,2518,805,2774,787,
++ 769,34,3197,1277,1157,489,1476,2584,3177,1652,
++ 3184,132,3242,260,884,861,2698,2752,2743,2862,
++ 2668,2604,2833,2800,2556,2688,948,958,982,2705,
++ 821,2534,2366,2925,1643,1942,3235,2918,1968,1934,
++ 1428,1583,3146,635,448,464,892,2592,1849,2883,
++ 605,1163,2844,3000,2568,843,2871,1326,581,1672,
++ 1170,3277,1025,3290,3315,2910,2992,1197,623,2823,
++ 210,2464,3205,1439,47,1467,2811,228,1030,242,
++ 673,1910,853,441,74,2986,1733,56,2498,2478,
++ 0,749,8,547,1558,1962,3342,968,503,19,
++ 1413,1564,1419,1572,2320,2246,2335,2261,2354,2182,
++ 2205,2280,1608,1551,2646,926,3285,1897,1767,1618,
++ 2624,904,1778,2121,2063,2090,2076,2148,2105,2134,
++ 1784,1880,118,742,92,99,2762,2373,876,1872,
++ 3271,3166,1433,3155,645,2876,1332,587,1225,1002,
++ 812,795,777,2677,2613,831,2544,471,2656,936,
++ 2634,914,124,2725,2525,2507,2487,1756,1377,1340,
++ 758,495,-1u,-1u,975,1924,2734,1316,571,1011,
++ 1234,513,1256,1266,536,2001,1297,558,3140,2382,
++ 657,2302,2228,2432,719,1138,1114,1125,1147,1104,
++ 380,-1u,359,1282,270,297,319,1984,2448,3023,
++ 3080,3066,3049,3036,196,166,153,180,2890,613,
++ 3011,3264,390,3307,1357,689,2402,1504,1541,1528,
++ 1512,1494,1480,2971,3321,-1u,39,2029,1206,1186,
++ 1175,1060,1042,1087,1363,1704,1391,1405,480,663,
++ 595,3218,2020,1249,2933,1951,455,370,1856,1772,
++ 3227,2416,703,2855,2948,3007,3298,1456,735,307,
++ 3254,2781,3094,330,403,3118,3102,2790,338,283,
++ 265,1750,1073,1792,1889,2164,1717,1975,413,427,
++ 1799,1590,1686,139,2964,2393,2578,1809,1826,1201,
++ 523,
++};
++static const char *i386_syscall_i2s(int v) {
++ return i2s_direct__(i386_syscall_strings, i386_syscall_i2s_direct, 0, 350, v);
++}
+diff --git a/lib/ia64_tables.h b/lib/ia64_tables.h
+new file mode 100644
+index 0000000..9e127a0
+--- /dev/null
++++ b/lib/ia64_tables.h
+@@ -0,0 +1,147 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ia64_syscall_strings[] = "_sysctl\0accept\0accept4\0access\0acct\0add_key\0adjtimex\0afs_syscall\0bdflush\0bind\0"
++ "brk\0capget\0capset\0chdir\0chmod\0chown\0chroot\0clock_adjtime\0clock_getres\0clock_gettime\0"
++ "clock_nanosleep\0clock_settime\0clone\0clone2\0close\0connect\0creat\0delete_module\0dup\0dup2\0"
++ "dup3\0epoll_create\0epoll_create1\0epoll_ctl\0epoll_pwait\0epoll_wait\0eventfd\0eventfd2\0execve\0exit\0"
++ "exit_group\0faccessat\0fadvise64\0fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0"
++ "fchownat\0fcntl\0fdatasync\0fgetxattr\0finit_module\0flistxattr\0flock\0fremovexattr\0fsetxattr\0fstat\0"
++ "fstatfs\0fstatfs64\0fsync\0ftruncate\0futex\0futimesat\0get_mempolicy\0get_robust_list\0getcpu\0getcwd\0"
++ "getdents\0getdents64\0getegid\0geteuid\0getgid\0getgroups\0getitimer\0getpeername\0getpgid\0getpid\0"
++ "getpmsg\0getppid\0getpriority\0getresgid\0getresuid\0getrlimit\0getrusage\0getsid\0getsockname\0getsockopt\0"
++ "gettid\0gettimeofday\0getuid\0getunwind\0getxattr\0init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0"
++ "io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0ioctl\0ioprio_get\0ioprio_set\0kexec_load\0keyctl\0"
++ "kill\0lchown\0lgetxattr\0link\0linkat\0listen\0listxattr\0llistxattr\0lookup_dcookie\0lremovexattr\0"
++ "lseek\0lsetxattr\0lstat\0madvise\0mbind\0migrate_pages\0mincore\0mkdir\0mkdirat\0mknod\0"
++ "mknodat\0mlock\0mlockall\0mmap\0mmap2\0mount\0mprotect\0mq_getsetattr\0mq_notify\0mq_open\0"
++ "mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msgctl\0msgget\0msgrcv\0msgsnd\0msync\0munlock\0"
++ "munlockall\0munmap\0name_to_handle_at\0nanosleep\0newfstatat\0nfsservctl\0ni_syscall\0open\0open_by_handle_at\0openat\0"
++ "pciconfig_read\0pciconfig_write\0perfmonctl\0personality\0pipe\0pipe2\0pivot_root\0poll\0ppoll\0prctl\0"
++ "pread64\0preadv\0prlimit64\0process_vm_readv\0process_vm_writev\0pselect\0ptrace\0putpmsg\0pwrite64\0pwritev\0"
++ "quotactl\0read\0readahead\0readlink\0readlinkat\0readv\0reboot\0recv\0recvfrom\0recvmmsg\0"
++ "recvmsg\0remap_file_pages\0removexattr\0rename\0renameat\0request_key\0restart_syscall\0rmdir\0rt_sigaction\0rt_sigpending\0"
++ "rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0"
++ "sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0sched_yield\0select\0semctl\0semget\0semop\0"
++ "semtimedop\0send\0sendfile\0sendmmsg\0sendmsg\0sendto\0set_mempolicy\0set_robust_list\0set_tid_address\0set_zone_reclaim\0"
++ "setdomainname\0setfsgid\0setfsuid\0setgid\0setgroups\0sethostname\0setitimer\0setns\0setpgid\0setpriority\0"
++ "setregid\0setresgid\0setresuid\0setreuid\0setrlimit\0setsid\0setsockopt\0settimeofday\0setuid\0setxattr\0"
++ "shmat\0shmctl\0shmdt\0shmget\0shutdown\0sigaltstack\0signalfd\0signalfd4\0socket\0socketpair\0"
++ "splice\0stat\0statfs\0statfs64\0swapoff\0swapon\0symlink\0symlinkat\0sync\0sync_file_range\0"
++ "syncfs\0sysfs\0sysinfo\0syslog\0tee\0tgkill\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0"
++ "timer_settime\0timerfd\0timerfd_create\0timerfd_gettime\0timerfd_settime\0times\0tkill\0truncate\0tux\0umask\0"
++ "umount\0uname\0unlink\0unlinkat\0unshare\0uselib\0ustat\0utimensat\0utimes\0vhangup\0"
++ "vmsplice\0vserver\0wait4\0waitid\0write\0writev";
++static const unsigned ia64_syscall_s2i_s[] = {
++ 0,8,15,23,30,35,43,52,64,72,
++ 77,81,88,95,101,107,113,120,134,147,
++ 161,177,191,197,204,210,218,224,238,242,
++ 247,252,265,279,289,301,312,320,329,336,
++ 341,352,362,372,382,396,410,417,424,433,
++ 440,449,455,465,475,488,499,505,518,528,
++ 534,542,552,558,568,574,584,598,614,621,
++ 628,637,648,656,664,671,681,691,703,711,
++ 718,726,734,746,756,766,776,786,793,805,
++ 816,823,836,843,853,862,874,892,905,919,
++ 936,946,957,970,979,989,995,1006,1017,1028,
++ 1035,1040,1047,1057,1062,1069,1076,1086,1097,1112,
++ 1125,1131,1141,1147,1155,1161,1175,1183,1189,1197,
++ 1203,1211,1217,1226,1231,1237,1243,1252,1266,1276,
++ 1284,1300,1313,1323,1330,1337,1344,1351,1358,1364,
++ 1372,1383,1390,1408,1418,1429,1440,1451,1456,1474,
++ 1481,1496,1512,1523,1535,1540,1546,1557,1562,1568,
++ 1574,1582,1589,1599,1616,1634,1642,1649,1657,1666,
++ 1674,1683,1688,1698,1707,1718,1724,1731,1736,1745,
++ 1754,1762,1779,1791,1798,1807,1819,1835,1841,1854,
++ 1868,1883,1899,1912,1926,1942,1960,1983,2006,2024,
++ 2039,2058,2080,2098,2113,2132,2144,2151,2158,2165,
++ 2171,2182,2187,2196,2205,2213,2220,2234,2250,2266,
++ 2283,2297,2306,2315,2322,2332,2344,2354,2360,2368,
++ 2380,2389,2399,2409,2418,2428,2435,2446,2459,2466,
++ 2475,2481,2488,2494,2501,2510,2522,2531,2541,2548,
++ 2559,2566,2571,2578,2587,2595,2602,2610,2620,2625,
++ 2641,2648,2654,2662,2669,2673,2680,2693,2706,2723,
++ 2737,2751,2759,2774,2790,2806,2812,2818,2827,2831,
++ 2837,2844,2850,2857,2866,2874,2881,2887,2897,2904,
++ 2912,2921,2929,2935,2942,2948,
++};
++static const int ia64_syscall_s2i_i[] = {
++ 1150,1194,1334,1049,1064,1271,1131,1141,1138,1191,
++ 1060,1185,1186,1034,1038,1039,1068,1328,1255,1254,
++ 1256,1253,1128,1213,1029,1192,1030,1134,1057,1070,
++ 1316,1243,1315,1244,1305,1245,1309,1314,1033,1025,
++ 1236,1293,1234,1303,1323,1324,1035,1099,1292,1100,
++ 1284,1066,1052,1222,1335,1225,1145,1228,1219,1212,
++ 1104,1257,1051,1098,1230,1285,1260,1299,1304,1184,
++ 1144,1214,1063,1047,1062,1077,1119,1196,1079,1041,
++ 1188,1042,1101,1075,1073,1085,1086,1082,1195,1204,
++ 1105,1087,1046,1215,1220,1133,1278,1277,1318,1279,
++ 1242,1239,1240,1238,1241,1065,1275,1274,1268,1273,
++ 1053,1124,1221,1031,1289,1193,1223,1224,1237,1227,
++ 1040,1218,1211,1209,1259,1280,1208,1055,1282,1037,
++ 1283,1153,1154,1151,1172,1043,1155,1267,1266,1262,
++ 1265,1264,1263,1156,1112,1109,1111,1110,1157,1158,
++ 1159,1152,1326,1168,1286,1169,1024,1028,1327,1281,
++ 1173,1174,1175,1140,1058,1317,1207,1090,1295,1170,
++ 1148,1319,1325,1332,1333,1294,1048,1189,1149,1320,
++ 1137,1026,1216,1092,1291,1146,1096,1200,1201,1322,
++ 1206,1125,1226,1054,1288,1272,1246,1056,1177,1178,
++ 1179,1180,1181,1182,1183,1321,1165,1166,1232,1160,
++ 1162,1167,1231,1161,1163,1164,1089,1108,1106,1107,
++ 1247,1198,1187,1331,1205,1199,1261,1298,1233,1276,
++ 1129,1143,1142,1061,1078,1083,1118,1330,1080,1102,
++ 1072,1076,1074,1071,1084,1081,1203,1088,1045,1217,
++ 1114,1116,1115,1113,1202,1176,1307,1313,1190,1197,
++ 1297,1210,1103,1258,1095,1094,1091,1290,1050,1300,
++ 1329,1139,1127,1117,1301,1235,1248,1252,1251,1250,
++ 1249,1308,1310,1312,1311,1059,1229,1097,1120,1067,
++ 1044,1130,1032,1287,1296,1093,1069,1306,1036,1123,
++ 1302,1269,1126,1270,1027,1147,
++};
++static int ia64_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(ia64_syscall_strings, ia64_syscall_s2i_s, ia64_syscall_s2i_i, 306, copy, value);
++ }
++}
++static const unsigned ia64_syscall_i2s_direct[] = {
++ 1440,336,1683,2942,1451,204,218,1057,2850,329,
++ 95,410,2897,1197,101,107,1125,711,726,1237,
++ 2837,2459,836,656,1642,23,2620,552,455,1035,
++ 1791,1183,1835,238,1535,2806,77,2315,664,648,
++ 30,989,449,2831,113,2881,242,2409,2380,756,
++ 2399,746,2389,671,2322,703,2360,2428,786,2332,
++ 2418,766,776,823,2446,2144,1557,2602,1698,2874,
++ 2595,2587,1724,2818,558,417,433,734,2368,2571,
++ 534,816,2158,2165,2151,1337,1351,1344,1330,2494,
++ 2475,2488,2481,2662,2344,681,2827,-1u,-1u,2904,
++ 1040,1762,2929,2654,191,2283,2844,43,-1u,862,
++ 224,-1u,-1u,1674,64,2648,1523,52,2306,2297,
++ 628,499,1718,2948,1574,1657,0,1226,1383,1211,
++ 1217,1243,1323,1358,1364,1372,2024,2098,2039,2113,
++ 2132,1960,1983,2058,1408,1429,1568,-1u,1231,1481,
++ 1496,1512,2510,1841,1854,1868,1883,1899,1912,1926,
++ 621,81,88,2187,718,1649,2541,72,210,1069,
++ 8,793,691,2548,2182,2213,1731,1736,2501,2435,
++ 805,2205,1754,1546,1175,1147,2566,1141,528,197,
++ 637,843,1688,2466,1131,518,853,1047,465,1076,
++ 1086,488,1779,1112,505,2812,568,2080,2006,2250,
++ 362,2673,341,1097,970,946,957,979,936,252,
++ 279,301,1819,2171,2680,2737,2723,2706,2693,177,
++ 147,134,161,542,2578,1155,584,2220,1276,1313,
++ 1300,1284,1266,1252,1017,2921,2935,35,1807,1028,
++ 1006,995,2266,892,874,919,1161,1474,1189,1203,
++ 440,574,1418,2857,1798,1062,2610,1707,424,352,
++ 1634,1562,2866,2559,2234,598,2625,2669,2912,372,
++ 614,289,2887,2522,2751,312,2759,2790,2774,2531,
++ 320,265,247,1540,905,1582,1666,1942,1745,382,
++ 396,1589,1390,1456,120,2641,2354,2196,1599,1616,
++ 15,475,
++};
++static const char *ia64_syscall_i2s(int v) {
++ return i2s_direct__(ia64_syscall_strings, ia64_syscall_i2s_direct, 1024, 1335, v);
++}
+diff --git a/lib/machinetabs.h b/lib/machinetabs.h
+new file mode 100644
+index 0000000..ec2d033
+--- /dev/null
++++ b/lib/machinetabs.h
+@@ -0,0 +1,26 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char machine_strings[] = "i386\0i486\0i586\0i686\0ia64\0ppc\0ppc64\0s390\0s390x\0x86_64";
++static const unsigned machine_s2i_s[] = {
++ 0,5,10,15,20,25,29,35,40,46,
++};
++static const int machine_s2i_i[] = {
++ 0,0,0,0,2,4,3,6,5,1,
++};
++static int machine_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(machine_strings, machine_s2i_s, machine_s2i_i, 10, copy, value);
++ }
++}
++static const unsigned machine_i2s_direct[] = {
++ 0,46,20,29,25,40,35,
++};
++static const char *machine_i2s(int v) {
++ return i2s_direct__(machine_strings, machine_i2s_direct, 0, 6, v);
++}
+diff --git a/lib/msg_typetabs.h b/lib/msg_typetabs.h
+new file mode 100644
+index 0000000..770ec21
+--- /dev/null
++++ b/lib/msg_typetabs.h
+@@ -0,0 +1,104 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char msg_type_strings[] = "ADD_GROUP\0ADD_USER\0ANOM_ABEND\0ANOM_ACCESS_FS\0ANOM_ADD_ACCT\0ANOM_AMTU_FAIL\0ANOM_CRYPTO_FAIL\0ANOM_DEL_ACCT\0ANOM_EXEC\0ANOM_LINK\0"
++ "ANOM_LOGIN_ACCT\0ANOM_LOGIN_FAILURES\0ANOM_LOGIN_LOCATION\0ANOM_LOGIN_SESSIONS\0ANOM_LOGIN_TIME\0ANOM_MAX_DAC\0ANOM_MAX_MAC\0ANOM_MK_EXEC\0ANOM_MOD_ACCT\0ANOM_PROMISCUOUS\0"
++ "ANOM_RBAC_FAIL\0ANOM_RBAC_INTEGRITY_FAIL\0ANOM_ROOT_TRANS\0AVC\0AVC_PATH\0BPRM_FCAPS\0CAPSET\0CHGRP_ID\0CHUSER_ID\0CONFIG_CHANGE\0"
++ "CRED_ACQ\0CRED_DISP\0CRED_REFR\0CRYPTO_FAILURE_USER\0CRYPTO_KEY_USER\0CRYPTO_LOGIN\0CRYPTO_LOGOUT\0CRYPTO_PARAM_CHANGE_USER\0CRYPTO_REPLAY_USER\0CRYPTO_SESSION\0"
++ "CRYPTO_TEST_USER\0CWD\0DAC_CHECK\0DAEMON_ABORT\0DAEMON_ACCEPT\0DAEMON_CLOSE\0DAEMON_CONFIG\0DAEMON_END\0DAEMON_RESUME\0DAEMON_ROTATE\0"
++ "DAEMON_START\0DEL_GROUP\0DEL_USER\0DEV_ALLOC\0DEV_DEALLOC\0EOE\0EXECVE\0FD_PAIR\0FS_RELABEL\0GRP_AUTH\0"
++ "INTEGRITY_DATA\0INTEGRITY_HASH\0INTEGRITY_METADATA\0INTEGRITY_PCR\0INTEGRITY_RULE\0INTEGRITY_STATUS\0IPC\0IPC_SET_PERM\0KERNEL\0KERNEL_OTHER\0"
++ "LABEL_LEVEL_CHANGE\0LABEL_OVERRIDE\0LIST_RULES\0LOGIN\0MAC_CIPSOV4_ADD\0MAC_CIPSOV4_DEL\0MAC_CONFIG_CHANGE\0MAC_IPSEC_ADDSA\0MAC_IPSEC_ADDSPD\0MAC_IPSEC_DELSA\0"
++ "MAC_IPSEC_DELSPD\0MAC_IPSEC_EVENT\0MAC_MAP_ADD\0MAC_MAP_DEL\0MAC_POLICY_LOAD\0MAC_STATUS\0MAC_UNLBL_ALLOW\0MAC_UNLBL_STCADD\0MAC_UNLBL_STCDEL\0MMAP\0"
++ "MQ_GETSETATTR\0MQ_NOTIFY\0MQ_OPEN\0MQ_SENDRECV\0NETFILTER_CFG\0NETFILTER_PKT\0OBJ_PID\0PATH\0RESP_ACCT_LOCK\0RESP_ACCT_LOCK_TIMED\0"
++ "RESP_ACCT_REMOTE\0RESP_ACCT_UNLOCK_TIMED\0RESP_ALERT\0RESP_ANOMALY\0RESP_EXEC\0RESP_HALT\0RESP_KILL_PROC\0RESP_SEBOOL\0RESP_SINGLE\0RESP_TERM_ACCESS\0"
++ "RESP_TERM_LOCK\0ROLE_ASSIGN\0ROLE_MODIFY\0ROLE_REMOVE\0SECCOMP\0SELINUX_ERR\0SERVICE_START\0SERVICE_STOP\0SOCKADDR\0SOCKETCALL\0"
++ "SYSCALL\0SYSTEM_BOOT\0SYSTEM_RUNLEVEL\0SYSTEM_SHUTDOWN\0TEST\0TRUSTED_APP\0TTY\0TTY_GET\0TTY_SET\0USER\0"
++ "USER_ACCT\0USER_AUTH\0USER_AVC\0USER_CHAUTHTOK\0USER_CMD\0USER_END\0USER_ERR\0USER_LABELED_EXPORT\0USER_LOGIN\0USER_LOGOUT\0"
++ "USER_MAC_POLICY_LOAD\0USER_MGMT\0USER_ROLE_CHANGE\0USER_SELINUX_ERR\0USER_START\0USER_TTY\0USER_UNLABELED_EXPORT\0USYS_CONFIG\0VIRT_CONTROL\0VIRT_MACHINE_ID\0"
++ "VIRT_RESOURCE";
++static const unsigned msg_type_s2i_s[] = {
++ 0,10,19,30,45,59,74,91,105,115,
++ 125,141,161,181,201,217,230,243,256,270,
++ 287,302,327,343,347,356,367,374,383,393,
++ 407,416,426,436,456,472,485,499,524,543,
++ 558,575,579,589,602,616,629,643,654,668,
++ 682,695,705,714,724,736,740,747,755,766,
++ 775,790,805,824,838,853,870,874,887,894,
++ 907,926,941,952,958,974,990,1008,1024,1041,
++ 1057,1074,1090,1102,1114,1130,1141,1157,1174,1191,
++ 1196,1210,1220,1228,1240,1254,1268,1276,1281,1296,
++ 1317,1334,1357,1368,1381,1391,1401,1416,1428,1440,
++ 1457,1472,1484,1496,1508,1516,1528,1542,1555,1564,
++ 1575,1583,1595,1611,1627,1632,1644,1648,1656,1664,
++ 1669,1679,1689,1698,1713,1722,1731,1740,1760,1771,
++ 1783,1804,1814,1831,1848,1859,1868,1890,1902,1915,
++ 1931,
++};
++static const int msg_type_s2i_i[] = {
++ 1116,1114,1701,2111,2114,2107,2110,2115,2112,1702,
++ 2103,2100,2104,2102,2101,2105,2106,2113,2116,1700,
++ 2108,2109,2117,1400,1402,1321,1322,1119,1125,1305,
++ 1103,1104,1110,2405,2404,2402,2403,2401,2406,2407,
++ 2400,1307,1118,1202,1207,1208,1203,1201,1206,1205,
++ 1200,1117,1115,2307,2308,1320,1309,1317,2309,1126,
++ 1800,1803,1801,1804,1805,1802,1303,1311,2000,1316,
++ 2304,2303,1013,1006,1407,1408,1405,1411,1413,1412,
++ 1414,1415,1409,1410,1403,1404,1406,1416,1417,1323,
++ 1315,1314,1312,1313,1325,1324,1318,1302,2207,2205,
++ 2204,2206,2201,2200,2210,2212,2202,2209,2211,2203,
++ 2208,2301,2311,2302,1326,1401,1130,1131,1306,1304,
++ 1300,1127,1129,1128,1120,1121,1319,1016,1017,1005,
++ 1101,1100,1107,1108,1123,1106,1109,2305,1112,1113,
++ 2310,1102,2300,1122,1105,1124,2306,1111,2500,2502,
++ 2501,
++};
++static int msg_type_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISLOWER(c) ? c - 'a' + 'A' : c;
++ }
++ copy[i] = 0;
++ return s2i__(msg_type_strings, msg_type_s2i_s, msg_type_s2i_i, 151, copy, value);
++ }
++}
++static const int msg_type_i2s_i[] = {
++ 1005,1006,1013,1016,1017,1100,1101,1102,1103,1104,
++ 1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,
++ 1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,
++ 1125,1126,1127,1128,1129,1130,1131,1200,1201,1202,
++ 1203,1205,1206,1207,1208,1300,1302,1303,1304,1305,
++ 1306,1307,1309,1311,1312,1313,1314,1315,1316,1317,
++ 1318,1319,1320,1321,1322,1323,1324,1325,1326,1400,
++ 1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,
++ 1411,1412,1413,1414,1415,1416,1417,1700,1701,1702,
++ 1800,1801,1802,1803,1804,1805,2000,2100,2101,2102,
++ 2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,
++ 2113,2114,2115,2116,2117,2200,2201,2202,2203,2204,
++ 2205,2206,2207,2208,2209,2210,2211,2212,2300,2301,
++ 2302,2303,2304,2305,2306,2307,2308,2309,2310,2311,
++ 2400,2401,2402,2403,2404,2405,2406,2407,2500,2501,
++ 2502,
++};
++static const unsigned msg_type_i2s_s[] = {
++ 1664,952,941,1648,1656,1679,1669,1804,407,416,
++ 1848,1722,1689,1698,1731,426,1890,1760,1771,10,
++ 705,0,695,579,374,1627,1632,1831,1713,1859,
++ 383,766,1583,1611,1595,1528,1542,682,643,589,
++ 629,668,654,602,616,1575,1276,870,1564,393,
++ 1555,575,740,874,1220,1228,1210,1196,894,747,
++ 1268,1644,736,356,367,1191,1254,1240,1508,343,
++ 1516,347,1114,1130,990,1141,958,974,1090,1102,
++ 1008,1041,1024,1057,1074,1157,1174,270,19,115,
++ 775,805,853,790,824,838,887,141,201,181,
++ 125,161,217,230,59,287,302,74,30,105,
++ 243,45,91,256,327,1368,1357,1401,1440,1317,
++ 1296,1334,1281,1457,1416,1381,1428,1391,1814,1472,
++ 1496,926,907,1740,1868,714,724,755,1783,1484,
++ 558,499,472,485,456,436,524,543,1902,1931,
++ 1915,
++};
++static const char *msg_type_i2s(int v) {
++ return i2s_bsearch__(msg_type_strings, msg_type_i2s_i, msg_type_i2s_s, 151, v);
++}
+diff --git a/lib/optabs.h b/lib/optabs.h
+new file mode 100644
+index 0000000..d79b665
+--- /dev/null
++++ b/lib/optabs.h
+@@ -0,0 +1,11 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char op_strings[] = "!=\0&\0&=\0<\0<=\0=\0>\0>=";
++static const int op_i2s_i[] = {
++ 134217728,268435456,536870912,805306368,1073741824,1207959552,1342177280,1610612736,
++};
++static const unsigned op_i2s_s[] = {
++ 3,8,15,0,13,5,10,17,
++};
++static const char *op_i2s(int v) {
++ return i2s_bsearch__(op_strings, op_i2s_i, op_i2s_s, 8, v);
++}
+diff --git a/lib/ppc_tables.h b/lib/ppc_tables.h
+new file mode 100644
+index 0000000..778fae3
+--- /dev/null
++++ b/lib/ppc_tables.h
+@@ -0,0 +1,163 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char ppc_syscall_strings[] = "_llseek\0_newselect\0_sysctl\0accept\0accept4\0access\0acct\0add_key\0adjtimex\0afs_syscall\0"
++ "alarm\0bdflush\0bind\0break\0brk\0capget\0capset\0chdir\0chmod\0chown\0"
++ "chroot\0clock_adjtime\0clock_getres\0clock_gettime\0clock_nanosleep\0clock_settime\0clone\0close\0connect\0creat\0"
++ "create_module\0delete_module\0dup\0dup2\0dup3\0epoll_create\0epoll_create1\0epoll_ctl\0epoll_pwait\0epoll_wait\0"
++ "eventfd\0eventfd2\0execve\0exit\0exit_group\0faccessat\0fadvise64\0fadvise64_64\0fallocate\0fanotify_init\0"
++ "fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0fchownat\0fcntl\0fcntl64\0fdatasync\0fgetxattr\0"
++ "finit_module\0flistxattr\0flock\0fork\0fremovexattr\0fsetxattr\0fstat\0fstat64\0fstatat\0fstatfs\0"
++ "fstatfs64\0fsync\0ftime\0ftruncate\0ftruncate64\0futex\0futimesat\0get_kernel_syms\0get_robust_list\0getcpu\0"
++ "getcwd\0getdents\0getdents64\0getegid\0geteuid\0getgid\0getgroups\0getitimer\0getpeername\0getpgid\0"
++ "getpgrp\0getpid\0getpmsg\0getppid\0getpriority\0getresgid\0getresuid\0getrlimit\0getrusage\0getsid\0"
++ "getsockname\0getsockopt\0gettid\0gettimeofday\0getuid\0getxattr\0gtty\0idle\0init_module\0inotify_add_watch\0"
++ "inotify_init\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0ioctl\0ioperm\0"
++ "iopl\0ioprio_get\0ioprio_set\0ipc\0kcmp\0kexec_load\0keyctl\0kill\0lchown\0lgetxattr\0"
++ "link\0linkat\0listen\0listxattr\0llistxattr\0lock\0lookup_dcookie\0lremovexattr\0lseek\0lsetxattr\0"
++ "lstat\0lstat64\0madvise\0mincore\0mkdir\0mkdirat\0mknod\0mknodat\0mlock\0mlockall\0"
++ "mmap\0mmap2\0modify_ldt\0mount\0move_pages\0mprotect\0mpx\0mq_getsetattr\0mq_notify\0mq_open\0"
++ "mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msync\0multiplexer\0munlock\0munlockall\0munmap\0name_to_handle_at\0"
++ "nanosleep\0nfsservctl\0nice\0oldfstat\0oldlstat\0oldolduname\0oldstat\0olduname\0open\0open_by_handle_at\0"
++ "openat\0pause\0pciconfig_iobase\0pciconfig_read\0pciconfig_write\0perf_counter_open\0personality\0pipe\0pipe2\0pivot_root\0"
++ "poll\0ppoll\0prctl\0pread\0preadv\0prlimit64\0process_vm_readv\0process_vm_writev\0prof\0profil\0"
++ "pselect6\0ptrace\0putpmsg\0pwrite\0pwritev\0query_module\0quotactl\0read\0readahead\0readdir\0"
++ "readlink\0readlinkat\0readv\0reboot\0recv\0recvfrom\0recvmmsg\0recvmsg\0remap_file_pages\0removexattr\0"
++ "rename\0renameat\0request_key\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0"
++ "rt_sigtimedwait\0rt_tgsigqueueinfo\0rtas\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0"
++ "sched_setparam\0sched_setscheduler\0sched_yield\0select\0send\0sendfile\0sendfile64\0sendmmsg\0sendmsg\0sendto\0"
++ "set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsuid\0setgid\0setgroups\0sethostname\0setitimer\0setns\0"
++ "setpgid\0setpriority\0setregid\0setresgid\0setresuid\0setreuid\0setrlimit\0setsid\0setsockopt\0settimeofday\0"
++ "setuid\0setxattr\0sgetmask\0shutdown\0sigaction\0sigaltstack\0signal\0signalfd\0signalfd4\0sigpending\0"
++ "sigprocmask\0sigreturn\0sigsuspend\0socket\0socketcall\0socketpair\0splice\0spu_create\0spu_run\0ssetmask\0"
++ "stat\0stat64\0statfs\0statfs64\0stime\0stty\0subpage_prot\0swapcontext\0swapoff\0swapon\0"
++ "symlink\0symlinkat\0sync\0sync_file_range2\0syncfs\0sysfs\0sysinfo\0syslog\0tee\0tgkill\0"
++ "time\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd\0timerfd_gettime\0timerfd_settime\0times\0"
++ "tkill\0truncate\0truncate64\0tuxcall\0ugetrlimit\0ulimit\0umask\0umount\0umount2\0uname\0"
++ "unlink\0unlinkat\0unshare\0uselib\0ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0"
++ "vm86\0vmsplice\0wait4\0waitid\0waitpid\0write\0writev";
++static const unsigned ppc_syscall_s2i_s[] = {
++ 0,8,19,27,34,42,49,54,62,71,
++ 83,89,97,102,108,112,119,126,132,138,
++ 144,151,165,178,192,208,222,228,234,242,
++ 248,262,276,280,285,290,303,317,327,339,
++ 350,358,367,374,379,390,400,410,423,433,
++ 447,461,468,475,484,491,500,506,514,524,
++ 534,547,558,564,569,582,592,598,606,614,
++ 622,632,638,644,654,666,672,682,698,714,
++ 721,728,737,748,756,764,771,781,791,803,
++ 811,819,826,834,842,854,864,874,884,894,
++ 901,913,924,931,944,951,960,965,970,982,
++ 1000,1013,1027,1044,1054,1065,1078,1087,1097,1103,
++ 1110,1115,1126,1137,1141,1146,1157,1164,1169,1176,
++ 1186,1191,1198,1205,1215,1226,1231,1246,1259,1265,
++ 1275,1281,1289,1297,1305,1311,1319,1325,1333,1339,
++ 1348,1353,1359,1370,1376,1387,1396,1400,1414,1424,
++ 1432,1448,1461,1471,1478,1484,1496,1504,1515,1522,
++ 1540,1550,1561,1566,1575,1584,1596,1604,1613,1618,
++ 1636,1643,1649,1666,1681,1697,1715,1727,1732,1738,
++ 1749,1754,1760,1766,1772,1779,1789,1806,1824,1829,
++ 1836,1845,1852,1860,1867,1875,1888,1897,1902,1912,
++ 1920,1929,1940,1946,1953,1958,1967,1976,1984,2001,
++ 2013,2020,2029,2041,2047,2060,2074,2089,2105,2118,
++ 2132,2148,2166,2171,2194,2217,2235,2250,2269,2291,
++ 2309,2324,2343,2355,2362,2367,2376,2387,2396,2404,
++ 2411,2427,2443,2457,2466,2475,2482,2492,2504,2514,
++ 2520,2528,2540,2549,2559,2569,2578,2588,2595,2606,
++ 2619,2626,2635,2644,2653,2663,2675,2682,2691,2701,
++ 2712,2724,2734,2745,2752,2763,2774,2781,2792,2800,
++ 2809,2814,2821,2828,2837,2843,2848,2861,2873,2881,
++ 2888,2896,2906,2911,2928,2935,2941,2949,2956,2960,
++ 2967,2972,2985,2998,3015,3029,3043,3051,3067,3083,
++ 3089,3095,3104,3115,3123,3134,3141,3147,3154,3162,
++ 3168,3175,3184,3192,3199,3205,3211,3221,3228,3234,
++ 3242,3247,3256,3262,3269,3277,3283,
++};
++static const int ppc_syscall_s2i_i[] = {
++ 140,142,149,330,344,33,51,269,124,137,
++ 27,134,327,17,45,183,184,12,15,181,
++ 61,347,247,246,248,245,120,6,328,8,
++ 127,129,41,63,316,236,315,237,303,238,
++ 307,314,11,1,234,298,233,254,309,323,
++ 324,133,94,297,95,289,55,204,148,214,
++ 353,217,143,2,220,211,108,197,291,100,
++ 253,118,35,93,194,221,290,130,299,302,
++ 182,141,202,50,49,47,80,105,332,132,
++ 65,20,187,64,96,170,165,76,77,147,
++ 331,340,207,78,24,212,32,112,128,276,
++ 275,318,277,231,228,229,227,230,54,101,
++ 110,274,273,117,354,268,271,37,16,213,
++ 9,294,329,215,216,53,235,219,19,210,
++ 107,196,205,206,39,287,14,288,150,152,
++ 90,192,123,21,301,125,56,267,266,262,
++ 265,264,263,163,144,201,151,153,91,345,
++ 162,168,34,28,84,59,18,109,5,346,
++ 286,29,200,198,199,319,136,42,317,203,
++ 167,281,171,179,320,325,351,352,44,98,
++ 280,26,188,180,321,166,131,3,191,89,
++ 85,296,145,88,336,337,343,342,239,218,
++ 38,293,270,40,173,175,174,177,172,178,
++ 176,322,255,159,160,223,155,157,161,222,
++ 154,156,158,82,334,186,226,349,341,335,
++ 300,232,121,139,138,46,81,74,104,350,
++ 57,97,71,169,164,70,75,66,339,79,
++ 23,209,68,338,67,185,48,305,313,73,
++ 126,119,72,326,102,333,283,279,278,69,
++ 106,195,99,252,25,31,310,249,115,87,
++ 83,295,36,308,348,135,116,103,284,250,
++ 13,240,244,243,242,241,306,312,311,43,
++ 208,92,193,225,190,58,60,22,52,122,
++ 10,292,282,86,62,30,304,251,189,111,
++ 113,285,114,272,7,4,146,
++};
++static int ppc_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(ppc_syscall_strings, ppc_syscall_s2i_s, ppc_syscall_s2i_i, 347, copy, value);
++ }
++}
++static const unsigned ppc_syscall_i2s_direct[] = {
++ 374,564,1897,3277,1613,228,3269,242,1186,3168,
++ 367,126,2967,1319,132,1169,102,1596,1259,819,
++ 1370,3147,2619,944,2837,1845,83,1566,1643,3205,
++ 2843,960,42,1561,638,2906,1164,2013,1305,2041,
++ 276,1727,3083,1824,108,2475,764,2675,756,748,
++ 49,3154,1226,1097,500,1396,2520,3134,1584,3141,
++ 144,3199,280,834,811,2588,2653,2635,2800,2569,
++ 2540,2734,2701,2492,2578,874,884,931,2606,771,
++ 2482,2355,2888,1575,1920,3192,2881,1946,1912,1348,
++ 1515,3095,644,468,484,842,2528,1829,2821,614,
++ 1103,2752,2949,2504,781,2809,1275,592,1604,1110,
++ 3234,965,3242,3256,2873,2941,1137,632,2724,222,
++ 2443,3162,1359,62,1387,2712,248,970,262,682,
++ 1888,803,461,89,2935,1715,71,2466,2457,0,
++ 728,8,558,1478,1940,3283,894,514,19,1333,
++ 1496,1339,1504,2309,2235,2324,2250,2343,2171,2194,
++ 2269,1540,1471,2559,864,1875,1749,1550,2549,854,
++ 1760,2105,2047,2074,2060,2132,2089,2118,1766,1860,
++ 138,721,112,119,2663,2367,826,1852,3228,3123,
++ 1902,1353,3104,654,2814,1281,598,1666,1681,1649,
++ 1484,737,1738,506,1289,1297,924,3089,2626,1265,
++ 582,951,1176,524,1205,1215,547,2001,1246,569,
++ 666,2291,2217,-1u,3115,2376,1078,1054,1065,1087,
++ 1044,2427,400,379,1231,290,317,339,1984,2972,
++ 3029,3015,2998,2985,208,178,165,192,2861,2960,
++ 3221,2828,622,410,2166,-1u,-1u,-1u,-1u,-1u,
++ -1u,1424,1461,1448,1432,1414,1400,1146,54,2029,
++ 1157,3262,1126,1115,1000,982,1027,2792,2781,1836,
++ 1754,3184,2774,2956,3247,1636,1311,1325,491,672,
++ 606,3175,2020,1191,2896,1929,475,390,698,2411,
++ 1376,714,327,3211,2682,3043,350,2911,423,2848,
++ 3067,3051,2691,358,303,285,1732,1013,1697,1772,
++ 1867,2148,433,447,1779,2745,97,234,1198,27,
++ 901,791,2763,2362,2404,1953,1958,2644,2595,913,
++ 2396,1976,1967,34,1522,1618,151,2928,2387,2514,
++ 1789,1806,534,1141,
++};
++static const char *ppc_syscall_i2s(int v) {
++ return i2s_direct__(ppc_syscall_strings, ppc_syscall_i2s_direct, 1, 354, v);
++}
+diff --git a/lib/s390_tables.h b/lib/s390_tables.h
+new file mode 100644
+index 0000000..218482e
+--- /dev/null
++++ b/lib/s390_tables.h
+@@ -0,0 +1,153 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char s390_syscall_strings[] = "_llseek\0_newselect\0_sysctl\0access\0acct\0add_key\0adjtimex\0afs_syscall\0alarm\0bdflush\0"
++ "brk\0capget\0capset\0chdir\0chmod\0chown\0chown32\0chroot\0clock_adjtime\0clock_getres\0"
++ "clock_gettime\0clock_nanosleep\0clock_settime\0clone\0close\0creat\0create_module\0delete_module\0dup\0dup2\0"
++ "dup3\0epoll_create\0epoll_create1\0epoll_ctl\0epoll_pwait\0epoll_wait\0eventfd\0eventfd2\0execve\0exit\0"
++ "exit_group\0faccessat\0fadvise64\0fadvise64_64\0fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0"
++ "fchown\0fchown32\0fchownat\0fcntl\0fcntl64\0fdatasync\0fgetxattr\0finit_module\0flistxattr\0flock\0"
++ "fork\0fremovexattr\0fsetxattr\0fstat\0fstat64\0fstatat\0fstatfs\0fstatfs64\0fsync\0ftruncate\0"
++ "ftruncate64\0futex\0futimesat\0get_kernel_syms\0get_robust_list\0getcpu\0getcwd\0getdents\0getdents64\0getegid\0"
++ "getegid32\0geteuid\0geteuid32\0getgid\0getgid32\0getgroups\0getgroups32\0getitimer\0getpgid\0getpgrp\0"
++ "getpid\0getpmsg\0getppid\0getpriority\0getresgid\0getresgid32\0getresuid\0getresuid32\0getrlimit\0getrusage\0"
++ "getsid\0gettid\0gettimeofday\0getuid\0getuid32\0getxattr\0idle\0init_module\0inotify_add_watch\0inotify_init\0"
++ "inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0ioctl\0ioperm\0ioprio_get\0"
++ "ioprio_set\0ipc\0kcmp\0kexec_load\0keyctl\0kill\0lchown\0lchown32\0lgetxattr\0link\0"
++ "linkat\0listxattr\0llistxattr\0lremovexattr\0lseek\0lsetxattr\0lstat\0lstat64\0madvise\0mincore\0"
++ "mkdir\0mkdirat\0mknod\0mknodat\0mlock\0mlockall\0mmap\0mmap2\0mount\0mprotect\0"
++ "mq_getsetattr\0mq_notify\0mq_open\0mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msync\0munlock\0munlockall\0"
++ "munmap\0name_to_handle_at\0nanosleep\0nfsservctl\0nice\0open\0open_by_handle_at\0openat\0pause\0perf_event_open\0"
++ "personality\0pipe\0pipe2\0pivot_root\0poll\0ppoll\0prctl\0pread\0preadv\0prlimit64\0"
++ "process_vm_readv\0process_vm_writev\0pselect6\0ptrace\0putpmsg\0pwrite\0pwritev\0query_module\0quotactl\0read\0"
++ "readahead\0readdir\0readlink\0readlinkat\0readv\0reboot\0remap_file_pages\0removexattr\0rename\0renameat\0"
++ "request_key\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0rt_tgsigqueueinfo\0"
++ "s390_runtime_instr\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0"
++ "sched_yield\0sendfile\0sendfile64\0set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsgid32\0setfsuid\0setfsuid32\0"
++ "setgid\0setgid32\0setgroups\0setgroups32\0sethostname\0setitimer\0setns\0setpgid\0setpriority\0setregid\0"
++ "setregid32\0setresgid\0setresgid32\0setresuid\0setresuid32\0setreuid\0setreuid32\0setrlimit\0setsid\0settimeofday\0"
++ "setuid\0setuid32\0setxattr\0sigaction\0sigaltstack\0signal\0signalfd\0signalfd4\0sigpending\0sigprocmask\0"
++ "sigreturn\0sigsuspend\0socketcall\0splice\0stat\0stat64\0statfs\0statfs64\0stime\0swapoff\0"
++ "swapon\0symlink\0symlinkat\0sync\0sync_file_range\0syncfs\0sysfs\0sysinfo\0syslog\0tee\0"
++ "tgkill\0time\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd\0timerfd_create\0timerfd_gettime\0"
++ "timerfd_settime\0times\0tkill\0truncate\0truncate64\0ugetrlimit\0umask\0umount\0umount2\0uname\0"
++ "unlink\0unlinkat\0unshare\0uselib\0ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0"
++ "vmsplice\0wait4\0waitid\0write\0writev";
++static const unsigned s390_syscall_s2i_s[] = {
++ 0,8,19,27,34,39,47,56,68,74,
++ 82,86,93,100,106,112,118,126,133,147,
++ 160,174,190,204,210,216,222,236,250,254,
++ 259,264,277,291,301,313,324,332,341,348,
++ 353,364,374,384,397,407,421,435,442,449,
++ 458,465,474,483,489,497,507,517,530,541,
++ 547,552,565,575,581,589,597,605,615,621,
++ 631,643,649,659,675,691,698,705,714,725,
++ 733,743,751,761,768,777,787,799,809,817,
++ 825,832,840,848,860,870,882,892,904,914,
++ 924,931,938,951,958,967,976,981,993,1011,
++ 1024,1038,1055,1065,1076,1089,1098,1108,1114,1121,
++ 1132,1143,1147,1152,1163,1170,1175,1182,1191,1201,
++ 1206,1213,1223,1234,1247,1253,1263,1269,1277,1285,
++ 1293,1299,1307,1313,1321,1327,1336,1341,1347,1353,
++ 1362,1376,1386,1394,1410,1423,1433,1440,1446,1454,
++ 1465,1472,1490,1500,1511,1516,1521,1539,1546,1552,
++ 1568,1580,1585,1591,1602,1607,1613,1619,1625,1632,
++ 1642,1659,1677,1686,1693,1701,1708,1716,1729,1738,
++ 1743,1753,1761,1770,1781,1787,1794,1811,1823,1830,
++ 1839,1851,1857,1870,1884,1899,1915,1928,1942,1958,
++ 1976,1995,2018,2041,2059,2074,2093,2115,2133,2148,
++ 2167,2179,2188,2199,2215,2231,2245,2254,2265,2274,
++ 2285,2292,2301,2311,2323,2335,2345,2351,2359,2371,
++ 2380,2391,2401,2413,2423,2435,2444,2455,2465,2472,
++ 2485,2492,2501,2510,2520,2532,2539,2548,2558,2569,
++ 2581,2591,2602,2613,2620,2625,2632,2639,2648,2654,
++ 2662,2669,2677,2687,2692,2708,2715,2721,2729,2736,
++ 2740,2747,2752,2765,2778,2795,2809,2823,2831,2846,
++ 2862,2878,2884,2890,2899,2910,2921,2927,2934,2942,
++ 2948,2955,2964,2972,2979,2985,2991,3001,3008,3014,
++ 3022,3031,3037,3044,3050,
++};
++static const int s390_syscall_s2i_i[] = {
++ 140,142,149,33,51,278,124,137,27,134,
++ 45,184,185,12,15,182,212,61,337,261,
++ 260,262,259,120,6,8,127,129,41,63,
++ 326,249,327,250,312,251,318,323,11,1,
++ 248,300,253,264,314,332,333,133,94,299,
++ 95,207,291,55,221,148,229,344,232,143,
++ 2,235,226,108,197,293,100,266,118,93,
++ 194,238,292,130,305,311,183,141,220,50,
++ 202,49,201,47,200,80,205,105,132,65,
++ 20,188,64,96,171,211,165,209,76,77,
++ 147,236,78,24,199,227,112,128,285,284,
++ 324,286,247,244,245,243,246,54,101,283,
++ 282,117,343,277,280,37,16,198,228,9,
++ 296,230,231,234,19,225,107,196,219,218,
++ 39,289,14,290,150,152,90,192,21,125,
++ 276,275,271,274,273,272,163,144,151,153,
++ 91,335,162,169,34,5,336,288,29,331,
++ 136,42,325,217,168,302,172,180,328,334,
++ 340,341,301,26,189,181,329,167,131,3,
++ 222,89,85,298,145,88,267,233,38,295,
++ 279,40,174,176,175,178,173,179,177,330,
++ 342,159,160,240,155,157,161,239,154,156,
++ 158,187,223,304,252,121,139,216,138,215,
++ 46,214,81,206,74,104,339,57,97,71,
++ 204,170,210,164,208,70,203,75,66,79,
++ 23,213,224,67,186,48,316,322,73,126,
++ 119,72,102,306,106,195,99,265,25,115,
++ 87,83,297,36,307,338,135,116,103,308,
++ 241,13,254,258,257,256,255,317,319,321,
++ 320,43,237,92,193,191,60,22,52,122,
++ 10,294,303,86,62,30,315,313,190,111,
++ 309,114,281,4,146,
++};
++static int s390_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(s390_syscall_strings, s390_syscall_s2i_s, s390_syscall_s2i_i, 315, copy, value);
++ }
++}
++static const unsigned s390_syscall_i2s_direct[] = {
++ 348,547,1738,3044,1516,210,-1u,216,1201,2948,
++ 341,100,2747,1307,106,1175,-1u,-1u,1247,825,
++ 1347,2927,2485,951,2648,1686,68,-1u,1546,2985,
++ -1u,-1u,27,1511,-1u,2687,1170,1823,1293,1851,
++ 250,1580,2878,-1u,82,2285,761,2532,743,725,
++ 34,2934,-1u,1108,483,-1u,2351,-1u,-1u,2921,
++ 126,2979,254,840,817,2465,2510,-1u,-1u,2435,
++ 2371,2591,2558,2323,2455,904,914,938,2472,777,
++ 2301,-1u,2669,-1u,1761,2972,2662,1787,1753,1336,
++ 1465,2890,621,442,458,848,2359,-1u,2632,597,
++ 1114,2602,2729,2335,799,2620,1263,575,-1u,-1u,
++ 3014,976,-1u,3031,2654,2721,1143,615,2581,204,
++ 2231,2942,-1u,47,1353,2569,222,981,236,659,
++ 1729,809,435,74,2715,1568,56,2265,2245,0,
++ 705,8,541,1440,1781,3050,924,497,19,1321,
++ 1446,1327,1454,2133,2059,2148,2074,2167,1995,2018,
++ 2093,1490,1433,2413,882,-1u,1716,1602,1500,2391,
++ 860,1613,1915,1857,1884,1870,1942,1899,1928,1619,
++ 1701,112,698,86,93,2520,2179,832,1693,3008,
++ 2910,1341,2899,631,2625,1269,581,1182,958,768,
++ 751,733,2444,2380,787,2311,465,2423,892,2401,
++ 870,118,2492,2292,2274,2254,1591,1285,1277,714,
++ 489,1743,2188,2501,1253,565,967,1191,507,1213,
++ 1223,530,1811,1234,552,931,2884,643,2115,2041,
++ 2740,-1u,1089,1065,1076,1098,1055,353,264,291,
++ 313,2215,374,2752,2809,2795,2778,2765,190,160,
++ 147,174,-1u,384,2639,605,1794,-1u,-1u,-1u,
++ 1386,1423,1410,1394,1376,1362,1152,39,1839,1163,
++ 3037,1132,1121,1011,993,1038,-1u,1539,1299,1313,
++ 474,649,589,2955,1830,1206,2677,1770,449,364,
++ 1677,1607,2964,2199,675,2613,2692,2736,3022,-1u,
++ 691,301,3001,397,2991,2539,2823,324,2831,2862,
++ 2846,2548,332,1024,1585,259,277,1625,1708,1958,
++ 1552,407,421,1632,1472,1521,133,2708,2345,1642,
++ 1659,1976,1147,517,
++};
++static const char *s390_syscall_i2s(int v) {
++ return i2s_direct__(s390_syscall_strings, s390_syscall_i2s_direct, 1, 344, v);
++}
+diff --git a/lib/s390x_tables.h b/lib/s390x_tables.h
+new file mode 100644
+index 0000000..36099fc
+--- /dev/null
++++ b/lib/s390x_tables.h
+@@ -0,0 +1,144 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char s390x_syscall_strings[] = "_sysctl\0access\0acct\0add_key\0adjtimex\0afs_syscall\0alarm\0bdflush\0brk\0capget\0"
++ "capset\0chdir\0chmod\0chown\0chroot\0clock_adjtime\0clock_getres\0clock_gettime\0clock_nanosleep\0clock_settime\0"
++ "clone\0close\0creat\0create_module\0delete_module\0dup\0dup2\0dup3\0epoll_create\0epoll_create1\0"
++ "epoll_ctl\0epoll_pwait\0epoll_wait\0eventfd\0eventfd2\0execve\0exit\0exit_group\0faccessat\0fadvise64\0"
++ "fallocate\0fanotify_init\0fanotify_mark\0fchdir\0fchmod\0fchmodat\0fchown\0fchownat\0fcntl\0fdatasync\0"
++ "fgetxattr\0finit_module\0flistxattr\0flock\0fork\0fremovexattr\0fsetxattr\0fstat\0fstatfs\0fstatfs64\0"
++ "fsync\0ftruncate\0futex\0futimesat\0get_kernel_syms\0get_robust_list\0getcpu\0getcwd\0getdents\0getegid\0"
++ "geteuid\0getgid\0getgroups\0getitimer\0getpgid\0getpgrp\0getpid\0getpmsg\0getppid\0getpriority\0"
++ "getresgid\0getresuid\0getrlimit\0getrusage\0getsid\0gettid\0gettimeofday\0getuid\0getxattr\0idle\0"
++ "init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0"
++ "ioctl\0ioprio_get\0ioprio_set\0ipc\0kcmp\0kexec_load\0keyctl\0kill\0lchown\0lgetxattr\0"
++ "link\0linkat\0listxattr\0llistxattr\0lremovexattr\0lseek\0lsetxattr\0lstat\0madvise\0mincore\0"
++ "mkdir\0mkdirat\0mknod\0mknodat\0mlock\0mlockall\0mmap\0mount\0mprotect\0mq_getsetattr\0"
++ "mq_notify\0mq_open\0mq_timedreceive\0mq_timedsend\0mq_unlink\0mremap\0msync\0munlock\0munlockall\0munmap\0"
++ "name_to_handle_at\0nanosleep\0newfstatat\0nfsservctl\0nice\0open\0open_by_handle_at\0openat\0pause\0perf_event_open\0"
++ "personality\0pipe\0pipe2\0pivot_root\0poll\0ppoll\0prctl\0pread\0preadv\0prlimit64\0"
++ "process_vm_readv\0process_vm_writev\0pselect6\0ptrace\0putpmsg\0pwrite\0pwritev\0query_module\0quotactl\0read\0"
++ "readahead\0readdir\0readlink\0readlinkat\0readv\0reboot\0remap_file_pages\0removexattr\0rename\0renameat\0"
++ "request_key\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0rt_sigsuspend\0rt_sigtimedwait\0rt_tgsigqueueinfo\0"
++ "s390_runtime_instr\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0sched_setparam\0sched_setscheduler\0"
++ "sched_yield\0select\0sendfile\0set_robust_list\0set_tid_address\0setdomainname\0setfsgid\0setfsuid\0setgid\0setgroups\0"
++ "sethostname\0setitimer\0setns\0setpgid\0setpriority\0setregid\0setresgid\0setresuid\0setreuid\0setrlimit\0"
++ "setsid\0settimeofday\0setuid\0setxattr\0sigaction\0sigaltstack\0signal\0signalfd\0signalfd4\0sigpending\0"
++ "sigprocmask\0sigreturn\0sigsuspend\0socketcall\0splice\0stat\0statfs\0statfs64\0swapoff\0swapon\0"
++ "symlink\0symlinkat\0sync\0sync_file_range\0syncfs\0sysfs\0sysinfo\0syslog\0tee\0tgkill\0"
++ "timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd\0timerfd_create\0timerfd_gettime\0timerfd_settime\0times\0"
++ "tkill\0truncate\0umask\0umount\0umount2\0uname\0unlink\0unlinkat\0unshare\0uselib\0"
++ "ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0vmsplice\0wait4\0waitid\0write\0"
++ "writev";
++static const unsigned s390x_syscall_s2i_s[] = {
++ 0,8,15,20,28,37,49,55,63,67,
++ 74,81,87,93,99,106,120,133,147,163,
++ 177,183,189,195,209,223,227,232,237,250,
++ 264,274,286,297,305,314,321,326,337,347,
++ 357,367,381,395,402,409,418,425,434,440,
++ 450,460,473,484,490,495,508,518,524,532,
++ 542,548,558,564,574,590,606,613,620,629,
++ 637,645,652,662,672,680,688,695,703,711,
++ 723,733,743,753,763,770,777,790,797,806,
++ 811,823,841,854,868,885,895,906,919,928,
++ 938,944,955,966,970,975,986,993,998,1005,
++ 1015,1020,1027,1037,1048,1061,1067,1077,1083,1091,
++ 1099,1105,1113,1119,1127,1133,1142,1147,1153,1162,
++ 1176,1186,1194,1210,1223,1233,1240,1246,1254,1265,
++ 1272,1290,1300,1311,1322,1327,1332,1350,1357,1363,
++ 1379,1391,1396,1402,1413,1418,1424,1430,1436,1443,
++ 1453,1470,1488,1497,1504,1512,1519,1527,1540,1549,
++ 1554,1564,1572,1581,1592,1598,1605,1622,1634,1641,
++ 1650,1662,1668,1681,1695,1710,1726,1739,1753,1769,
++ 1787,1806,1829,1852,1870,1885,1904,1926,1944,1959,
++ 1978,1990,1997,2006,2022,2038,2052,2061,2070,2077,
++ 2087,2099,2109,2115,2123,2135,2144,2154,2164,2173,
++ 2183,2190,2203,2210,2219,2229,2241,2248,2257,2267,
++ 2278,2290,2300,2311,2322,2329,2334,2341,2350,2358,
++ 2365,2373,2383,2388,2404,2411,2417,2425,2432,2436,
++ 2443,2456,2469,2486,2500,2514,2522,2537,2553,2569,
++ 2575,2581,2590,2596,2603,2611,2617,2624,2633,2641,
++ 2648,2654,2660,2670,2677,2683,2691,2700,2706,2713,
++ 2719,
++};
++static const int s390x_syscall_s2i_i[] = {
++ 149,33,51,278,124,137,27,134,45,184,
++ 185,12,15,212,61,337,261,260,262,259,
++ 120,6,8,127,129,41,63,326,249,327,
++ 250,312,251,318,323,11,1,248,300,253,
++ 314,332,333,133,94,299,207,291,55,148,
++ 229,344,232,143,2,235,226,108,100,266,
++ 118,93,238,292,130,305,311,183,141,202,
++ 201,200,205,105,132,65,20,188,64,96,
++ 211,209,191,77,147,236,78,199,227,112,
++ 128,285,284,324,286,247,244,245,243,246,
++ 54,283,282,117,343,277,280,37,198,228,
++ 9,296,230,231,234,19,225,107,219,218,
++ 39,289,14,290,150,152,90,21,125,276,
++ 275,271,274,273,272,163,144,151,153,91,
++ 335,162,293,169,34,5,336,288,29,331,
++ 136,42,325,217,168,302,172,180,328,334,
++ 340,341,301,26,189,181,329,167,131,3,
++ 222,89,85,298,145,88,267,233,38,295,
++ 279,40,174,176,175,178,173,179,177,330,
++ 342,159,160,240,155,157,161,239,154,156,
++ 158,142,187,304,252,121,216,215,214,206,
++ 74,104,339,57,97,204,210,208,203,75,
++ 66,79,213,224,67,186,48,316,322,73,
++ 126,119,72,102,306,106,99,265,115,87,
++ 83,297,36,307,338,135,116,103,308,241,
++ 254,258,257,256,255,317,319,321,320,43,
++ 237,92,60,22,52,122,10,294,303,86,
++ 62,30,315,313,190,111,309,114,281,4,
++ 146,
++};
++static int s390x_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(s390x_syscall_strings, s390x_syscall_s2i_s, s390x_syscall_s2i_i, 281, copy, value);
++ }
++}
++static const unsigned s390x_syscall_i2s_direct[] = {
++ 321,490,1549,2713,1327,183,-1u,189,1015,2617,
++ 314,81,-1u,1113,87,-1u,-1u,-1u,1061,688,
++ 1147,2596,-1u,-1u,-1u,1497,49,-1u,1357,2654,
++ -1u,-1u,8,1322,-1u,2383,993,1634,1099,1662,
++ 223,1391,2569,-1u,63,-1u,-1u,2241,-1u,-1u,
++ 15,2603,-1u,938,434,-1u,2115,-1u,-1u,2590,
++ 99,2648,227,703,680,2183,2219,-1u,-1u,-1u,
++ -1u,2300,2267,2087,2173,-1u,753,777,2190,-1u,
++ -1u,-1u,2365,-1u,1572,2641,2358,1598,1564,1142,
++ 1265,2581,548,402,-1u,711,2123,-1u,2334,524,
++ -1u,2311,2425,2099,662,2329,1077,518,-1u,-1u,
++ 2683,806,-1u,2700,2350,2417,966,542,2290,177,
++ 2038,2611,-1u,28,1153,2278,195,811,209,574,
++ 1540,672,395,55,2411,1379,37,-1u,-1u,-1u,
++ 620,1990,484,1240,1592,2719,763,440,0,1127,
++ 1246,1133,1254,1944,1870,1959,1885,1978,1806,1829,
++ 1904,1290,1233,-1u,-1u,-1u,1527,1413,1311,-1u,
++ -1u,1424,1726,1668,1695,1681,1753,1710,1739,1430,
++ 1512,-1u,613,67,74,2229,1997,695,1504,2677,
++ 743,-1u,-1u,-1u,-1u,-1u,-1u,998,790,645,
++ 637,629,2164,2135,652,2077,418,2154,733,2144,
++ 723,93,2203,2070,2061,2052,1402,1091,1083,-1u,
++ -1u,1554,-1u,2210,1067,508,797,1005,450,1027,
++ 1037,473,1622,1048,495,770,2575,558,1926,1852,
++ 2436,-1u,919,895,906,928,885,326,237,264,
++ 286,2022,347,2443,2500,2486,2469,2456,163,133,
++ 120,147,-1u,-1u,2341,532,1605,-1u,-1u,-1u,
++ 1186,1223,1210,1194,1176,1162,975,20,1650,986,
++ 2706,955,944,841,823,868,-1u,1350,1105,1119,
++ 425,564,1300,2624,1641,1020,2373,1581,409,337,
++ 1488,1418,2633,2006,590,2322,2388,2432,2691,-1u,
++ 606,274,2670,357,2660,2248,2514,297,2522,2553,
++ 2537,2257,305,854,1396,232,250,1436,1519,1769,
++ 1363,367,381,1443,1272,1332,106,2404,2109,1453,
++ 1470,1787,970,460,
++};
++static const char *s390x_syscall_i2s(int v) {
++ return i2s_direct__(s390x_syscall_strings, s390x_syscall_i2s_direct, 1, 344, v);
++}
+diff --git a/lib/x86_64_tables.h b/lib/x86_64_tables.h
+new file mode 100644
+index 0000000..d2a5673
+--- /dev/null
++++ b/lib/x86_64_tables.h
+@@ -0,0 +1,150 @@
++/* This is a generated file, see Makefile.am for its inputs. */
++static const char x86_64_syscall_strings[] = "_sysctl\0accept\0accept4\0access\0acct\0add_key\0adjtimex\0afs_syscall\0alarm\0arch_prctl\0"
++ "bind\0brk\0capget\0capset\0chdir\0chmod\0chown\0chroot\0clock_adjtime\0clock_getres\0"
++ "clock_gettime\0clock_nanosleep\0clock_settime\0clone\0close\0connect\0creat\0create_module\0delete_module\0dup\0"
++ "dup2\0dup3\0epoll_create\0epoll_create1\0epoll_ctl\0epoll_ctl_old\0epoll_pwait\0epoll_wait\0epoll_wait_old\0eventfd\0"
++ "eventfd2\0execve\0exit\0exit_group\0faccessat\0fadvise64\0fallocate\0fanotify_init\0fanotify_mark\0fchdir\0"
++ "fchmod\0fchmodat\0fchown\0fchownat\0fcntl\0fdatasync\0fgetxattr\0finit_module\0flistxattr\0flock\0"
++ "fork\0fremovexattr\0fsetxattr\0fstat\0fstatfs\0fsync\0ftruncate\0futex\0futimesat\0get_kernel_syms\0"
++ "get_mempolicy\0get_robust_list\0get_thread_area\0getcpu\0getcwd\0getdents\0getdents64\0getegid\0geteuid\0getgid\0"
++ "getgroups\0getitimer\0getpeername\0getpgid\0getpgrp\0getpid\0getpmsg\0getppid\0getpriority\0getresgid\0"
++ "getresuid\0getrlimit\0getrusage\0getsid\0getsockname\0getsockopt\0gettid\0gettimeofday\0getuid\0getxattr\0"
++ "init_module\0inotify_add_watch\0inotify_init\0inotify_init1\0inotify_rm_watch\0io_cancel\0io_destroy\0io_getevents\0io_setup\0io_submit\0"
++ "ioctl\0ioperm\0iopl\0ioprio_get\0ioprio_set\0kcmp\0kexec_load\0keyctl\0kill\0lchown\0"
++ "lgetxattr\0link\0linkat\0listen\0listxattr\0llistxattr\0lookup_dcookie\0lremovexattr\0lseek\0lsetxattr\0"
++ "lstat\0madvise\0mbind\0migrate_pages\0mincore\0mkdir\0mkdirat\0mknod\0mknodat\0mlock\0"
++ "mlockall\0mmap\0modify_ldt\0mount\0move_pages\0mprotect\0mq_getsetattr\0mq_notify\0mq_open\0mq_timedreceive\0"
++ "mq_timedsend\0mq_unlink\0mremap\0msgctl\0msgget\0msgrcv\0msgsnd\0msync\0munlock\0munlockall\0"
++ "munmap\0name_to_handle_at\0nanosleep\0newfstatat\0nfsservctl\0open\0open_by_handle_at\0openat\0pause\0perf_event_open\0"
++ "personality\0pipe\0pipe2\0pivot_root\0poll\0ppoll\0prctl\0pread\0preadv\0prlimit64\0"
++ "process_vm_readv\0process_vm_writev\0pselect6\0ptrace\0putpmsg\0pwrite\0pwritev\0query_module\0quotactl\0read\0"
++ "readahead\0readlink\0readlinkat\0readv\0reboot\0recvfrom\0recvmmsg\0recvmsg\0remap_file_pages\0removexattr\0"
++ "rename\0renameat\0request_key\0restart_syscall\0rmdir\0rt_sigaction\0rt_sigpending\0rt_sigprocmask\0rt_sigqueueinfo\0rt_sigreturn\0"
++ "rt_sigsuspend\0rt_sigtimedwait\0rt_tgsigqueueinfo\0sched_get_priority_max\0sched_get_priority_min\0sched_getaffinity\0sched_getparam\0sched_getscheduler\0sched_rr_get_interval\0sched_setaffinity\0"
++ "sched_setparam\0sched_setscheduler\0sched_yield\0security\0select\0semctl\0semget\0semop\0semtimedop\0sendfile\0"
++ "sendmmsg\0sendmsg\0sendto\0set_mempolicy\0set_robust_list\0set_thread_area\0set_tid_address\0setdomainname\0setfsgid\0setfsuid\0"
++ "setgid\0setgroups\0sethostname\0setitimer\0setns\0setpgid\0setpriority\0setregid\0setresgid\0setresuid\0"
++ "setreuid\0setrlimit\0setsid\0setsockopt\0settimeofday\0setuid\0setxattr\0shmat\0shmctl\0shmdt\0"
++ "shmget\0shutdown\0sigaltstack\0signalfd\0signalfd4\0socket\0socketpair\0splice\0stat\0statfs\0"
++ "swapoff\0swapon\0symlink\0symlinkat\0sync\0sync_file_range\0syncfs\0sysfs\0sysinfo\0syslog\0"
++ "tee\0tgkill\0time\0timer_create\0timer_delete\0timer_getoverrun\0timer_gettime\0timer_settime\0timerfd\0timerfd_gettime\0"
++ "timerfd_settime\0times\0tkill\0truncate\0tuxcall\0umask\0umount2\0uname\0unlink\0unlinkat\0"
++ "unshare\0uselib\0ustat\0utime\0utimensat\0utimes\0vfork\0vhangup\0vmsplice\0vserver\0"
++ "wait4\0waitid\0write\0writev";
++static const unsigned x86_64_syscall_s2i_s[] = {
++ 0,8,15,23,30,35,43,52,64,70,
++ 81,86,90,97,104,110,116,122,129,143,
++ 156,170,186,200,206,212,220,226,240,254,
++ 258,263,268,281,295,305,319,331,342,357,
++ 365,374,381,386,397,407,417,427,441,455,
++ 462,469,478,485,494,500,510,520,533,544,
++ 550,555,568,578,584,592,598,608,614,624,
++ 640,654,670,686,693,700,709,720,728,736,
++ 743,753,763,775,783,791,798,806,814,826,
++ 836,846,856,866,873,885,896,903,916,923,
++ 932,944,962,975,989,1006,1016,1027,1040,1049,
++ 1059,1065,1072,1077,1088,1099,1104,1115,1122,1127,
++ 1134,1144,1149,1156,1163,1173,1184,1199,1212,1218,
++ 1228,1234,1242,1248,1262,1270,1276,1284,1290,1298,
++ 1304,1313,1318,1329,1335,1346,1355,1369,1379,1387,
++ 1403,1416,1426,1433,1440,1447,1454,1461,1467,1475,
++ 1486,1493,1511,1521,1532,1543,1548,1566,1573,1579,
++ 1595,1607,1612,1618,1629,1634,1640,1646,1652,1659,
++ 1669,1686,1704,1713,1720,1728,1735,1743,1756,1765,
++ 1770,1780,1789,1800,1806,1813,1822,1831,1839,1856,
++ 1868,1875,1884,1896,1912,1918,1931,1945,1960,1976,
++ 1989,2003,2019,2037,2060,2083,2101,2116,2135,2157,
++ 2175,2190,2209,2221,2230,2237,2244,2251,2257,2268,
++ 2277,2286,2294,2301,2315,2331,2347,2363,2377,2386,
++ 2395,2402,2412,2424,2434,2440,2448,2460,2469,2479,
++ 2489,2498,2508,2515,2526,2539,2546,2555,2561,2568,
++ 2574,2581,2590,2602,2611,2621,2628,2639,2646,2651,
++ 2658,2666,2673,2681,2691,2696,2712,2719,2725,2733,
++ 2740,2744,2751,2756,2769,2782,2799,2813,2827,2835,
++ 2851,2867,2873,2879,2888,2896,2902,2910,2916,2923,
++ 2932,2940,2947,2953,2959,2969,2976,2982,2990,2999,
++ 3007,3013,3020,3026,
++};
++static const int x86_64_syscall_s2i_i[] = {
++ 156,43,288,21,163,248,159,183,37,158,
++ 49,12,125,126,80,90,92,161,305,229,
++ 228,230,227,56,3,42,85,174,176,32,
++ 33,292,213,291,233,214,281,232,215,284,
++ 290,59,60,231,269,221,285,300,301,81,
++ 91,268,93,260,72,75,193,313,196,73,
++ 57,199,190,5,138,74,77,202,261,177,
++ 239,274,211,309,79,78,217,108,107,104,
++ 115,36,52,121,111,39,181,110,140,120,
++ 118,97,98,124,51,55,186,96,102,191,
++ 175,254,253,294,255,210,207,208,206,209,
++ 16,173,172,252,251,312,246,250,62,94,
++ 192,86,265,50,194,195,212,198,8,189,
++ 6,28,237,256,27,83,258,133,259,149,
++ 151,9,154,165,279,10,245,244,240,243,
++ 242,241,25,71,68,70,69,26,150,152,
++ 11,303,35,262,180,2,304,257,34,298,
++ 135,22,293,155,7,271,157,17,295,302,
++ 310,311,270,101,182,18,296,178,179,0,
++ 187,89,267,19,169,45,299,47,216,197,
++ 82,264,249,219,84,13,127,14,129,15,
++ 130,128,297,146,147,204,143,145,148,203,
++ 142,144,24,185,23,66,64,65,220,40,
++ 307,46,44,238,273,205,218,171,123,122,
++ 106,116,170,38,308,109,141,114,119,117,
++ 113,160,112,54,164,105,188,30,31,67,
++ 29,48,131,282,289,41,53,275,4,137,
++ 168,167,88,266,162,277,306,139,99,103,
++ 276,234,201,222,226,225,224,223,283,287,
++ 286,100,200,76,184,95,166,63,87,263,
++ 272,134,136,132,280,235,58,153,278,236,
++ 61,247,1,20,
++};
++static int x86_64_syscall_s2i(const char *s, int *value) {
++ size_t len, i;
++ len = strlen(s);
++ { char copy[len + 1];
++ for (i = 0; i < len; i++) {
++ char c = s[i];
++ copy[i] = GT_ISUPPER(c) ? c - 'A' + 'a' : c;
++ }
++ copy[i] = 0;
++ return s2i__(x86_64_syscall_strings, x86_64_syscall_s2i_s, x86_64_syscall_s2i_i, 314, copy, value);
++ }
++}
++static const unsigned x86_64_syscall_i2s_direct[] = {
++ 1765,3020,1543,206,2646,578,1228,1629,1212,1313,
++ 1346,1486,86,1918,1945,1976,1059,1646,1728,1800,
++ 3026,23,1607,2230,2209,1426,1461,1262,1234,2574,
++ 2555,2561,254,258,1573,1511,753,64,2424,791,
++ 2268,2621,212,8,2294,1813,2286,1831,2581,81,
++ 1156,873,763,2628,2515,885,200,550,2976,374,
++ 381,3007,1122,2910,2244,2251,2237,2568,1440,1454,
++ 1447,1433,494,544,592,500,2879,598,700,693,
++ 104,455,1868,1270,1912,220,1144,2916,2673,1780,
++ 110,462,116,478,1127,2896,903,846,856,2725,
++ 2867,1713,916,2733,736,2539,2395,728,720,2440,
++ 806,783,2508,2489,2460,743,2402,2479,836,2469,
++ 826,775,2386,2377,866,90,97,1931,2003,1960,
++ 1989,2590,2953,1284,2940,1595,2947,2651,584,2719,
++ 814,2448,2175,2101,2190,2116,2037,2060,2135,1298,
++ 1467,1304,1475,2982,1318,1618,0,1640,70,43,
++ 2498,122,2691,30,2526,1329,2902,2666,2658,1806,
++ 2412,2363,1072,1065,226,932,240,624,1743,1756,
++ 1532,798,1720,52,2888,2221,896,1770,2546,1218,
++ 568,923,1134,510,1163,1173,533,1856,1199,555,
++ 2873,2751,608,2157,2083,2331,1040,1016,1027,1049,
++ 1006,670,1184,268,305,342,1839,709,2347,1896,
++ 2257,407,2756,2813,2799,2782,2769,186,156,143,
++ 170,386,331,295,2744,2969,2999,1242,2301,640,
++ 1379,1416,1403,1387,1369,1355,1104,3013,35,1884,
++ 1115,1088,1077,962,944,989,1248,1566,1276,1290,
++ 485,614,1521,2923,1875,1149,2681,1789,469,397,
++ 1704,1634,2932,2315,654,2639,2740,2696,2990,1335,
++ 2959,319,2602,2827,357,417,2851,2835,15,2611,
++ 365,281,263,1612,975,1652,1735,2019,1579,1822,
++ 427,441,1659,1493,1548,129,2712,2277,2434,686,
++ 1669,1686,1099,520,
++};
++static const char *x86_64_syscall_i2s(int v) {
++ return i2s_direct__(x86_64_syscall_strings, x86_64_syscall_i2s_direct, 0, 313, v);
++}
+--
+1.7.9.5
+
diff --git a/meta-security/recipes-security/audit/audit/audit-python-configure.patch b/meta-security/recipes-security/audit/audit/audit-python-configure.patch
new file mode 100644
index 000000000..f90e21330
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/audit-python-configure.patch
@@ -0,0 +1,27 @@
+From cace630b0eb42418dea4f3d98c69d0d777bfc1be Mon Sep 17 00:00:00 2001
+From: Xin Ouyang <Xin.Ouyang@windriver.com>
+Date: Wed, 20 Jun 2012 16:34:19 +0800
+Subject: [PATCH] audit: python cross-compile
+
+Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
+---
+ configure.ac | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3db7d45..9a07db6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -90,7 +90,8 @@ if test x$use_python = xno ; then
+ else
+ AC_MSG_RESULT(testing)
+ AM_PATH_PYTHON
+-if test -f /usr/include/python${am_cv_python_version}/Python.h ; then
++PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
++if test -f $PY_PREFIX/include/python${am_cv_python_version}/Python.h ; then
+ python_found="yes"
+ AC_MSG_NOTICE(Python bindings will be built)
+ else
+--
+1.7.7
+
diff --git a/meta-security/recipes-security/audit/audit/audit-python.patch b/meta-security/recipes-security/audit/audit/audit-python.patch
new file mode 100644
index 000000000..78fce0199
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/audit-python.patch
@@ -0,0 +1,31 @@
+Remove hard coded python include directory
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+diff -ur audit-2.1.3.orig/bindings/python/Makefile.am audit-2.1.3/bindings/python/Makefile.am
+--- audit-2.1.3.orig/bindings/python/Makefile.am 2011-08-15 12:31:01.000000000 -0500
++++ audit-2.1.3/bindings/python/Makefile.am 2012-01-30 12:19:54.533959225 -0600
+@@ -25,7 +25,9 @@
+
+ pyexec_LTLIBRARIES = auparse.la
+
++PYINC ?= /usr/include/python$(PYTHON_VERSION)
++
+ auparse_la_SOURCES = auparse_python.c
+-auparse_la_CPPFLAGS = -I$(top_srcdir)/auparse $(AM_CPPFLAGS) -I/usr/include/python$(PYTHON_VERSION) -fno-strict-aliasing
++auparse_la_CPPFLAGS = -I$(top_srcdir)/auparse $(AM_CPPFLAGS) -I$(PYINC) -fno-strict-aliasing
+ auparse_la_LDFLAGS = -module -avoid-version -Wl,-z,relro
+ auparse_la_LIBADD = ../../auparse/libauparse.la ../../lib/libaudit.la
+diff -ur audit-2.1.3.orig/swig/Makefile.am audit-2.1.3/swig/Makefile.am
+--- audit-2.1.3.orig/swig/Makefile.am 2011-08-15 12:31:03.000000000 -0500
++++ audit-2.1.3/swig/Makefile.am 2012-01-30 12:28:09.574834697 -0600
+@@ -23,7 +23,8 @@
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+ AM_CFLAGS = -fPIC -DPIC -fno-strict-aliasing
+ PYLIBVER ?= python$(PYTHON_VERSION)
+-INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib -I/usr/include/$(PYLIBVER)
++PYINC ?= /usr/include/$(PYLIBVER)
++INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib -I$(PYINC)
+ LIBS = $(top_builddir)/lib/libaudit.la
+ pyexec_PYTHON = audit.py
+ pyexec_LTLIBRARIES = _audit.la
diff --git a/meta-security/recipes-security/audit/audit/audit-volatile.conf b/meta-security/recipes-security/audit/audit/audit-volatile.conf
new file mode 100644
index 000000000..9cbe1547a
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/audit-volatile.conf
@@ -0,0 +1 @@
+d /var/log/audit 0750 root root -
diff --git a/meta-security/recipes-security/audit/audit/auditd b/meta-security/recipes-security/audit/audit/auditd
new file mode 100755
index 000000000..fcd96c9df
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/auditd
@@ -0,0 +1,153 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: auditd
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Audit Daemon
+# Description: Collects audit information from Linux 2.6 Kernels.
+### END INIT INFO
+
+# Author: Philipp Matthias Hahn <pmhahn@debian.org>
+# Based on Debians /etc/init.d/skeleton and Auditds init.d/auditd.init
+
+# June, 2012: Adopted for yocto <amy.fong@windriver.com>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DESC="audit daemon"
+NAME=auditd
+DAEMON=/sbin/auditd
+PIDFILE=/var/run/"$NAME".pid
+SCRIPTNAME=/etc/init.d/"$NAME"
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/"$NAME" ] && . /etc/default/"$NAME"
+
+. /etc/default/rcS
+
+. /etc/init.d/functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null \
+ || return 1
+ start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- \
+ $EXTRAOPTIONS \
+ || return 2
+ if [ -f /etc/audit/audit.rules ]
+ then
+ /sbin/auditctl -R /etc/audit/audit.rules >/dev/null
+ fi
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon -K --quiet --pidfile "$PIDFILE" --name "$NAME"
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f "$PIDFILE"
+ rm -f /var/run/audit_events
+ # Remove watches so shutdown works cleanly
+ case "$AUDITD_CLEAN_STOP" in
+ no|NO) ;;
+ *) /sbin/auditctl -D >/dev/null ;;
+ esac
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+if [ ! -e /var/log/audit ]; then
+ mkdir -p /var/log/audit
+ [ -x /sbin/restorecon ] && /sbin/restorecon -F /var/log/audit
+fi
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && echo 0 ;;
+ 2) [ "$VERBOSE" != no ] && echo 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && echo 0 ;;
+ 2) [ "$VERBOSE" != no ] && echo 1 ;;
+ esac
+ ;;
+ reload|force-reload)
+ echo "Reloading $DESC" "$NAME"
+ do_reload
+ echo $?
+ ;;
+ restart)
+ echo "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) echo 0 ;;
+ 1) echo 1 ;; # Old process is still running
+ *) echo 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ echo 1
+ ;;
+ esac
+ ;;
+ rotate)
+ echo "Rotating $DESC logs" "$NAME"
+ start-stop-daemon -K --signal USR1 --quiet --pidfile "$PIDFILE" --name "$NAME"
+ echo $?
+ ;;
+ status)
+ pidofproc "$DAEMON" >/dev/null
+ status=$?
+ if [ $status -eq 0 ]; then
+ echo "$NAME is running."
+ else
+ echo "$NAME is not running."
+ fi
+ exit $status
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|rotate|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/meta-security/recipes-security/audit/audit/auditd.service b/meta-security/recipes-security/audit/audit/auditd.service
new file mode 100644
index 000000000..ebc079897
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/auditd.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Security Auditing Service
+DefaultDependencies=no
+After=local-fs.target
+Conflicts=shutdown.target
+Before=sysinit.target shutdown.target
+After=systemd-tmpfiles-setup.service
+
+[Service]
+ExecStart=/sbin/auditd -n
+## To use augenrules, copy this file to /etc/systemd/system/auditd.service
+## and uncomment the next line and delete/comment out the auditctl line.
+## Then copy existing rules to /etc/audit/rules.d/
+## Not doing this last step can cause loss of existing rules
+#ExecStartPost=-/sbin/augenrules --load
+ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-security/recipes-security/audit/audit/disable-ldap.patch b/meta-security/recipes-security/audit/audit/disable-ldap.patch
new file mode 100644
index 000000000..1d683c29e
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/disable-ldap.patch
@@ -0,0 +1,59 @@
+Disable LDAP support
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Disable LDAP support
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: audit-2.3.2/audisp/plugins/Makefile.am
+===================================================================
+--- audit-2.3.2.orig/audisp/plugins/Makefile.am
++++ audit-2.3.2/audisp/plugins/Makefile.am
+@@ -22,8 +22,10 @@
+
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+
+-SUBDIRS = builtins zos-remote remote
+-#SUBDIRS = builtins zos-remote
++SUBDIRS = builtins remote
++if HAVE_LDAP
++SUBDIRS += zos-remote
++endif
+ if HAVE_PRELUDE
+ SUBDIRS += prelude
+ endif
+Index: audit-2.3.2/configure.ac
+===================================================================
+--- audit-2.3.2.orig/configure.ac
++++ audit-2.3.2/configure.ac
+@@ -241,6 +241,12 @@ else
+ fi
+ AM_CONDITIONAL(HAVE_PRELUDE, test x$have_prelude = xyes)
+
++AC_ARG_WITH(ldap,
++AS_HELP_STRING([--with-ldap],[enable zos-remote plugin, which requires ldap]),
++use_ldap=$withval,
++use_ldap=no)
++AM_CONDITIONAL(HAVE_LDAP, test x$have_ldap = xyes)
++
+ AC_MSG_CHECKING(whether to use libwrap)
+ AC_ARG_WITH(libwrap,
+ [ --with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support.],
+Index: audit-2.3.2/docs/Makefile.am
+===================================================================
+--- audit-2.3.2.orig/docs/Makefile.am
++++ audit-2.3.2/docs/Makefile.am
+@@ -53,7 +53,9 @@ ausearch_add_expression.3 ausearch_add_t
+ ausearch_clear.3 \
+ ausearch_next_event.3 ausearch_set_stop.3 \
+ autrace.8 get_auditfail_action.3 set_aumessage_mode.3 \
+-audispd.8 audispd.conf.5 audispd-zos-remote.8 libaudit.conf.5 \
+-augenrules.8 \
+-zos-remote.conf.5
++audispd.8 audispd.conf.5 libaudit.conf.5 \
++augenrules.8
+
++if HAVE_LDAP
++man_MANS += audispd-zos-remote.8 zos-remote.conf.5
++endif
diff --git a/meta-security/recipes-security/audit/audit/fix-swig-host-contamination.patch b/meta-security/recipes-security/audit/audit/fix-swig-host-contamination.patch
new file mode 100644
index 000000000..16bb173ad
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit/fix-swig-host-contamination.patch
@@ -0,0 +1,48 @@
+audit: Fixed swig host contamination issue
+
+The audit build uses swig to generate a python wrapper.
+Unfortunately, the swig info file references host include
+directories. Some of these were previously noticed and
+eliminated, but the one fixed here was not.
+
+Upstream Status: pending
+
+Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com>
+Signed-off-by: Joe Slater <jslater@windriver.com>
+
+Index: audit-2.2.1/swig/Makefile.am
+===================================================================
+--- audit-2.2.1.orig/swig/Makefile.am
++++ audit-2.2.1/swig/Makefile.am
+@@ -25,6 +25,7 @@ AM_CFLAGS = -fPIC -DPIC -fno-strict-alia
+ PYLIBVER ?= python$(PYTHON_VERSION)
+ PYINC ?= /usr/include/$(PYLIBVER)
+ INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib -I$(PYINC)
++STDINC ?= /usr/include
+ LIBS = $(top_builddir)/lib/libaudit.la
+ pyexec_PYTHON = audit.py
+ pyexec_LTLIBRARIES = _audit.la
+@@ -34,7 +35,7 @@ _audit_la_HEADERS: $(top_builddir)/confi
+ _audit_la_DEPENDENCIES =${top_srcdir}/lib/libaudit.h ${top_builddir}/lib/libaudit.la
+ nodist__audit_la_SOURCES = audit_wrap.c
+ audit.py audit_wrap.c: ${srcdir}/auditswig.i
+- swig -o audit_wrap.c -python ${INCLUDES} ${srcdir}/auditswig.i
++ swig -o audit_wrap.c -python ${INCLUDES} -I$(STDINC) ${srcdir}/auditswig.i
+
+ CLEANFILES = audit.py* audit_wrap.c *~
+
+Index: audit-2.2.1/swig/auditswig.i
+===================================================================
+--- audit-2.2.1.orig/swig/auditswig.i
++++ audit-2.2.1/swig/auditswig.i
+@@ -37,8 +37,8 @@ signed
+ #define __attribute(X) /*nothing*/
+ typedef unsigned __u32;
+ typedef unsigned uid_t;
+-%include "/usr/include/linux/audit.h"
++%include "linux/audit.h"
+ #define __extension__ /*nothing*/
+-%include "/usr/include/stdint.h"
++%include "stdint.h"
+ %include "../lib/libaudit.h"
+
diff --git a/meta-security/recipes-security/audit/audit_2.3.2.bb b/meta-security/recipes-security/audit/audit_2.3.2.bb
new file mode 100644
index 000000000..1d7ea0f0a
--- /dev/null
+++ b/meta-security/recipes-security/audit/audit_2.3.2.bb
@@ -0,0 +1,102 @@
+SUMMARY = "User space tools for kernel auditing"
+DESCRIPTION = "The audit package contains the user space utilities for \
+storing and searching the audit records generated by the audit subsystem \
+in the Linux kernel."
+HOMEPAGE = "http://people.redhat.com/sgrubb/audit/"
+SECTION = "base"
+PR = "r8"
+LICENSE = "GPLv2+ & LGPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+SRC_URI = "http://people.redhat.com/sgrubb/audit/audit-${PV}.tar.gz \
+ file://disable-ldap.patch \
+ file://audit-python.patch \
+ file://audit-python-configure.patch \
+ file://audit-for-cross-compiling.patch \
+ file://auditd \
+ file://fix-swig-host-contamination.patch \
+ file://auditd.service \
+ file://audit-volatile.conf \
+"
+SRC_URI_append_arm = "file://add-system-call-table-for-ARM.patch"
+
+inherit autotools pythonnative update-rc.d systemd
+
+UPDATERCPN = "auditd"
+INITSCRIPT_NAME = "auditd"
+INITSCRIPT_PARAMS = "defaults"
+
+SYSTEMD_SERVICE_${PN} = "auditd.service"
+
+SRC_URI[md5sum] = "4e8d065b5cc16b77b9b61e93a9ed160e"
+SRC_URI[sha256sum] = "8872e0b5392888789061db8034164305ef0e1b34543e1e7004d275f039081d29"
+
+DEPENDS += "python tcp-wrappers libcap-ng linux-libc-headers (>= 2.6.30)"
+
+EXTRA_OECONF += "--without-prelude \
+ --with-libwrap \
+ --enable-gssapi-krb5=no \
+ --without-ldap \
+ --with-libcap-ng=yes \
+ --with-python=yes \
+ --libdir=${base_libdir} \
+ --sbindir=${base_sbindir} \
+ "
+EXTRA_OECONF_append_arm = " --with-armeb=yes"
+
+EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' \
+ PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \
+ pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
+ STDINC='${STAGING_INCDIR}' \
+ "
+
+SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher"
+DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \
+interface to the audit system, audispd. These plugins can do things \
+like relay events to remote machines or analyze events for suspicious \
+behavior."
+
+PACKAGES =+ "audispd-plugins"
+PACKAGES += "auditd ${PN}-python"
+
+FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*"
+FILES_auditd += "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*"
+FILES_audispd-plugins += "${sysconfdir}/audisp/audisp-remote.conf \
+ ${sysconfdir}/audisp/plugins.d/au-remote.conf \
+ ${sbindir}/audisp-remote ${localstatedir}/spool/audit \
+ "
+FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
+FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
+FILES_${PN}-dev += "${base_libdir}/*.so ${base_libdir}/*.la"
+
+CONFFILES_auditd += "${sysconfdir}/audit/audit.rules"
+RDEPENDS_auditd += "bash"
+
+do_install_append() {
+ rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
+ rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
+
+ # reuse auditd config
+ [ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default
+ mv ${D}/etc/sysconfig/auditd ${D}/etc/default
+ rmdir ${D}/etc/sysconfig/
+
+ # replace init.d
+ install -D -m 0755 ${S}/../auditd ${D}/etc/init.d/auditd
+ rm -rf ${D}/etc/rc.d
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/tmpfiles.d/
+ install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+ fi
+
+ # install systemd unit files
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system
+
+ chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
+ chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
+
+ # Based on the audit.spec "Copy default rules into place on new installation"
+ cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
+}
diff --git a/meta-security/recipes-security/cynara/cynara/0001-Add-fallthrough-tags.patch b/meta-security/recipes-security/cynara/cynara/0001-Add-fallthrough-tags.patch
new file mode 100644
index 000000000..11387b98b
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0001-Add-fallthrough-tags.patch
@@ -0,0 +1,59 @@
+From 3d387993b5a4283e8aebd8e777b2ccd45d233959 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 25 Jan 2018 12:00:18 +0100
+Subject: [PATCH 1/6] Add fallthrough tags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 7 emits a warning when the tag /*@fallthrough@*/
+doesn't appear in a switch case when a case continue
+to the next after some processing.
+
+Change-Id: I420e3788a4c0a6d910a1214964c5480bbd12708c
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/admin/api/admin-api.cpp | 1 +
+ src/client-async/logic/Logic.cpp | 1 +
+ src/common/sockets/SocketClient.cpp | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/src/admin/api/admin-api.cpp b/src/admin/api/admin-api.cpp
+index c638f41..aafa45e 100644
+--- a/src/admin/api/admin-api.cpp
++++ b/src/admin/api/admin-api.cpp
+@@ -146,6 +146,7 @@ int cynara_admin_set_policies(struct cynara_admin *p_cynara_admin,
+ case CYNARA_ADMIN_BUCKET:
+ if (!isStringValid(policy->result_extra))
+ return CYNARA_API_INVALID_PARAM;
++ /*@fallthrough@*/
+ default:
+ {
+ std::string extraStr = policy->result_extra ? policy->result_extra : "";
+diff --git a/src/client-async/logic/Logic.cpp b/src/client-async/logic/Logic.cpp
+index 5ae0251..c1d6c33 100644
+--- a/src/client-async/logic/Logic.cpp
++++ b/src/client-async/logic/Logic.cpp
+@@ -233,6 +233,7 @@ bool Logic::processOut(void) {
+ case Socket::SendStatus::ALL_DATA_SENT:
+ onStatusChange(m_socketClient.getSockFd(),
+ cynara_async_status::CYNARA_STATUS_FOR_READ);
++ /*@fallthrough@*/
+ case Socket::SendStatus::PARTIAL_DATA_SENT:
+ return true;
+ default:
+diff --git a/src/common/sockets/SocketClient.cpp b/src/common/sockets/SocketClient.cpp
+index b1ca4f7..f4394e5 100644
+--- a/src/common/sockets/SocketClient.cpp
++++ b/src/common/sockets/SocketClient.cpp
+@@ -45,6 +45,7 @@ bool SocketClient::connect(void) {
+ LOGW("Error connecting to Cynara. Service not available.");
+ return false;
+ }
++ /*@fallthrough@*/
+ default:
+ return true;
+ }
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/0002-gcc-7-requires-include-functional-for-std-function.patch b/meta-security/recipes-security/cynara/cynara/0002-gcc-7-requires-include-functional-for-std-function.patch
new file mode 100644
index 000000000..760a1c5b2
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0002-gcc-7-requires-include-functional-for-std-function.patch
@@ -0,0 +1,38 @@
+From b18e66ce7f81c56e3a97ed075cb60d5a43b2e57c Mon Sep 17 00:00:00 2001
+From: Changhyeok Bae <changhyeok.bae@gmail.com>
+Date: Sun, 17 Dec 2017 15:28:28 +0000
+Subject: [PATCH 2/6] gcc-7 requires include <functional> for std::function
+
+Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
+---
+ src/common/types/PolicyBucket.h | 1 +
+ src/cyad/AdminPolicyParser.h | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/common/types/PolicyBucket.h b/src/common/types/PolicyBucket.h
+index 029d3dd..1bceeca 100644
+--- a/src/common/types/PolicyBucket.h
++++ b/src/common/types/PolicyBucket.h
+@@ -30,6 +30,7 @@
+ #include <set>
+ #include <string>
+ #include <vector>
++#include <functional>
+
+ #include <exceptions/NotImplementedException.h>
+ #include <types/pointers.h>
+diff --git a/src/cyad/AdminPolicyParser.h b/src/cyad/AdminPolicyParser.h
+index 53dde23..f38c194 100644
+--- a/src/cyad/AdminPolicyParser.h
++++ b/src/cyad/AdminPolicyParser.h
+@@ -25,6 +25,7 @@
+
+ #include <istream>
+ #include <memory>
++#include <functional>
+
+ #include <cyad/CynaraAdminPolicies.h>
+
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/0003-Avoid-warning-when-compiling-without-smack.patch b/meta-security/recipes-security/cynara/cynara/0003-Avoid-warning-when-compiling-without-smack.patch
new file mode 100644
index 000000000..8c47c3b26
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0003-Avoid-warning-when-compiling-without-smack.patch
@@ -0,0 +1,45 @@
+From 6ad54c5e732e7cf0a29f29f48fa757e3e56d6860 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 25 Jan 2018 11:38:16 +0100
+Subject: [PATCH 3/6] Avoid warning when compiling without smack
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When DB_FILES_SMACK_LABEL is not defined, cmake complains
+with the following message:
+
+> -- Checking for modules ''
+> Please specify at least one package name on the command line.
+
+Change-Id: Ie837cae81114d096f951ec0ee4ada4173fb60190
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/admin/CMakeLists.txt | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/admin/CMakeLists.txt b/src/admin/CMakeLists.txt
+index e4f354a..38b8669 100644
+--- a/src/admin/CMakeLists.txt
++++ b/src/admin/CMakeLists.txt
+@@ -23,12 +23,12 @@ IF (DB_FILES_SMACK_LABEL)
+ SET(SMACK "smack")
+ SET(LIBSMACK "libsmack")
+ ADD_DEFINITIONS("-DDB_FILES_SMACK_LABEL=\"${DB_FILES_SMACK_LABEL}\"")
+-ENDIF (DB_FILES_SMACK_LABEL)
+
+-PKG_CHECK_MODULES(CYNARA_ADMIN_API_DEP
+- REQUIRED
+- ${LIBSMACK}
+- )
++ PKG_CHECK_MODULES(CYNARA_ADMIN_API_DEP
++ REQUIRED
++ ${LIBSMACK}
++ )
++ENDIF (DB_FILES_SMACK_LABEL)
+
+ SET(CYNARA_LIB_CYNARA_ADMIN_PATH ${CYNARA_PATH}/admin)
+
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/0004-Fix-mode-of-sockets.patch b/meta-security/recipes-security/cynara/cynara/0004-Fix-mode-of-sockets.patch
new file mode 100644
index 000000000..164542899
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0004-Fix-mode-of-sockets.patch
@@ -0,0 +1,44 @@
+From 2bd62bca98a8a8cf194fb2b68aed68d982f58520 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 25 Jan 2018 12:52:39 +0100
+Subject: [PATCH 4/6] Fix mode of sockets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Setting execution bit on the socket serves nothing.
+
+Change-Id: I2ca1ea8e0c369ee5517878e92073ace0e50f9f10
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ systemd/cynara-admin.socket | 2 +-
+ systemd/cynara.socket | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/systemd/cynara-admin.socket b/systemd/cynara-admin.socket
+index 2d1aea4..ed38386 100644
+--- a/systemd/cynara-admin.socket
++++ b/systemd/cynara-admin.socket
+@@ -1,6 +1,6 @@
+ [Socket]
+ ListenStream=/run/cynara/cynara-admin.socket
+-SocketMode=0700
++SocketMode=0600
+ SmackLabelIPIn=@
+ SmackLabelIPOut=@
+
+diff --git a/systemd/cynara.socket b/systemd/cynara.socket
+index 9f2a870..fad2745 100644
+--- a/systemd/cynara.socket
++++ b/systemd/cynara.socket
+@@ -1,6 +1,6 @@
+ [Socket]
+ ListenStream=/run/cynara/cynara.socket
+-SocketMode=0777
++SocketMode=0666
+ SmackLabelIPIn=*
+ SmackLabelIPOut=@
+
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/0005-Allow-to-tune-sockets.patch b/meta-security/recipes-security/cynara/cynara/0005-Allow-to-tune-sockets.patch
new file mode 100644
index 000000000..b4a2d74e8
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0005-Allow-to-tune-sockets.patch
@@ -0,0 +1,127 @@
+From d919b110a2fbccdce084c651f4d7d7de66f2f869 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 25 Jan 2018 13:47:37 +0100
+Subject: [PATCH 5/6] Allow to tune sockets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Allow to change the directory of sockets
+through a true integration of SOCKET_DIR
+
+Allow to override the socket's group of
+ - /run/cynara/cynara-agent.socket
+ - /run/cynara/cynara-monitor-get.socket
+
+through the newly defined variable CYNARA_ADMIN_SOCKET_GROUP
+
+Change-Id: I7d58854c328e948e3d6d7fa3fc00569fd08f8aef
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ systemd/CMakeLists.txt | 19 +++++++++++++++----
+ .../{cynara-admin.socket => cynara-admin.socket.in} | 2 +-
+ .../{cynara-agent.socket => cynara-agent.socket.in} | 4 ++--
+ ...onitor-get.socket => cynara-monitor-get.socket.in} | 4 ++--
+ systemd/{cynara.socket => cynara.socket.in} | 2 +-
+ 5 files changed, 21 insertions(+), 10 deletions(-)
+ rename systemd/{cynara-admin.socket => cynara-admin.socket.in} (78%)
+ rename systemd/{cynara-agent.socket => cynara-agent.socket.in} (66%)
+ rename systemd/{cynara-monitor-get.socket => cynara-monitor-get.socket.in} (64%)
+ rename systemd/{cynara.socket => cynara.socket.in} (80%)
+
+diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
+index 20accf0..1b75c12 100644
+--- a/systemd/CMakeLists.txt
++++ b/systemd/CMakeLists.txt
+@@ -16,13 +16,24 @@
+ # @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ #
+
++SET(CYNARA_ADMIN_SOCKET_GROUP
++ "security_fw"
++ CACHE STRING
++ "Group to apply on administrative sockets")
++
++
++CONFIGURE_FILE(cynara.socket.in cynara.socket @ONLY)
++CONFIGURE_FILE(cynara-admin.socket.in cynara-admin.socket @ONLY)
++CONFIGURE_FILE(cynara-agent.socket.in cynara-agent.socket @ONLY)
++CONFIGURE_FILE(cynara-monitor-get.socket.in cynara-monitor-get.socket @ONLY)
++
+ INSTALL(FILES
+ ${CMAKE_SOURCE_DIR}/systemd/cynara.service
+ ${CMAKE_SOURCE_DIR}/systemd/cynara.target
+- ${CMAKE_SOURCE_DIR}/systemd/cynara.socket
+- ${CMAKE_SOURCE_DIR}/systemd/cynara-admin.socket
+- ${CMAKE_SOURCE_DIR}/systemd/cynara-agent.socket
+- ${CMAKE_SOURCE_DIR}/systemd/cynara-monitor-get.socket
++ ${CMAKE_BINARY_DIR}/systemd/cynara.socket
++ ${CMAKE_BINARY_DIR}/systemd/cynara-admin.socket
++ ${CMAKE_BINARY_DIR}/systemd/cynara-agent.socket
++ ${CMAKE_BINARY_DIR}/systemd/cynara-monitor-get.socket
+ DESTINATION
+ ${SYSTEMD_UNIT_DIR}
+ )
+diff --git a/systemd/cynara-admin.socket b/systemd/cynara-admin.socket.in
+similarity index 78%
+rename from systemd/cynara-admin.socket
+rename to systemd/cynara-admin.socket.in
+index ed38386..2364c3e 100644
+--- a/systemd/cynara-admin.socket
++++ b/systemd/cynara-admin.socket.in
+@@ -1,5 +1,5 @@
+ [Socket]
+-ListenStream=/run/cynara/cynara-admin.socket
++ListenStream=@SOCKET_DIR@/cynara-admin.socket
+ SocketMode=0600
+ SmackLabelIPIn=@
+ SmackLabelIPOut=@
+diff --git a/systemd/cynara-agent.socket b/systemd/cynara-agent.socket.in
+similarity index 66%
+rename from systemd/cynara-agent.socket
+rename to systemd/cynara-agent.socket.in
+index 5a677e0..4f86c9d 100644
+--- a/systemd/cynara-agent.socket
++++ b/systemd/cynara-agent.socket.in
+@@ -1,6 +1,6 @@
+ [Socket]
+-ListenStream=/run/cynara/cynara-agent.socket
+-SocketGroup=security_fw
++ListenStream=@SOCKET_DIR@/cynara-agent.socket
++SocketGroup=@CYNARA_ADMIN_SOCKET_GROUP@
+ SocketMode=0060
+ SmackLabelIPIn=*
+ SmackLabelIPOut=@
+diff --git a/systemd/cynara-monitor-get.socket b/systemd/cynara-monitor-get.socket.in
+similarity index 64%
+rename from systemd/cynara-monitor-get.socket
+rename to systemd/cynara-monitor-get.socket.in
+index a50feeb..b88dbf7 100644
+--- a/systemd/cynara-monitor-get.socket
++++ b/systemd/cynara-monitor-get.socket.in
+@@ -1,6 +1,6 @@
+ [Socket]
+-ListenStream=/run/cynara/cynara-monitor-get.socket
+-SocketGroup=security_fw
++ListenStream=@SOCKET_DIR@/cynara-monitor-get.socket
++SocketGroup=@CYNARA_ADMIN_SOCKET_GROUP@
+ SocketMode=0060
+ SmackLabelIPIn=@
+ SmackLabelIPOut=@
+diff --git a/systemd/cynara.socket b/systemd/cynara.socket.in
+similarity index 80%
+rename from systemd/cynara.socket
+rename to systemd/cynara.socket.in
+index fad2745..ba76549 100644
+--- a/systemd/cynara.socket
++++ b/systemd/cynara.socket.in
+@@ -1,5 +1,5 @@
+ [Socket]
+-ListenStream=/run/cynara/cynara.socket
++ListenStream=@SOCKET_DIR@/cynara.socket
+ SocketMode=0666
+ SmackLabelIPIn=*
+ SmackLabelIPOut=@
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/0006-Install-socket-activation-by-default.patch b/meta-security/recipes-security/cynara/cynara/0006-Install-socket-activation-by-default.patch
new file mode 100644
index 000000000..0cfc785c1
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/0006-Install-socket-activation-by-default.patch
@@ -0,0 +1,80 @@
+From d54e425b0685c9e3e06f5b4efcbd206950d14f3c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Thu, 25 Jan 2018 14:09:23 +0100
+Subject: [PATCH 6/6] Install socket activation by default
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Change-Id: Ifd10c3800486689ed0ed6271df59760ccfbf6caf
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ packaging/cynara.spec | 5 -----
+ systemd/CMakeLists.txt | 7 +++++++
+ systemd/sockets.target.wants/cynara-admin.socket | 1 +
+ systemd/sockets.target.wants/cynara-agent.socket | 1 +
+ systemd/sockets.target.wants/cynara.socket | 1 +
+ 5 files changed, 10 insertions(+), 5 deletions(-)
+ create mode 120000 systemd/sockets.target.wants/cynara-admin.socket
+ create mode 120000 systemd/sockets.target.wants/cynara-agent.socket
+ create mode 120000 systemd/sockets.target.wants/cynara.socket
+
+diff --git a/packaging/cynara.spec b/packaging/cynara.spec
+index d2e0b80..2c5b326 100644
+--- a/packaging/cynara.spec
++++ b/packaging/cynara.spec
+@@ -72,12 +72,7 @@ make %{?jobs:-j%jobs}
+ rm -rf %{buildroot}
+ %make_install
+
+-mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
+ mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+-ln -s ../cynara.socket %{buildroot}%{_unitdir}/sockets.target.wants/cynara.socket
+-ln -s ../cynara-admin.socket %{buildroot}%{_unitdir}/sockets.target.wants/cynara-admin.socket
+-ln -s ../cynara-agent.socket %{buildroot}%{_unitdir}/sockets.target.wants/cynara-agent.socket
+-ln -s ../cynara-monitor-get.socket %{buildroot}%{_unitdir}/sockets.target.wants/cynara-monitor-get.socket
+ ln -s ../cynara.service %{buildroot}%{_unitdir}/multi-user.target.wants/cynara.service
+
+ %post
+diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
+index 1b75c12..9a2d70d 100644
+--- a/systemd/CMakeLists.txt
++++ b/systemd/CMakeLists.txt
+@@ -38,3 +38,10 @@ INSTALL(FILES
+ ${SYSTEMD_UNIT_DIR}
+ )
+
++INSTALL(DIRECTORY
++ ${CMAKE_SOURCE_DIR}/systemd/sockets.target.wants
++ DESTINATION
++ ${SYSTEMD_UNIT_DIR}
++)
++
++
+diff --git a/systemd/sockets.target.wants/cynara-admin.socket b/systemd/sockets.target.wants/cynara-admin.socket
+new file mode 120000
+index 0000000..3d0b1ce
+--- /dev/null
++++ b/systemd/sockets.target.wants/cynara-admin.socket
+@@ -0,0 +1 @@
++../cynara-admin.socket
+\ No newline at end of file
+diff --git a/systemd/sockets.target.wants/cynara-agent.socket b/systemd/sockets.target.wants/cynara-agent.socket
+new file mode 120000
+index 0000000..22b37dd
+--- /dev/null
++++ b/systemd/sockets.target.wants/cynara-agent.socket
+@@ -0,0 +1 @@
++../cynara-agent.socket
+\ No newline at end of file
+diff --git a/systemd/sockets.target.wants/cynara.socket b/systemd/sockets.target.wants/cynara.socket
+new file mode 120000
+index 0000000..c0e5a5b
+--- /dev/null
++++ b/systemd/sockets.target.wants/cynara.socket
+@@ -0,0 +1 @@
++../cynara.socket
+\ No newline at end of file
+--
+2.14.3
+
diff --git a/meta-security/recipes-security/cynara/cynara/cynara-db-migration-abort-on-errors.patch b/meta-security/recipes-security/cynara/cynara/cynara-db-migration-abort-on-errors.patch
new file mode 100644
index 000000000..cbf372ad9
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/cynara-db-migration-abort-on-errors.patch
@@ -0,0 +1,31 @@
+From 297774fa4d01156c0327d6e6380a7ecae30bf875 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Mon, 23 Mar 2015 15:01:39 -0700
+Subject: [PATCH 1/2] cynara-db-migration.in: abort on errors
+
+"set -e" enables error checking for all commands invoked by the script.
+Previously, errors were silently ignored.
+
+Upstream-status: Submitted [https://github.com/Samsung/cynara/pull/8]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ migration/cynara-db-migration | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/migration/cynara-db-migration.in b/migration/cynara-db-migration.in
+index ff9bd61..f6e7f94 100644
+--- a/migration/cynara-db-migration.in
++++ b/migration/cynara-db-migration.in
+@@ -19,6 +19,8 @@
+ # @brief Migration tool for Cynara's database
+ #
+
++set -e
++
+ ##### Constants (these must not be modified by shell)
+
+ STATE_PATH='@LOCAL_STATE_DIR@/@PROJECT_NAME@'
+--
+1.8.4.5
+
diff --git a/meta-security/recipes-security/cynara/cynara/run-ptest b/meta-security/recipes-security/cynara/cynara/run-ptest
new file mode 100755
index 000000000..f8dd5d8b4
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cynara-tests | sed -e 's/^\[ *OK *\] \(\S*\)$/PASS: \1/' -e 's/^\[ *FAILED *\] \(\S*\)$/FAIL: \1/'
+sh /usr/bin/cynara-db-migration-tests | sed -e 's/^Test .*(\([^)]*\)).*passed.*/PASS: \1/' -e 's/^Test .*(\([^)]*\)).*failed.*/FAIL: \1/'
diff --git a/meta-security/recipes-security/cynara/cynara_0.14.10.bb b/meta-security/recipes-security/cynara/cynara_0.14.10.bb
new file mode 100644
index 000000000..6c187fced
--- /dev/null
+++ b/meta-security/recipes-security/cynara/cynara_0.14.10.bb
@@ -0,0 +1,163 @@
+DESCRIPTION = "Cynara service with client libraries"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327;beginline=3"
+
+PV = "0.14.10+git${SRCPV}"
+SRCREV = "be455dcaf1400bec0272a6ce90852b9147393a60"
+SRC_URI = "git://github.com/Samsung/cynara.git"
+S = "${WORKDIR}/git"
+
+SRC_URI += " \
+ file://cynara-db-migration-abort-on-errors.patch \
+ file://0001-Add-fallthrough-tags.patch \
+ file://0002-gcc-7-requires-include-functional-for-std-function.patch \
+ file://0003-Avoid-warning-when-compiling-without-smack.patch \
+ file://0004-Fix-mode-of-sockets.patch \
+ file://0005-Allow-to-tune-sockets.patch \
+ file://0006-Install-socket-activation-by-default.patch \
+"
+
+DEPENDS = " \
+glib-2.0 \
+systemd \
+zip \
+"
+
+PACKAGECONFIG ??= ""
+# Use debug mode to increase logging. Beware, also compiles with less optimization
+# and thus has to disable FORTIFY_SOURCE below.
+PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE,libunwind elfutils"
+
+inherit cmake
+
+EXTRA_OECMAKE += " \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DBUILD_WITH_SYSTEMD_DAEMON=ON \
+ -DBUILD_WITH_SYSTEMD_JOURNAL=ON \
+ -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir} \
+ -DSOCKET_DIR=/run/cynara \
+ -DBUILD_COMMONS=ON \
+ -DBUILD_SERVICE=ON \
+ -DBUILD_DBUS=OFF \
+ -DCYNARA_ADMIN_SOCKET_GROUP=cynara \
+"
+
+# Explicitly package empty directory. Otherwise Cynara prints warnings
+# at runtime:
+# cyad[198]: Couldn't scan for plugins in </usr/lib/cynara/plugin/service/> : <No such file or directory>
+FILES_${PN}_append = " \
+${libdir}/cynara/plugin/service \
+${libdir}/cynara/plugin/client \
+"
+
+inherit useradd
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "-r cynara"
+USERADD_PARAM_${PN} = "\
+--system --home ${localstatedir}/lib/empty \
+--no-create-home --shell /bin/false \
+--gid cynara cynara \
+"
+
+# Causes deadlock during booting, see workaround in postinst below.
+#inherit systemd
+#SYSTEMD_SERVICE_${PN} = "cynara.service"
+
+#do_install_append () {
+# chmod a+rx ${D}/${sbindir}/cynara-db-migration
+#
+# install -d ${D}${sysconfdir}/cynara/
+# install -m 644 ${S}/conf/creds.conf ${D}/${sysconfdir}/cynara/creds.conf
+#
+# # No need to create empty directories except for those which
+# # Cynara expects to find.
+# # install -d ${D}${localstatedir}/cynara/
+# # install -d ${D}${prefix}/share/cynara/tests/empty_db
+# install -d ${D}${libdir}/cynara/plugin/client
+# install -d ${D}${libdir}/cynara/plugin/service
+#
+# # install db* ${D}${prefix}/share/cynara/tests/
+#
+# install -d ${D}${systemd_system_unitdir}/sockets.target.wants
+# ln -s ../cynara.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara.socket
+# ln -s ../cynara-admin.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-admin.socket
+# ln -s ../cynara-agent.socket ${D}${systemd_system_unitdir}/sockets.target.wants/cynara-agent.socket
+#}
+
+FILES_${PN} += "${systemd_system_unitdir}"
+
+# Cynara itself has no dependency on Smack. Only its installation
+# is Smack-aware in the sense that it sets Smack labels. Do not
+# depend on smack userspace unless we really need Smack labels.
+#
+# The Tizen .spec file calls cynara-db-migration in a %pre section.
+# That only works when cynara-db-migration is packaged separately
+# (overly complex) and does not seem necessary: perhaps there is a
+# time window where cynara might already get activated before
+# the postinst completes, but that is a general problem. It gets
+# avoided entirely when calling this script while building the
+# rootfs.
+DEPENDS_append_with-lsm-smack = " smack smack-native"
+EXTRA_OECMAKE_append_with-lsm-smack = " -DDB_FILES_SMACK_LABEL=System"
+CHSMACK_with-lsm-smack = "chsmack"
+CHSMACK = "true"
+pkg_postinst_${PN} () {
+ # Fail on error.
+ set -e
+
+ # It would be nice to run the code below while building an image,
+ # but currently the calls to cynara-db-chsgen (a binary) in
+ # cynara-db-migration (a script) prevent that. Rely instead
+ # on OE's support for running failed postinst scripts at first boot.
+ if [ x"$D" != "x" ]; then
+ exit 1
+ fi
+
+ mkdir -p $D${sysconfdir}/cynara
+ ${CHSMACK} -a System $D${sysconfdir}/cynara
+
+ # Strip git patch level information, the version comparison code
+ # in cynara-db-migration only expect major.minor.patch version numbers.
+ VERSION=${@d.getVar('PV',d,1).split('+git')[0]}
+ if [ -d $D${localstatedir}/cynara ] ; then
+ # upgrade
+ echo "NOTE: updating cynara DB to version $VERSION"
+ $D${sbindir}/cynara-db-migration upgrade -f 0.0.0 -t $VERSION
+ else
+ # install
+ echo "NOTE: creating cynara DB for version $VERSION"
+ mkdir -p $D${localstatedir}/cynara
+ ${CHSMACK} -a System $D${localstatedir}/cynara
+ $D${sbindir}/cynara-db-migration install -t $VERSION
+ fi
+
+ # Workaround for systemd.bbclass issue: it would call
+ # "systemctl start" without "--no-block", but because
+ # the service is not ready to run at the time when
+ # this scripts gets executed by run-postinsts.service,
+ # booting deadlocks.
+ echo "NOTE: enabling and starting cynara service"
+ systemctl enable cynara
+ systemctl start --no-block cynara
+}
+
+# Testing depends on gmock and gtest. They can be found in meta-oe
+# and are not necessarily available, so this feature is off by default.
+# If gmock from meta-oe is used, then a workaround is needed to avoid
+# a link error (libgmock.a calls pthread functions without libpthread
+# being listed in the .pc file).
+DEPENDS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' gmock', '', d)}"
+LDFLAGS_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' -lpthread', '', d)}"
+SRC_URI_append = "${@bb.utils.contains('PACKAGECONFIG', 'tests', ' file://run-ptest', '', d)}"
+PACKAGECONFIG[tests] = "-DBUILD_TESTS:BOOL=ON,-DBUILD_TESTS:BOOL=OFF,gmock gtest,"
+
+# Will be empty if no tests were built.
+inherit ptest
+FILES_${PN}-ptest += "${bindir}/cynara-tests ${bindir}/cynara-db-migration-tests ${datadir}/cynara/tests"
+do_install_ptest () {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
+ mkdir -p ${D}/${datadir}/cynara/tests
+ cp -r ${S}/test/db/* ${D}/${datadir}/cynara/tests
+ fi
+}
+
diff --git a/meta-security/recipes-security/keyutils/keyutils/keyutils-arm-remove-m32-m64.patch b/meta-security/recipes-security/keyutils/keyutils/keyutils-arm-remove-m32-m64.patch
new file mode 100644
index 000000000..a049fd23f
--- /dev/null
+++ b/meta-security/recipes-security/keyutils/keyutils/keyutils-arm-remove-m32-m64.patch
@@ -0,0 +1,19 @@
+Index: keyutils-1.5.5/Makefile
+===================================================================
+--- keyutils-1.5.5.orig/Makefile 2011-12-20 11:05:10.000000000 +0200
++++ keyutils-1.5.5/Makefile 2011-12-20 11:06:27.000000000 +0200
+@@ -58,12 +58,12 @@
+ LNS := ln -sf
+
+ ifeq ($(BUILDFOR),32-bit)
+-CFLAGS += -m32
++#CFLAGS += -m32
+ LIBDIR := /usr/lib
+ USRLIBDIR := /usr/lib
+ else
+ ifeq ($(BUILDFOR),64-bit)
+-CFLAGS += -m64
++#CFLAGS += -m64
+ LIBDIR := /usr/lib
+ USRLIBDIR := /usr/lib
+ endif
diff --git a/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_library_install.patch b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_library_install.patch
new file mode 100644
index 000000000..adf064304
--- /dev/null
+++ b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_library_install.patch
@@ -0,0 +1,30 @@
+Index: keyutils-1.5.5/Makefile
+===================================================================
+--- keyutils-1.5.5.orig/Makefile 2011-11-30 17:27:43.000000000 +0200
++++ keyutils-1.5.5/Makefile 2011-12-21 16:05:53.000000000 +0200
+@@ -59,13 +59,13 @@
+
+ ifeq ($(BUILDFOR),32-bit)
+ CFLAGS += -m32
+-LIBDIR := /lib
++LIBDIR := /usr/lib
+ USRLIBDIR := /usr/lib
+ else
+ ifeq ($(BUILDFOR),64-bit)
+ CFLAGS += -m64
+-LIBDIR := /lib64
+-USRLIBDIR := /usr/lib64
++LIBDIR := /usr/lib
++USRLIBDIR := /usr/lib
+ endif
+ endif
+
+@@ -152,7 +152,7 @@
+ $(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+ $(LNS) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
+ mkdir -p $(DESTDIR)$(USRLIBDIR)
+- $(LNS) $(LIBDIR)/$(SONAME) $(DESTDIR)$(USRLIBDIR)/$(DEVELLIB)
++ $(LNS) $(SONAME) $(DESTDIR)$(USRLIBDIR)/$(DEVELLIB)
+ $(INSTALL) -D keyctl $(DESTDIR)$(BINDIR)/keyctl
+ $(INSTALL) -D request-key $(DESTDIR)$(SBINDIR)/request-key
+ $(INSTALL) -D request-key-debug.sh $(DESTDIR)$(SHAREDIR)/request-key-debug.sh
diff --git a/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86-64_cflags.patch b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86-64_cflags.patch
new file mode 100644
index 000000000..8dd224505
--- /dev/null
+++ b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86-64_cflags.patch
@@ -0,0 +1,13 @@
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile 2012-11-16 15:40:05.258723425 +0200
++++ git/Makefile 2012-11-16 15:41:08.978725491 +0200
+@@ -53,7 +53,7 @@
+ ###############################################################################
+ LIBDIR := $(shell ldd /usr/bin/make | grep '\(/libc\)' | sed -e 's!.*\(/.*\)/libc[.].*!\1!')
+ USRLIBDIR := $(patsubst /lib/%,/usr/lib/%,$(LIBDIR))
+-BUILDFOR := $(shell file /usr/bin/make | sed -e 's!.*ELF \(32\|64\)-bit.*!\1!')-bit
++BUILDFOR := 64-bit
+
+ LNS := ln -sf
+
diff --git a/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86_cflags.patch b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86_cflags.patch
new file mode 100644
index 000000000..573c429b8
--- /dev/null
+++ b/meta-security/recipes-security/keyutils/keyutils/keyutils_fix_x86_cflags.patch
@@ -0,0 +1,13 @@
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile 2012-11-16 15:40:05.258723425 +0200
++++ git/Makefile 2012-11-16 15:41:08.978725491 +0200
+@@ -53,7 +53,7 @@
+ ###############################################################################
+ LIBDIR := $(shell ldd /usr/bin/make | grep '\(/libc\)' | sed -e 's!.*\(/.*\)/libc[.].*!\1!')
+ USRLIBDIR := $(patsubst /lib/%,/usr/lib/%,$(LIBDIR))
+-BUILDFOR := $(shell file /usr/bin/make | sed -e 's!.*ELF \(32\|64\)-bit.*!\1!')-bit
++BUILDFOR := 32-bit
+
+ LNS := ln -sf
+
diff --git a/meta-security/recipes-security/keyutils/keyutils_1.5.8.bb b/meta-security/recipes-security/keyutils/keyutils_1.5.8.bb
new file mode 100644
index 000000000..46b2b622a
--- /dev/null
+++ b/meta-security/recipes-security/keyutils/keyutils_1.5.8.bb
@@ -0,0 +1,44 @@
+SUMMARY = "Linux Key Management Utilities"
+DESCRIPTION = "Keyutils is a set of utilities for managing the key retention \
+facility in the kernel, which can be used by filesystems, block devices and \
+more to gain and retain the authorization and encryption keys required to \
+perform secure operations."
+SECTION = "base"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENCE.GPL;md5=5f6e72824f5da505c1f4a7197f004b45"
+
+PR = "r1"
+
+SRCREV = "dd64114721edca5808872190e7e2e927ee2e994c"
+
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git;protocol=git \
+ file://keyutils_fix_library_install.patch \
+ "
+SRC_URI_append_arm = " file://keyutils-arm-remove-m32-m64.patch"
+SRC_URI_append_x86 = " file://keyutils_fix_x86_cflags.patch"
+SRC_URI_append_x86-64 = " file://keyutils_fix_x86-64_cflags.patch"
+
+S = "${WORKDIR}/git"
+
+INSTALL_FLAGS = " \
+BINDIR=${bindir} \
+SBINDIR=${sbindir} \
+INCLUDEDIR=${includedir} \
+ETCDIR=${sysconfdir} \
+LIBDIR=${libdir} \
+USRLIBDIR=${libdir} \
+SHAREDIR=${datadir} \
+MAN1=${mandir}/man1 \
+MAN3=${mandir}/man3 \
+MAN5=${mandir}/man5 \
+MAN8=${mandir}/man8 \
+DESTDIR=${D}"
+
+do_install() {
+ cd ${S} && oe_runmake ${INSTALL_FLAGS} install
+
+ # Debugging script of unknown value, not packaged.
+ rm -f "${D}${datadir}/request-key-debug.sh"
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta-security/recipes-security/libcap-ng/libcap-ng/CVE-2014-3215.patch b/meta-security/recipes-security/libcap-ng/libcap-ng/CVE-2014-3215.patch
new file mode 100644
index 000000000..d7a868d2c
--- /dev/null
+++ b/meta-security/recipes-security/libcap-ng/libcap-ng/CVE-2014-3215.patch
@@ -0,0 +1,79 @@
+Upstream-Status: Pending
+
+diff --git a/docs/capng_lock.3 b/docs/capng_lock.3
+index 7683119..a070c1e 100644
+--- a/docs/capng_lock.3
++++ b/docs/capng_lock.3
+@@ -8,12 +8,13 @@ int capng_lock(void);
+
+ .SH "DESCRIPTION"
+
+-capng_lock will take steps to prevent children of the current process to regain full privileges if the uid is 0. This should be called while possessing the CAP_SETPCAP capability in the kernel. This function will do the following if permitted by the kernel: Set the NOROOT option on for PR_SET_SECUREBITS, set the NOROOT_LOCKED option to on for PR_SET_SECUREBITS, set the PR_NO_SETUID_FIXUP option on for PR_SET_SECUREBITS, and set the PR_NO_SETUID_FIXUP_LOCKED option on for PR_SET_SECUREBITS.
++capng_lock will take steps to prevent children of the current process from gaining privileges by executing setuid programs. This should be called while possessing the CAP_SETPCAP capability in the kernel.
+
++This function will do the following if permitted by the kernel: If the kernel supports PR_SET_NO_NEW_PRIVS, it will use it. Otherwise it will set the NOROOT option on for PR_SET_SECUREBITS, set the NOROOT_LOCKED option to on for PR_SET_SECUREBITS, set the PR_NO_SETUID_FIXUP option on for PR_SET_SECUREBITS, and set the PR_NO_SETUID_FIXUP_LOCKED option on for PR_SET_SECUREBITS. If both fail, it will return an error.
+
+ .SH "RETURN VALUE"
+
+-This returns 0 on success and a negative number on failure. -1 means a failure setting any of the PR_SET_SECUREBITS options.
++This returns 0 on success and a negative number on failure. -1 means a failure to use PR_SET_NO_NEW_PRIVS and a failure setting any of the PR_SET_SECUREBITS options.
+
+ .SH "SEE ALSO"
+
+diff --git a/src/cap-ng.c b/src/cap-ng.c
+index bd105ba..422f2bc 100644
+--- a/src/cap-ng.c
++++ b/src/cap-ng.c
+@@ -45,6 +45,7 @@
+ * 2.6.24 kernel XATTR_NAME_CAPS
+ * 2.6.25 kernel PR_CAPBSET_DROP, CAPABILITY_VERSION_2
+ * 2.6.26 kernel PR_SET_SECUREBITS, SECURE_*_LOCKED, VERSION_3
++ * 3.5 kernel PR_SET_NO_NEW_PRIVS
+ */
+
+ /* External syscall prototypes */
+@@ -122,6 +123,14 @@ extern int capget(cap_user_header_t header, const cap_user_data_t data);
+ #define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
+ #endif
+
++/* prctl values that we use */
++#ifndef PR_SET_SECUREBITS
++#define PR_SET_SECUREBITS 28
++#endif
++#ifndef PR_SET_NO_NEW_PRIVS
++#define PR_SET_NO_NEW_PRIVS 38
++#endif
++
+ // States: new, allocated, initted, updated, applied
+ typedef enum { CAPNG_NEW, CAPNG_ERROR, CAPNG_ALLOCATED, CAPNG_INIT,
+ CAPNG_UPDATED, CAPNG_APPLIED } capng_states_t;
+@@ -663,15 +672,22 @@ int capng_change_id(int uid, int gid, capng_flags_t flag)
+
+ int capng_lock(void)
+ {
+-#ifdef PR_SET_SECUREBITS
+- int rc = prctl(PR_SET_SECUREBITS,
+- 1 << SECURE_NOROOT |
+- 1 << SECURE_NOROOT_LOCKED |
+- 1 << SECURE_NO_SETUID_FIXUP |
+- 1 << SECURE_NO_SETUID_FIXUP_LOCKED, 0, 0, 0);
++ int rc;
++
++ // On Linux 3.5 and up, we can directly prevent ourselves and
++ // our descendents from gaining privileges.
++ if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == 0)
++ return 0;
++
++ // This kernel is too old or otherwise doesn't support
++ // PR_SET_NO_NEW_PRIVS. Fall back to using securebits.
++ rc = prctl(PR_SET_SECUREBITS,
++ 1 << SECURE_NOROOT |
++ 1 << SECURE_NOROOT_LOCKED |
++ 1 << SECURE_NO_SETUID_FIXUP |
++ 1 << SECURE_NO_SETUID_FIXUP_LOCKED, 0, 0, 0);
+ if (rc)
+ return -1;
+-#endif
+
+ return 0;
+ }
diff --git a/meta-security/recipes-security/libcap-ng/libcap-ng/python.patch b/meta-security/recipes-security/libcap-ng/libcap-ng/python.patch
new file mode 100644
index 000000000..d82ceb454
--- /dev/null
+++ b/meta-security/recipes-security/libcap-ng/libcap-ng/python.patch
@@ -0,0 +1,39 @@
+configure.ac - Avoid an incorrect check for python.
+Makefile.am - avoid hard coded host include paths.
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+--- libcap-ng-0.6.5/configure.ac.orig 2012-01-17 13:59:03.645898989 -0600
++++ libcap-ng-0.6.5/configure.ac 2012-01-17 13:59:46.353959252 -0600
+@@ -120,17 +120,8 @@
+ else
+ AC_MSG_RESULT(testing)
+ AM_PATH_PYTHON
+-if test -f /usr/include/python${am_cv_python_version}/Python.h ; then
+- python_found="yes"
+- AC_MSG_NOTICE(Python bindings will be built)
+-else
+- python_found="no"
+- if test x$use_python = xyes ; then
+- AC_MSG_ERROR([Python explicitly required and python headers found])
+- else
+- AC_MSG_WARN("Python headers not found - python bindings will not be made")
+- fi
+-fi
++python_found="yes"
++AC_MSG_NOTICE(Python bindings will be built)
+ fi
+ AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
+
+--- libcap-ng-0.6.5/bindings/python/Makefile.am.orig 2010-11-03 12:31:59.000000000 -0500
++++ libcap-ng-0.6.5/bindings/python/Makefile.am 2012-01-17 14:05:50.199834467 -0600
+@@ -24,7 +24,8 @@
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+ AM_CFLAGS = -fPIC -DPIC
+ PYLIBVER ?= python$(PYTHON_VERSION)
+-INCLUDES = -I. -I$(top_builddir) -I/usr/include/$(PYLIBVER)
++PYINC ?= /usr/include/$(PYLIBVER)
++INCLUDES = -I. -I$(top_builddir) -I$(PYINC)
+ LIBS = $(top_builddir)/src/libcap-ng.la
+ pyexec_PYTHON = capng.py
+ pyexec_LTLIBRARIES = _capng.la
diff --git a/meta-security/recipes-security/libcap-ng/libcap-ng_0.7.3.bb b/meta-security/recipes-security/libcap-ng/libcap-ng_0.7.3.bb
new file mode 100644
index 000000000..e729518e9
--- /dev/null
+++ b/meta-security/recipes-security/libcap-ng/libcap-ng_0.7.3.bb
@@ -0,0 +1,39 @@
+SUMMARY = "An alternate posix capabilities library"
+DESCRIPTION = "The libcap-ng library is intended to make programming \
+with POSIX capabilities much easier than the traditional libcap library."
+HOMEPAGE = "http://freecode.com/projects/libcap-ng"
+SECTION = "base"
+LICENSE = "GPLv2+ & LGPLv2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+ file://COPYING.LIB;md5=e3eda01d9815f8d24aae2dbd89b68b06"
+
+SRC_URI = "http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${PV}.tar.gz \
+ file://python.patch \
+ file://CVE-2014-3215.patch \
+ "
+
+inherit lib_package autotools pythonnative
+
+SRC_URI[md5sum] = "610afb774f80a8032b711281df126283"
+SRC_URI[sha256sum] = "5ca441c8d3a1e4cfe8a8151907977662679457311ccaa7eaac91447c33a35bb1"
+
+DEPENDS += "swig-native python"
+
+EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' PYINC='${STAGING_INCDIR}/${PYLIBVER}'"
+
+PACKAGES += "${PN}-python"
+
+FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
+FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
+
+BBCLASSEXTEND = "native"
+
+do_install_append() {
+ # Moving libcap-ng to base_libdir
+ if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
+ mkdir -p ${D}/${base_libdir}/
+ mv -f ${D}${libdir}/libcap-ng.so.* ${D}${base_libdir}/
+ relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
+ ln -sf ${relpath}/libcap-ng.so.0.0.0 ${D}${libdir}/libcap-ng.so
+ fi
+}
diff --git a/meta-security/recipes-security/security-manager/security-manager.inc b/meta-security/recipes-security/security-manager/security-manager.inc
new file mode 100644
index 000000000..ee749a8fb
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager.inc
@@ -0,0 +1,98 @@
+DESCRIPTION = "Security manager and utilities"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327;beginline=3"
+
+inherit cmake
+
+# Out-of-tree build is broken ("sqlite3 .security-manager.db <db.sql" where db.sql is in $S/db).
+B = "${S}"
+
+DEPENDS = " \
+attr \
+boost \
+cynara \
+icu \
+libcap \
+smack \
+sqlite3 \
+sqlite3-native \
+systemd \
+"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE"
+
+TZ_SYS_DB = "/var/db/security-manager"
+
+EXTRA_OECMAKE = " \
+-DCMAKE_VERBOSE_MAKEFILE=ON \
+-DVERSION=${PV} \
+-DSYSTEMD_INSTALL_DIR=${systemd_unitdir}/system \
+-DBIN_INSTALL_DIR=${bindir} \
+-DDB_INSTALL_DIR=${TZ_SYS_DB} \
+-DLIB_INSTALL_DIR=${libdir} \
+-DSHARE_INSTALL_PREFIX=${datadir} \
+-DINCLUDE_INSTALL_DIR=${includedir} \
+"
+
+inherit systemd
+SYSTEMD_SERVICE_${PN} = "security-manager.service"
+
+inherit distro_features_check
+REQUIRED_DISTRO_FEATURES += "smack"
+
+# The upstream source code contains the Tizen-specific policy configuration files.
+# To replace them, create a security-manager.bbappend and set the following variable to a
+# space-separated list of policy file names (not URIs!), for example:
+# SECURITY_MANAGER_POLICY = "privilege-group.list usertype-system.profile"
+#
+# Leave it empty to use the upstream Tizen policy.
+SECURITY_MANAGER_POLICY ?= ""
+SRC_URI_append = " ${@' '.join(['file://' + x for x in d.getVar('SECURITY_MANAGER_POLICY', True).split()])}"
+python do_patch_append () {
+ import os
+ import shutil
+ import glob
+ files = d.getVar('SECURITY_MANAGER_POLICY', True).split()
+ if files:
+ s = d.getVar('S', True)
+ workdir = d.getVar('WORKDIR', True)
+ for pattern in ['*.profile', '*.list']:
+ for old_file in glob.glob(s + '/policy/' + pattern):
+ os.unlink(old_file)
+ for file in files:
+ shutil.copy(file, s + '/policy')
+}
+
+do_install_append () {
+ install -d ${D}/${systemd_unitdir}/system/multi-user.target.wants
+ ln -s ../security-manager.service ${D}/${systemd_unitdir}/system/multi-user.target.wants/security-manager.service
+ install -d ${D}/${systemd_unitdir}/system/sockets.target.wants
+ ln -s ../security-manager.socket ${D}/${systemd_unitdir}/system/sockets.target.wants/security-manager.socket
+}
+
+RDEPENDS_${PN} += "smack"
+pkg_postinst_${PN} () {
+ set -e
+ chsmack -a System $D${TZ_SYS_DB}/.security-manager.db
+ chsmack -a System $D${TZ_SYS_DB}/.security-manager.db-journal
+}
+
+FILES_${PN} += " \
+${systemd_unitdir} \
+${TZ_SYS_DB} \
+"
+
+PACKAGES =+ "${PN}-policy"
+FILES_${PN}-policy = " \
+ ${datadir}/${PN} \
+ ${bindir}/security-manager-policy-reload \
+"
+RDEPENDS_${PN}-policy += "sqlite3 cynara"
+pkg_postinst_${PN}-policy () {
+ if [ x"$D" = "x" ] && ${bindir}/security-manager-policy-reload; then
+ exit 0
+ else
+ exit 1
+ fi
+}
diff --git a/meta-security/recipes-security/security-manager/security-manager/0001-Smack-rules-create-two-new-functions.patch b/meta-security/recipes-security/security-manager/security-manager/0001-Smack-rules-create-two-new-functions.patch
new file mode 100644
index 000000000..b0e11afe4
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/0001-Smack-rules-create-two-new-functions.patch
@@ -0,0 +1,116 @@
+From d130a7384428a96f31ad5950ffbffadc0aa29a15 Mon Sep 17 00:00:00 2001
+From: Alejandro Joya <alejandro.joya.cruz@intel.com>
+Date: Wed, 4 Nov 2015 19:01:35 -0600
+Subject: [PATCH 1/2] Smack-rules: create two new functions
+
+It let to smack-rules to create multiple set of rules
+related with the privileges.
+
+It runs from the same bases than for a static set of rules on the
+template, but let you add 1 or many templates for different cases.
+
+Signed-off-by: Alejandro Joya <alejandro.joya.cruz@intel.com>
+---
+ src/common/include/smack-rules.h | 15 ++++++++++++++
+ src/common/smack-rules.cpp | 44 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 59 insertions(+)
+
+diff --git a/src/common/include/smack-rules.h b/src/common/include/smack-rules.h
+index 91446a7..f9fa438 100644
+--- a/src/common/include/smack-rules.h
++++ b/src/common/include/smack-rules.h
+@@ -47,6 +47,8 @@ public:
+ void addFromTemplate(const std::vector<std::string> &templateRules,
+ const std::string &appId, const std::string &pkgId);
+ void addFromTemplateFile(const std::string &appId, const std::string &pkgId);
++ void addFromTemplateFile(const std::string &appId, const std::string &pkgId,
++ const std::string &path);
+
+ void apply() const;
+ void clear() const;
+@@ -75,6 +77,19 @@ public:
+ static void installApplicationRules(const std::string &appId, const std::string &pkgId,
+ const std::vector<std::string> &pkgContents);
+ /**
++ * Install privileges-specific smack rules.
++ *
++ * Function creates smack rules using predefined template. Rules are applied
++ * to the kernel and saved on persistent storage so they are loaded on system boot.
++ *
++ * @param[in] appId - application id that is beeing installed
++ * @param[in] pkgId - package id that the application is in
++ * @param[in] pkgContents - a list of all applications in the package
++ * @param[in] privileges - a list of all prvileges
++ */
++ static void installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId,
++ const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges);
++ /**
+ * Uninstall package-specific smack rules.
+ *
+ * Function loads package-specific smack rules, revokes them from the kernel
+diff --git a/src/common/smack-rules.cpp b/src/common/smack-rules.cpp
+index 3629e0f..d834e42 100644
+--- a/src/common/smack-rules.cpp
++++ b/src/common/smack-rules.cpp
+@@ -135,6 +135,29 @@ void SmackRules::saveToFile(const std::string &path) const
+ }
+ }
+
++void SmackRules::addFromTemplateFile(const std::string &appId,
++ const std::string &pkgId, const std::string &path)
++{
++ std::vector<std::string> templateRules;
++ std::string line;
++ std::ifstream templateRulesFile(path);
++
++ if (!templateRulesFile.is_open()) {
++ LogError("Cannot open rules template file: " << path);
++ ThrowMsg(SmackException::FileError, "Cannot open rules template file: " << path);
++ }
++
++ while (std::getline(templateRulesFile, line)) {
++ templateRules.push_back(line);
++ }
++
++ if (templateRulesFile.bad()) {
++ LogError("Error reading template file: " << APP_RULES_TEMPLATE_FILE_PATH);
++ ThrowMsg(SmackException::FileError, "Error reading template file: " << APP_RULES_TEMPLATE_FILE_PATH);
++ }
++
++ addFromTemplate(templateRules, appId, pkgId);
++}
+
+ void SmackRules::addFromTemplateFile(const std::string &appId,
+ const std::string &pkgId)
+@@ -223,7 +246,28 @@ std::string SmackRules::getApplicationRulesFilePath(const std::string &appId)
+ std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("app_" + appId).c_str()));
+ return path;
+ }
++void SmackRules::installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId,
++ const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges)
++{
++ SmackRules smackRules;
++ std::string appPath = getApplicationRulesFilePath(appId);
++ smackRules.loadFromFile(appPath);
++ struct stat buffer;
++ for (auto privilege : privileges) {
++ if (privilege.empty())
++ continue;
++ std::string fprivilege ( privilege + "-template.smack");
++ std::string path(tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", fprivilege.c_str()));
++ if( stat(path.c_str(), &buffer) == 0)
++ smackRules.addFromTemplateFile(appId, pkgId, path);
++ }
++
++ if (smack_smackfs_path() != NULL)
++ smackRules.apply();
+
++ smackRules.saveToFile(appPath);
++ updatePackageRules(pkgId, pkgContents);
++}
+ void SmackRules::installApplicationRules(const std::string &appId, const std::string &pkgId,
+ const std::vector<std::string> &pkgContents)
+ {
+--
+2.1.0
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/0002-app-install-implement-multiple-set-of-smack-rules.patch b/meta-security/recipes-security/security-manager/security-manager/0002-app-install-implement-multiple-set-of-smack-rules.patch
new file mode 100644
index 000000000..d60096a15
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/0002-app-install-implement-multiple-set-of-smack-rules.patch
@@ -0,0 +1,34 @@
+From 19688cbe2ca10921a499f3fa265928dca54cf98d Mon Sep 17 00:00:00 2001
+From: Alejandro Joya <alejandro.joya.cruz@intel.com>
+Date: Wed, 4 Nov 2015 19:06:23 -0600
+Subject: [PATCH 2/2] app-install: implement multiple set of smack-rules
+
+If it's need it could create load multiple set of smack rules
+related with the privileges.
+It wouldn't affect the case that only the default set of rules is need it.
+
+Signed-off-by: Alejandro Joya <alejandro.joya.cruz@intel.com>
+---
+ src/common/service_impl.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp
+index 7fd621c..ae305d3 100644
+--- a/src/common/service_impl.cpp
++++ b/src/common/service_impl.cpp
+@@ -338,6 +338,12 @@ int appInstall(const app_inst_req &req, uid_t uid)
+ LogDebug("Adding Smack rules for new appId: " << req.appId << " with pkgId: "
+ << req.pkgId << ". Applications in package: " << pkgContents.size());
+ SmackRules::installApplicationRules(req.appId, req.pkgId, pkgContents);
++ /*Setup for privileges custom rules*/
++ LogDebug("Adding Smack rules for new appId: " << req.appId << " with pkgId: "
++ << req.pkgId << ". Applications in package: " << pkgContents.size()
++ << " and Privileges");
++ SmackRules::installApplicationPrivilegesRules(req.appId, req.pkgId,
++ pkgContents,req.privileges);
+ } catch (const SmackException::Base &e) {
+ LogError("Error while applying Smack policy for application: " << e.DumpToString());
+ return SECURITY_MANAGER_API_ERROR_SETTING_FILE_LABEL_FAILED;
+--
+2.1.0
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/Removing-tizen-platform-config.patch b/meta-security/recipes-security/security-manager/security-manager/Removing-tizen-platform-config.patch
new file mode 100644
index 000000000..4baea6572
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/Removing-tizen-platform-config.patch
@@ -0,0 +1,196 @@
+From 72e66d0e42f3bb6efd689ce33b1df407d94b3c60 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Mon, 16 Nov 2015 14:26:25 +0100
+Subject: [PATCH] Removing tizen-platform-config
+
+Change-Id: Ic832a2b75229517b09faba969c27fb1a4b490121
+---
+ policy/security-manager-policy-reload | 2 +-
+ src/common/file-lock.cpp | 4 +---
+ src/common/include/file-lock.h | 1 -
+ src/common/include/privilege_db.h | 3 +--
+ src/common/service_impl.cpp | 39 +++++++++++------------------------
+ src/common/smack-rules.cpp | 12 ++++-------
+ 6 files changed, 19 insertions(+), 42 deletions(-)
+
+diff --git a/policy/security-manager-policy-reload b/policy/security-manager-policy-reload
+index 6f211c6..ed8047a 100755
+--- a/policy/security-manager-policy-reload
++++ b/policy/security-manager-policy-reload
+@@ -2,7 +2,7 @@
+
+ POLICY_PATH=/usr/share/security-manager/policy
+ PRIVILEGE_GROUP_MAPPING=$POLICY_PATH/privilege-group.list
+-DB_FILE=`tzplatform-get TZ_SYS_DB | cut -d= -f2`/.security-manager.db
++DB_FILE=/usr/dbspace/.security-manager.db
+
+ # Create default buckets
+ while read bucket default_policy
+diff --git a/src/common/file-lock.cpp b/src/common/file-lock.cpp
+index 6f3996c..1dada17 100644
+--- a/src/common/file-lock.cpp
++++ b/src/common/file-lock.cpp
+@@ -30,9 +30,7 @@
+
+ namespace SecurityManager {
+
+-char const * const SERVICE_LOCK_FILE = tzplatform_mkpath3(TZ_SYS_RUN,
+- "lock",
+- "security-manager.lock");
++char const * const SERVICE_LOCK_FILE = "/var/run/lock/security-manager.lock";
+
+ FileLocker::FileLocker(const std::string &lockFile, bool blocking)
+ {
+diff --git a/src/common/include/file-lock.h b/src/common/include/file-lock.h
+index 604b019..21a86a0 100644
+--- a/src/common/include/file-lock.h
++++ b/src/common/include/file-lock.h
+@@ -29,7 +29,6 @@
+
+ #include <dpl/exception.h>
+ #include <dpl/noncopyable.h>
+-#include <tzplatform_config.h>
+
+ namespace SecurityManager {
+
+diff --git a/src/common/include/privilege_db.h b/src/common/include/privilege_db.h
+index 4d73d90..03c6680 100644
+--- a/src/common/include/privilege_db.h
++++ b/src/common/include/privilege_db.h
+@@ -34,14 +34,13 @@
+ #include <string>
+
+ #include <dpl/db/sql_connection.h>
+-#include <tzplatform_config.h>
+
+ #ifndef PRIVILEGE_DB_H_
+ #define PRIVILEGE_DB_H_
+
+ namespace SecurityManager {
+
+-const char *const PRIVILEGE_DB_PATH = tzplatform_mkpath(TZ_SYS_DB, ".security-manager.db");
++const char *const PRIVILEGE_DB_PATH = "/usr/dbspace/.security-manager.db";
+
+ enum class QueryType {
+ EGetPkgPrivileges,
+diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp
+index ae305d3..65cc8b5 100644
+--- a/src/common/service_impl.cpp
++++ b/src/common/service_impl.cpp
+@@ -32,7 +32,6 @@
+ #include <algorithm>
+
+ #include <dpl/log/log.h>
+-#include <tzplatform_config.h>
+
+ #include "protocols.h"
+ #include "privilege_db.h"
+@@ -131,7 +130,13 @@ static inline int validatePolicy(policy_entry &policyEntry, std::string uidStr,
+
+ static uid_t getGlobalUserId(void)
+ {
+- static uid_t globaluid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
++ static uid_t globaluid = 0;
++ if (!globaluid) {
++ struct passwd pw, *p;
++ char buf[4096];
++ int rc = getpwnam_r("userapp", &pw, buf, sizeof buf, &p);
++ globaluid = (rc || p == NULL) ? 555 : p->pw_uid;
++ }
+ return globaluid;
+ }
+
+@@ -161,37 +166,17 @@ static inline bool isSubDir(const char *parent, const char *subdir)
+
+ static bool getUserAppDir(const uid_t &uid, std::string &userAppDir)
+ {
+- struct tzplatform_context *tz_ctx = nullptr;
+-
+- if (tzplatform_context_create(&tz_ctx))
+- return false;
+-
+- if (tzplatform_context_set_user(tz_ctx, uid)) {
+- tzplatform_context_destroy(tz_ctx);
+- tz_ctx = nullptr;
++ struct passwd pw, *p;
++ char buf[4096];
++ int rc = getpwuid_r(uid, &pw, buf, sizeof buf, &p);
++ if (rc || p == NULL)
+ return false;
+- }
+-
+- enum tzplatform_variable id =
+- (uid == getGlobalUserId()) ? TZ_SYS_RW_APP : TZ_USER_APP;
+- const char *appDir = tzplatform_context_getenv(tz_ctx, id);
+- if (!appDir) {
+- tzplatform_context_destroy(tz_ctx);
+- tz_ctx = nullptr;
+- return false;
+- }
+-
+- userAppDir = appDir;
+-
+- tzplatform_context_destroy(tz_ctx);
+- tz_ctx = nullptr;
+-
++ userAppDir = p->pw_dir;
+ return true;
+ }
+
+ static inline bool installRequestAuthCheck(const app_inst_req &req, uid_t uid, bool &isCorrectPath, std::string &appPath)
+ {
+- std::string userHome;
+ std::string userAppDir;
+ std::stringstream correctPath;
+
+diff --git a/src/common/smack-rules.cpp b/src/common/smack-rules.cpp
+index d834e42..8b5728b 100644
+--- a/src/common/smack-rules.cpp
++++ b/src/common/smack-rules.cpp
+@@ -34,7 +34,6 @@
+ #include <memory>
+
+ #include <dpl/log/log.h>
+-#include <tzplatform_config.h>
+
+ #include "smack-labels.h"
+ #include "smack-rules.h"
+@@ -43,7 +42,7 @@ namespace SecurityManager {
+
+ const char *const SMACK_APP_LABEL_TEMPLATE = "~APP~";
+ const char *const SMACK_PKG_LABEL_TEMPLATE = "~PKG~";
+-const char *const APP_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", "app-rules-template.smack");
++const char *const APP_RULES_TEMPLATE_FILE_PATH = "/usr/share/security-manager/policy/app-rules-template.smack";
+ const char *const SMACK_APP_IN_PACKAGE_PERMS = "rwxat";
+
+ SmackRules::SmackRules()
+@@ -237,14 +236,12 @@ void SmackRules::generatePackageCrossDeps(const std::vector<std::string> &pkgCon
+
+ std::string SmackRules::getPackageRulesFilePath(const std::string &pkgId)
+ {
+- std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("pkg_" + pkgId).c_str()));
+- return path;
++ return "/etc/smack/accesses.d/pkg_" + pkgId;
+ }
+
+ std::string SmackRules::getApplicationRulesFilePath(const std::string &appId)
+ {
+- std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("app_" + appId).c_str()));
+- return path;
++ return "/etc/smack/accesses.d/app_" + appId;
+ }
+ void SmackRules::installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId,
+ const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges)
+@@ -256,8 +253,7 @@ void SmackRules::installApplicationPrivilegesRules(const std::string &appId, con
+ for (auto privilege : privileges) {
+ if (privilege.empty())
+ continue;
+- std::string fprivilege ( privilege + "-template.smack");
+- std::string path(tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", fprivilege.c_str()));
++ std::string path = "/usr/share/security-manager/policy/" + privilege + "-template.smack";
+ if( stat(path.c_str(), &buffer) == 0)
+ smackRules.addFromTemplateFile(appId, pkgId, path);
+ }
+--
+2.1.4
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/c-11-replace-depracated-auto_ptr.patch b/meta-security/recipes-security/security-manager/security-manager/c-11-replace-depracated-auto_ptr.patch
new file mode 100644
index 000000000..c312a9e72
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/c-11-replace-depracated-auto_ptr.patch
@@ -0,0 +1,32 @@
+From 6abeec29a0e704f4bf7084b29275b99fea0a78de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net>
+Date: Wed, 13 Jan 2016 17:30:06 +0100
+Subject: [PATCH 2/2] c++11: replace depracated auto_ptr
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Submitted [https://review.tizen.org/gerrit/#/c/56940/]
+
+Change-Id: Id793c784c9674eef48f346226c094bdd9f7bbda8
+Signed-off-by: José Bollo <jobol@nonadev.net>
+---
+ src/dpl/core/include/dpl/binary_queue.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/dpl/core/include/dpl/binary_queue.h b/src/dpl/core/include/dpl/binary_queue.h
+index dd03f5e..185b6c7 100644
+--- a/src/dpl/core/include/dpl/binary_queue.h
++++ b/src/dpl/core/include/dpl/binary_queue.h
+@@ -33,7 +33,7 @@ namespace SecurityManager {
+ * Binary queue auto pointer
+ */
+ class BinaryQueue;
+-typedef std::auto_ptr<BinaryQueue> BinaryQueueAutoPtr;
++typedef std::unique_ptr<BinaryQueue> BinaryQueueAutoPtr;
+
+ /**
+ * Binary stream implemented as constant size bucket list
+--
+2.1.4
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/include-linux-xattr.patch b/meta-security/recipes-security/security-manager/security-manager/include-linux-xattr.patch
new file mode 100644
index 000000000..33fbc025e
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/include-linux-xattr.patch
@@ -0,0 +1,24 @@
+From: José Bollo <jose.bollo@iot.bzh>
+Date: Tue, 30 Oct 2015 14:32:03 -0100
+Subject: [PATCH] include linux xattr
+
+adds a #include <linux/xattr.h> in source.
+
+---
+ src/client/client-security-manager.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/client/client-security-manager.cpp b/src/client/client-security-manager.cpp
+index 74a6b30..641790b 100644
+--- a/src/client/client-security-manager.cpp
++++ b/src/client/client-security-manager.cpp
+@@ -34,6 +34,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/xattr.h>
++#include <linux/xattr.h>
+ #include <sys/smack.h>
+ #include <sys/capability.h>
+
+--
+2.1.4
diff --git a/meta-security/recipes-security/security-manager/security-manager/libcap-without-pkgconfig.patch b/meta-security/recipes-security/security-manager/security-manager/libcap-without-pkgconfig.patch
new file mode 100644
index 000000000..a948343f8
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/libcap-without-pkgconfig.patch
@@ -0,0 +1,32 @@
+From: José Bollo <jose.bollo@iot.bzh>
+Date: Tue, 30 Oct 2015 14:32:03 -0100
+Subject: [PATCH] libcap without pkgconfig
+
+Handles libcap that isn't distributed for pkg-config
+
+---
+ src/client/CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
+index 5399a55..0250ce2 100644
+--- a/src/client/CMakeLists.txt
++++ b/src/client/CMakeLists.txt
+@@ -1,7 +1,6 @@
+ PKG_CHECK_MODULES(CLIENT_DEP
+ REQUIRED
+ libsmack
+- libcap
+ )
+
+ SET(CLIENT_VERSION_MAJOR 1)
+@@ -37,6 +36,7 @@ SET_TARGET_PROPERTIES(${TARGET_CLIENT}
+ TARGET_LINK_LIBRARIES(${TARGET_CLIENT}
+ ${TARGET_COMMON}
+ ${CLIENT_DEP_LIBRARIES}
++ cap
+ )
+
+ INSTALL(TARGETS ${TARGET_CLIENT} DESTINATION ${LIB_INSTALL_DIR})
+--
+2.1.4
diff --git a/meta-security/recipes-security/security-manager/security-manager/removes-dependency-to-libslp-db-utils.patch b/meta-security/recipes-security/security-manager/security-manager/removes-dependency-to-libslp-db-utils.patch
new file mode 100644
index 000000000..f94973074
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/removes-dependency-to-libslp-db-utils.patch
@@ -0,0 +1,78 @@
+From 1e2f8f58d4320afa1d83a6f94822e53346108ee8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Mon, 16 Nov 2015 15:56:27 +0100
+Subject: [PATCH] removes dependency to libslp-db-utils
+
+Change-Id: I90471e77d20e04bae58cc42eb2639e4aef97fdec
+---
+ src/common/CMakeLists.txt | 1 ++-
+ src/dpl/db/src/sql_connection.cpp | 17 +----------------
+ 2 files changed, 3 additions(+), 17 deletions(-)
+
+diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
+index 968c7c1..d1fe644 100644
+--- a/src/common/CMakeLists.txt
++++ b/src/common/CMakeLists.txt
+@@ -5,7 +5,8 @@ PKG_CHECK_MODULES(COMMON_DEP
+ REQUIRED
+ libsystemd
+ libsmack
+- db-util
++ sqlite3
++ icu-i18n
+ cynara-admin
+ cynara-client
+ )
+diff --git a/src/dpl/db/src/sql_connection.cpp b/src/dpl/db/src/sql_connection.cpp
+index fdb4fe4..1fb97be 100644
+--- a/src/dpl/db/src/sql_connection.cpp
++++ b/src/dpl/db/src/sql_connection.cpp
+@@ -26,7 +26,6 @@
+ #include <memory>
+ #include <dpl/noncopyable.h>
+ #include <dpl/assert.h>
+-#include <db-util.h>
+ #include <unistd.h>
+ #include <cstdio>
+ #include <cstdarg>
+@@ -606,16 +605,7 @@ void SqlConnection::Connect(const std::string &address,
+
+ // Connect to database
+ int result;
+- if (type & Flag::UseLucene) {
+- result = db_util_open_with_options(
+- address.c_str(),
+- &m_connection,
+- flag,
+- NULL);
+-
+- m_usingLucene = true;
+- LogPedantic("Lucene index enabled");
+- } else {
++ (void)type;
+ result = sqlite3_open_v2(
+ address.c_str(),
+ &m_connection,
+@@ -624,7 +614,6 @@ void SqlConnection::Connect(const std::string &address,
+
+ m_usingLucene = false;
+ LogPedantic("Lucene index disabled");
+- }
+
+ if (result == SQLITE_OK) {
+ LogPedantic("Connected to DB");
+@@ -653,11 +642,7 @@ void SqlConnection::Disconnect()
+
+ int result;
+
+- if (m_usingLucene) {
+- result = db_util_close(m_connection);
+- } else {
+ result = sqlite3_close(m_connection);
+- }
+
+ if (result != SQLITE_OK) {
+ const char *error = sqlite3_errmsg(m_connection);
+--
+2.1.4
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/security-manager-policy-reload-do-not-depend-on-GNU-.patch b/meta-security/recipes-security/security-manager/security-manager/security-manager-policy-reload-do-not-depend-on-GNU-.patch
new file mode 100644
index 000000000..ac57964ca
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/security-manager-policy-reload-do-not-depend-on-GNU-.patch
@@ -0,0 +1,35 @@
+From d2995014142306987bf86b4d508a84b9b4683c5c Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Wed, 19 Aug 2015 15:02:32 +0200
+Subject: [PATCH 2/2] security-manager-policy-reload: do not depend on GNU sed
+
+\U (= make replacement uppercase) is a GNU sed extension which is not
+supported by other sed implementation's (like the one from
+busybox). When using busybox, the bucket for user profiles became
+USER_TYPE_Uadmin instead USER_TYPE_ADMIN.
+
+To make SecurityManager more portable, better use tr to turn the
+bucket name into uppercase.
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+Upstream-Status: Submitted (https://github.com/Samsung/security-manager/pull/1
+
+---
+ policy/security-manager-policy-reload | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/policy/security-manager-policy-reload b/policy/security-manager-policy-reload
+index 274c49c..6f211c6 100755
+--- a/policy/security-manager-policy-reload
++++ b/policy/security-manager-policy-reload
+@@ -33,7 +33,7 @@ END
+ find "$POLICY_PATH" -name "usertype-*.profile" |
+ while read file
+ do
+- bucket="`echo $file | sed -r 's|.*/usertype-(.*).profile$|USER_TYPE_\U\1|'`"
++ bucket="`echo $file | sed -r 's|.*/usertype-(.*).profile$|USER_TYPE_\1|' | tr '[:lower:]' '[:upper:]'`"
+
+ # Re-create the bucket with empty contents
+ cyad --delete-bucket=$bucket || true
+--
+2.1.4
diff --git a/meta-security/recipes-security/security-manager/security-manager/socket-manager-removes-tizen-specific-call.patch b/meta-security/recipes-security/security-manager/security-manager/socket-manager-removes-tizen-specific-call.patch
new file mode 100644
index 000000000..fa4c21c7f
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/socket-manager-removes-tizen-specific-call.patch
@@ -0,0 +1,47 @@
+From 75c4852e47217ab85d6840b488ab4b3688091856 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
+Date: Fri, 8 Jan 2016 16:53:46 +0100
+Subject: [PATCH 1/2] socket-manager: removes tizen specific call
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The function 'smack_fgetlabel' is specific to Tizen
+and is no more maintained upstream.
+
+Upstream-Status: Accepted [https://review.tizen.org/gerrit/#/c/56507/]
+
+Change-Id: I3802742b1758efe37b33e6d968ff727d68f2fd1f
+Signed-off-by: José Bollo <jobol@nonadev.net>
+---
+ src/server/main/socket-manager.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/server/main/socket-manager.cpp b/src/server/main/socket-manager.cpp
+index 0366186..c5cec18 100644
+--- a/src/server/main/socket-manager.cpp
++++ b/src/server/main/socket-manager.cpp
+@@ -30,6 +30,7 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/smack.h>
++#include <linux/xattr.h>
+ #include <sys/un.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -500,9 +501,9 @@ int SocketManager::CreateDomainSocketHelp(
+ if (smack_check()) {
+ LogInfo("Set up smack label: " << desc.smackLabel);
+
+- if (0 != smack_fsetlabel(sockfd, desc.smackLabel.c_str(), SMACK_LABEL_IPIN)) {
+- LogError("Error in smack_fsetlabel");
+- ThrowMsg(Exception::InitFailed, "Error in smack_fsetlabel");
++ if (0 != smack_set_label_for_file(sockfd, XATTR_NAME_SMACKIPIN, desc.smackLabel.c_str())) {
++ LogError("Error in smack_set_label_for_file");
++ ThrowMsg(Exception::InitFailed, "Error in smack_set_label_for_file");
+ }
+ } else {
+ LogInfo("No smack on platform. Socket won't be securied with smack label!");
+--
+2.1.4
+
diff --git a/meta-security/recipes-security/security-manager/security-manager/systemd-stop-using-compat-libs.patch b/meta-security/recipes-security/security-manager/security-manager/systemd-stop-using-compat-libs.patch
new file mode 100644
index 000000000..cd5c36a6a
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager/systemd-stop-using-compat-libs.patch
@@ -0,0 +1,47 @@
+From 8ec024d2adecb53029c6f1af2b95c93dfd43a7cb Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Tue, 24 Mar 2015 04:54:03 -0700
+Subject: [PATCH] systemd: stop using compat libs
+
+libsystemd-journal and libsystemd-daemon are considered obsolete
+in systemd since 2.09 and may not be available (not compiled
+by default).
+
+The code works fine with the current libsystemd, so just
+use that.
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+Upstream-Status: Submitted (https://github.com/Samsung/security-manager/pull/1
+
+---
+ src/common/CMakeLists.txt | 2 +-
+ src/server/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
+index 2da9c3e..968c7c1 100644
+--- a/src/common/CMakeLists.txt
++++ b/src/common/CMakeLists.txt
+@@ -3,7 +3,7 @@ SET(COMMON_VERSION ${COMMON_VERSION_MAJOR}.0.2)
+
+ PKG_CHECK_MODULES(COMMON_DEP
+ REQUIRED
+- libsystemd-journal
++ libsystemd
+ libsmack
+ db-util
+ cynara-admin
+diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
+index 753eb96..6849d76 100644
+--- a/src/server/CMakeLists.txt
++++ b/src/server/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ PKG_CHECK_MODULES(SERVER_DEP
+ REQUIRED
+- libsystemd-daemon
++ libsystemd
+ )
+
+ FIND_PACKAGE(Boost REQUIRED)
+--
+2.1.4
diff --git a/meta-security/recipes-security/security-manager/security-manager_git.bb b/meta-security/recipes-security/security-manager/security-manager_git.bb
new file mode 100644
index 000000000..65134d31a
--- /dev/null
+++ b/meta-security/recipes-security/security-manager/security-manager_git.bb
@@ -0,0 +1,34 @@
+require security-manager.inc
+
+PV = "1.0.2+git${SRCPV}"
+SRCREV = "860305a595d681d650024ad07b3b0977e1fcb0a6"
+SRC_URI += "git://github.com/Samsung/security-manager.git"
+S = "${WORKDIR}/git"
+
+SRC_URI += " \
+file://systemd-stop-using-compat-libs.patch \
+file://security-manager-policy-reload-do-not-depend-on-GNU-.patch \
+file://0001-Smack-rules-create-two-new-functions.patch \
+file://0002-app-install-implement-multiple-set-of-smack-rules.patch \
+file://c-11-replace-depracated-auto_ptr.patch \
+file://socket-manager-removes-tizen-specific-call.patch \
+file://Removing-tizen-platform-config.patch \
+file://removes-dependency-to-libslp-db-utils.patch \
+"
+
+##########################################
+# This are patches for backward compatibility to the version dizzy of poky.
+# The dizzy version of libcap isn't providing a packconfig file.
+# This is solved by the patch libcap-without-pkgconfig.patch.
+# But after solving that issue, it appears that linux/xattr.h should
+# also be include add definitions of XATTR_NAME_SMACK... values.
+# Unfortunately, there is no explanation why linux/xattr.h should
+# also be included (patch include-linux-xattr.patch)
+##########################################
+do_patch[depends] = "libcap:do_populate_sysroot"
+APPLY = "${@str('no' if os.path.exists('${STAGING_LIBDIR}/pkgconfig/libcap.pc') else 'yes')}"
+SRC_URI += "\
+ file://libcap-without-pkgconfig.patch;apply=${APPLY} \
+ file://include-linux-xattr.patch;apply=${APPLY} \
+"
+
diff --git a/meta-security/recipes-security/smacknet/files/smacknet b/meta-security/recipes-security/smacknet/files/smacknet
new file mode 100644
index 000000000..3818d30ae
--- /dev/null
+++ b/meta-security/recipes-security/smacknet/files/smacknet
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+# Copyright (c) 2012, 2013, Intel Corporation
+# Copyright (c) 2009 David Wolinsky <davidiw@ufl.edu), University of Florida
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import socket,fcntl, struct, thread
+import os.path
+import sys
+
+SMACKFS_LOAD="/sys/fs/smackfs/load2"
+SMACKFS_NETLABEL="/sys/fs/smackfs/netlabel"
+SIOCGIFADDR = 0x8915
+SIOCGIFNETMASK = 0x891b
+
+def get_ip_address(ifname):
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ return fcntl.ioctl(s.fileno(), SIOCGIFADDR,
+ struct.pack('256s', ifname.encode("utf-8")))[20:24]
+
+def get_netmask(ifname):
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ return fcntl.ioctl(s.fileno(), SIOCGIFNETMASK,
+ struct.pack('256s', ifname.encode("utf-8")))[20:24]
+
+def applynetlabeltags(interface, addr):
+ if not interface.startswith("lo"):
+ bmask = get_netmask(interface.encode("utf-8"))
+ prefix = bin(struct.unpack(">L", bmask)[0]).count("1")
+ tags = [
+ addr+"/"+str(prefix)+" Network::Local\n",
+ "0.0.0.0/0 Network::Cloud\n",
+ "127.0.0.1/8 -CIPSO\n"]
+ smackfs_netlabel(tags)
+
+def loadnetlabelrules():
+ rulesSystem = [
+ "System Network::Cloud w\n",
+ "System Network::Local w\n",
+ "Network::Cloud System w\n",
+ "Network::Local System w\n"]
+ smackfs_load2(rulesSystem)
+
+def smackfs_load2 (rules):
+ with open(SMACKFS_LOAD, "w") as load2:
+ for rule in rules:
+ load2.write(rule)
+
+def smackfs_netlabel (tags):
+ for tag in tags:
+ with open(SMACKFS_NETLABEL, "w") as netlabel:
+ netlabel.write(tag)
+
+"""
+ Source of: Class ip monitor, and other functions named bellow.
+ Original author: David Wolinsky <davidiw@ufl.edu
+ Copied from: https://github.com/davidiw/Grid-Appliance/blob/master/scripts/ip_monitor.py
+
+"""
+
+"""4 byte alignment"""
+
+def align(inc):
+ diff = inc % 4
+ return inc + ((4 - diff) % 4)
+
+class ifaddr:
+ """Parse an ifaddr packet"""
+ LOCAL = 2
+ LABEL = 3
+
+ def __init__(self, packet):
+ self.family, self.prefixlen, self.flags, self.scope, self.index = \
+ struct.unpack("BBBBI", packet[:8])
+
+class rtattr:
+ """Parse a rtattr packet"""
+ GRP_IPV4_IFADDR = 0x10
+
+ NEWADDR = 20
+ DELADDR = 21
+ GETADDR = 22
+
+ def __init__(self, packet):
+ self.len, self.type = struct.unpack("HH", packet[:4])
+ if self.type == ifaddr.LOCAL:
+ addr = struct.unpack("BBBB", packet[4:self.len])
+ self.payload = "%s.%s.%s.%s" % (addr[0], addr[1], addr[2], addr[3])
+ elif self.type == ifaddr.LABEL:
+ self.payload = packet[4:self.len].strip("\0")
+ else:
+ self.payload = packet[4:self.len]
+
+class netlink:
+ """Parse a netlink packet"""
+ REQUEST = 1
+ ROOT = 0x100
+ MATCH = 0x200
+ DONE = 3
+
+ def __init__(self, packet):
+ self.msglen, self.msgtype, self.flags, self.seq, self.pid = \
+ struct.unpack("IHHII", packet[:16])
+ self.ifa = None
+ try:
+ self.ifa = ifaddr(packet[16:24])
+ except:
+ return
+
+ self.rtas = {}
+ pos = 24
+ while pos < self.msglen:
+ try:
+ rta = rtattr(packet[pos:])
+ except:
+ break
+ pos += align(rta.len)
+ self.rtas[rta.type] = rta.payload
+
+class ip_monitor:
+ def __init__(self, callback = None):
+ if callback == None:
+ callback = self.print_cb
+ self._callback = callback
+
+ def print_cb(self, label, addr):
+ print (label + " => " + addr)
+
+ def request_addrs(self, sock):
+ sock.send(struct.pack("IHHIIBBBBI", 24, rtattr.GETADDR, \
+ netlink.REQUEST | netlink.ROOT | netlink.MATCH, 0, sock.getsockname()[0], \
+ socket.AF_INET, 0, 0, 0, 0))
+
+ def start_thread(self):
+ thread.start_new_thread(self.run, ())
+
+ def run(self):
+ sock = socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, socket.NETLINK_ROUTE)
+ sock.bind((0, rtattr.GRP_IPV4_IFADDR))
+ self.request_addrs(sock)
+
+ while True:
+ data = sock.recv(4096)
+ pos = 0
+ while pos < len(data):
+ nl = netlink(data[pos:])
+ if nl.msgtype == netlink.DONE:
+ break
+ pos += align(nl.msglen)
+ if nl.msgtype != rtattr.NEWADDR:
+ continue
+ self._callback(nl.rtas[ifaddr.LABEL], nl.rtas[ifaddr.LOCAL])
+
+def main():
+ if not os.path.isfile(SMACKFS_LOAD):
+ print ("Smack not found.")
+ return -1
+ loadnetlabelrules()
+
+ ip_monitor(applynetlabeltags).run()
+
+if __name__ == "__main__":
+ main()
diff --git a/meta-security/recipes-security/smacknet/files/smacknet.service b/meta-security/recipes-security/smacknet/files/smacknet.service
new file mode 100644
index 000000000..218d8b896
--- /dev/null
+++ b/meta-security/recipes-security/smacknet/files/smacknet.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=netlabels configuration for SMACK
+Wants=network.target network-online.target
+After=network.target network-online.target
+
+[Service]
+TimeoutStartSec=0
+ExecStart=@BINDIR@/smacknet
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-security/recipes-security/smacknet/smacknet.bb b/meta-security/recipes-security/smacknet/smacknet.bb
new file mode 100644
index 000000000..553456aee
--- /dev/null
+++ b/meta-security/recipes-security/smacknet/smacknet.bb
@@ -0,0 +1,29 @@
+#SMACKNET Description
+SUMMARY = "Smack network labels configuration"
+DESCRIPTION = "Provide service that will be labeling the network rules"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"
+RDEPENDS_${PN} = "python"
+
+SRC_URI += "file://smacknet \
+ file://smacknet.service \
+ "
+S = "${WORKDIR}"
+
+inherit systemd
+
+inherit distro_features_check
+REQUIRED_DISTRO_FEATURES = "smack"
+
+#netlabel configuration service
+SYSTEMD_SERVICE_${PN} = "smacknet.service"
+SYSTEMD_AUTO_ENABLE = "enable"
+do_install(){
+ install -d ${D}${bindir}
+ install -m 0551 ${WORKDIR}/smacknet ${D}${bindir}
+
+ install -d -m 755 ${D}${systemd_unitdir}/system
+ install -m 644 ${WORKDIR}/smacknet.service ${D}${systemd_unitdir}/system
+ sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/smacknet.service
+}
+
diff --git a/templates/base/00_local.conf.agl.inc b/templates/base/00_local.conf.agl.inc
index 1cfd90557..1128b323b 100644
--- a/templates/base/00_local.conf.agl.inc
+++ b/templates/base/00_local.conf.agl.inc
@@ -6,3 +6,6 @@ DISTRO = "poky-agl"
#see meta-agl/meta-agl/conf/include/base-agl.inc
require conf/include/base-agl.inc
+
+# Temporarily disable GObject Introspection Data
+GI_DATA_ENABLED = "False"
diff --git a/templates/base/bblayers.conf.sample b/templates/base/bblayers.conf.sample
index 6bccb7932..d86954698 100644
--- a/templates/base/bblayers.conf.sample
+++ b/templates/base/bblayers.conf.sample
@@ -35,7 +35,6 @@ AGL_CORE_LAYERS = " \
AGL_CORE_DEPENDENCY_LAYERS = " \
${METADIR}/meta-openembedded/meta-oe \
${METADIR}/meta-openembedded/meta-multimedia \
- ${METADIR}/meta-openembedded/meta-efl \
${METADIR}/meta-openembedded/meta-networking \
${METADIR}/meta-openembedded/meta-python \
${METADIR}/meta-openembedded/meta-filesystems \
diff --git a/templates/feature/agl-appfw-smack/50_bblayers.conf.inc b/templates/feature/agl-appfw-smack/50_bblayers.conf.inc
index 344c25070..7f5f24eb5 100644
--- a/templates/feature/agl-appfw-smack/50_bblayers.conf.inc
+++ b/templates/feature/agl-appfw-smack/50_bblayers.conf.inc
@@ -1,6 +1,7 @@
BBLAYERS =+ " \
- ${METADIR}/meta-intel-iot-security/meta-security-smack \
- ${METADIR}/meta-intel-iot-security/meta-security-framework \
+ ${METADIR}/meta-security \
+ ${METADIR}/meta-openembedded/meta-perl \
+ ${METADIR}/meta-agl/meta-security \
${METADIR}/meta-agl/meta-app-framework \
"
diff --git a/templates/feature/agl-gplv2/50_bblayers.conf.inc b/templates/feature/agl-gplv2/50_bblayers.conf.inc
new file mode 100644
index 000000000..4c31c45c5
--- /dev/null
+++ b/templates/feature/agl-gplv2/50_bblayers.conf.inc
@@ -0,0 +1 @@
+BBLAYERS =+ "${METADIR}/meta-gplv2"
diff --git a/templates/feature/agl-gplv2/50_local.conf.inc b/templates/feature/agl-gplv2/50_local.conf.inc
new file mode 100644
index 000000000..8e0d5df74
--- /dev/null
+++ b/templates/feature/agl-gplv2/50_local.conf.inc
@@ -0,0 +1,2 @@
+#see meta-agl/meta-agl/conf/include/agl-gplv2.inc
+require conf/include/agl-gplv2.inc
diff --git a/templates/feature/agl-sota/50_bblayers.conf.inc b/templates/feature/agl-sota/50_bblayers.conf.inc
index bdcf07605..dd64eda24 100644
--- a/templates/feature/agl-sota/50_bblayers.conf.inc
+++ b/templates/feature/agl-sota/50_bblayers.conf.inc
@@ -2,7 +2,5 @@ BBLAYERS =+ " \
${METADIR}/meta-updater \
${METADIR}/meta-openembedded/meta-filesystems \
${METADIR}/meta-openembedded/meta-python \
- ${METADIR}/meta-openembedded/meta-ruby \
- ${METADIR}/meta-rust \
"
diff --git a/templates/machine/dragonboard-410c/50_setup.sh b/templates/machine/dragonboard-410c/50_setup.sh
deleted file mode 100644
index 7be1dad32..000000000
--- a/templates/machine/dragonboard-410c/50_setup.sh
+++ /dev/null
@@ -1 +0,0 @@
-find_and_ack_eula $METADIR/meta-qcom
diff --git a/templates/machine/porter-nogfx/50_bblayers.conf.inc b/templates/machine/porter-nogfx/50_bblayers.conf.inc
deleted file mode 100644
index ba0e17ef3..000000000
--- a/templates/machine/porter-nogfx/50_bblayers.conf.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-BBLAYERS =+ "\
- ${METADIR}/meta-renesas \
- ${METADIR}/meta-renesas/meta-rcar-gen2 \
- "
-
diff --git a/templates/machine/porter-nogfx/50_local.conf.inc b/templates/machine/porter-nogfx/50_local.conf.inc
deleted file mode 100644
index 87ec427e3..000000000
--- a/templates/machine/porter-nogfx/50_local.conf.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-MACHINE = "porter"
-#see meta-agl/meta-agl-bsp/conf/include/agl_porter-nogfx.inc
-require conf/include/agl_porter-nogfx.inc
diff --git a/templates/machine/porter/50_bblayers.conf.inc b/templates/machine/porter/50_bblayers.conf.inc
deleted file mode 100644
index ba0e17ef3..000000000
--- a/templates/machine/porter/50_bblayers.conf.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-BBLAYERS =+ "\
- ${METADIR}/meta-renesas \
- ${METADIR}/meta-renesas/meta-rcar-gen2 \
- "
-
diff --git a/templates/machine/porter/50_local.conf.inc b/templates/machine/porter/50_local.conf.inc
deleted file mode 100644
index f2794b0d0..000000000
--- a/templates/machine/porter/50_local.conf.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-MACHINE = "porter"
-#see meta-agl/meta-agl-bsp/conf/include/agl_porter.inc
-require conf/include/agl_porter.inc
diff --git a/templates/machine/porter/50_setup.sh b/templates/machine/porter/50_setup.sh
deleted file mode 100644
index f51d4f4f5..000000000
--- a/templates/machine/porter/50_setup.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-# setup proprietary gfx drivers and multimedia packages
-pushd $METADIR 2>/dev/null
-
-SETUP_MM_SCRIPT=$METADIR/meta-renesas/meta-rcar-gen2/scripts/setup_mm_packages.sh
-if [ -f $SETUP_MM_SCRIPT ]; then
- . $SETUP_MM_SCRIPT $MACHINE
- copy_mm_packages $MACHINE
- if [ $? -ne 0 ]; then
- echo "Copying gfx drivers and multimedia packages for '$MACHINE' failed."
- exit 1
- fi
-fi
-
-popd 2>/dev/null